aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerman Semenov <GermanAizek@yandex.ru>2022-09-02 09:40:02 +0300
committerGitHub <noreply@github.com>2022-09-02 08:40:02 +0200
commitd733e03430cf623d722b2efe87872b68bb3d4d1f (patch)
tree768d2ab2ecfb92b40d3acda1f2057a2cf5ea8f2e
parentf0766c845f85c2f467843f20cf811c62cd2402c7 (diff)
downloadirrlicht-d733e03430cf623d722b2efe87872b68bb3d4d1f.tar.xz
Fix glHint parameter, type size and add more null checks (#130)
-rw-r--r--source/Irrlicht/CB3DMeshFileLoader.cpp2
-rw-r--r--source/Irrlicht/CGUIFileOpenDialog.cpp2
-rw-r--r--source/Irrlicht/CImageLoaderPNG.cpp2
-rw-r--r--source/Irrlicht/CImageWriterPNG.cpp2
-rw-r--r--source/Irrlicht/COpenGLDriver.cpp6
-rw-r--r--source/Irrlicht/CWGLManager.cpp3
-rw-r--r--source/Irrlicht/CWriteFile.cpp3
7 files changed, 9 insertions, 11 deletions
diff --git a/source/Irrlicht/CB3DMeshFileLoader.cpp b/source/Irrlicht/CB3DMeshFileLoader.cpp
index 05f9f0f..ca86a6a 100644
--- a/source/Irrlicht/CB3DMeshFileLoader.cpp
+++ b/source/Irrlicht/CB3DMeshFileLoader.cpp
@@ -26,7 +26,7 @@ namespace scene
//! Constructor
CB3DMeshFileLoader::CB3DMeshFileLoader(scene::ISceneManager* smgr)
-: AnimatedMesh(0), B3DFile(0), NormalsInFile(false),
+: AnimatedMesh(0), B3DFile(0), VerticesStart(0), NormalsInFile(false),
HasVertexColors(false), ShowWarning(true)
{
#ifdef _DEBUG
diff --git a/source/Irrlicht/CGUIFileOpenDialog.cpp b/source/Irrlicht/CGUIFileOpenDialog.cpp
index 9e46d80..6599bef 100644
--- a/source/Irrlicht/CGUIFileOpenDialog.cpp
+++ b/source/Irrlicht/CGUIFileOpenDialog.cpp
@@ -74,7 +74,7 @@ CGUIFileOpenDialog::CGUIFileOpenDialog(const wchar_t* title,
L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close");
CloseButton->setSubElement(true);
CloseButton->setTabStop(false);
- if (sprites)
+ if (sprites && skin)
{
CloseButton->setSpriteBank(sprites);
CloseButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_CLOSE), color);
diff --git a/source/Irrlicht/CImageLoaderPNG.cpp b/source/Irrlicht/CImageLoaderPNG.cpp
index 9638421..b468017 100644
--- a/source/Irrlicht/CImageLoaderPNG.cpp
+++ b/source/Irrlicht/CImageLoaderPNG.cpp
@@ -40,7 +40,7 @@ void PNGAPI user_read_data_fcn(png_structp png_ptr, png_bytep data, png_size_t l
// changed by zola {
io::IReadFile* file=(io::IReadFile*)png_get_io_ptr(png_ptr);
- check=(png_size_t) file->read((void*)data,(u32)length);
+ check=(png_size_t) file->read((void*)data, length);
// }
if (check != length)
diff --git a/source/Irrlicht/CImageWriterPNG.cpp b/source/Irrlicht/CImageWriterPNG.cpp
index e9c3dc6..55ae00e 100644
--- a/source/Irrlicht/CImageWriterPNG.cpp
+++ b/source/Irrlicht/CImageWriterPNG.cpp
@@ -46,7 +46,7 @@ void PNGAPI user_write_data_fcn(png_structp png_ptr, png_bytep data, png_size_t
png_size_t check;
io::IWriteFile* file=(io::IWriteFile*)png_get_io_ptr(png_ptr);
- check=(png_size_t) file->write((const void*)data,(u32)length);
+ check=(png_size_t) file->write((const void*)data, length);
if (check != length)
png_error(png_ptr, "Write Error");
diff --git a/source/Irrlicht/COpenGLDriver.cpp b/source/Irrlicht/COpenGLDriver.cpp
index 40f68b4..c01ece6 100644
--- a/source/Irrlicht/COpenGLDriver.cpp
+++ b/source/Irrlicht/COpenGLDriver.cpp
@@ -2615,7 +2615,7 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
if ((material.AntiAliasing & EAAM_QUALITY) == EAAM_QUALITY)
glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST);
else
- glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST);
+ glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_FASTEST);
}
#endif
}
@@ -3805,10 +3805,10 @@ IImage* COpenGLDriver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RE
glPixelStorei(GL_PACK_INVERT_MESA, GL_FALSE);
else
#endif
- if (pixels)
+ if (pixels && newImage)
{
// opengl images are horizontally flipped, so we have to fix that here.
- const s32 pitch=newImage->getPitch();
+ const s32 pitch = newImage->getPitch();
u8* p2 = pixels + (ScreenSize.Height - 1) * pitch;
u8* tmpBuffer = new u8[pitch];
for (u32 i=0; i < ScreenSize.Height; i += 2)
diff --git a/source/Irrlicht/CWGLManager.cpp b/source/Irrlicht/CWGLManager.cpp
index 182c460..0d7ef42 100644
--- a/source/Irrlicht/CWGLManager.cpp
+++ b/source/Irrlicht/CWGLManager.cpp
@@ -46,13 +46,12 @@ bool CWGLManager::initialize(const SIrrlichtCreationParameters& params, const SE
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = lhInstance;
- wcex.hIcon = NULL;
+ wcex.hIcon = 0;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = 0;
wcex.lpszClassName = ClassName;
wcex.hIconSm = 0;
- wcex.hIcon = 0;
RegisterClassEx(&wcex);
RECT clientSize;
diff --git a/source/Irrlicht/CWriteFile.cpp b/source/Irrlicht/CWriteFile.cpp
index 3279402..aa07b49 100644
--- a/source/Irrlicht/CWriteFile.cpp
+++ b/source/Irrlicht/CWriteFile.cpp
@@ -12,13 +12,12 @@ namespace io
CWriteFile::CWriteFile(const io::path& fileName, bool append)
-: FileSize(0)
+: FileSize(0), Filename(fileName)
{
#ifdef _DEBUG
setDebugName("CWriteFile");
#endif
- Filename = fileName;
openFile(append);
}