diff options
author | JosiahWI <josiah_vanderzee@mediacombb.net> | 2021-11-11 15:53:46 -0600 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-11-24 22:07:26 +0100 |
commit | 6d133e1bcc82c8646e0f94132a7e2cf09c840745 (patch) | |
tree | 723a2c681b134a9e1fc5067f3e7abff7d086e0c6 | |
parent | d4119ba6640fa96eb0587b46c4a64c2e818818a8 (diff) | |
download | irrlicht-6d133e1bcc82c8646e0f94132a7e2cf09c840745.tar.xz |
Fix various GCC warnings
- fix overload hiding
- handle missing enumeration values in switch
- remove extraenous semicolons
- always have defaults in color converter switch
- fix root cause of stringop warning
-rw-r--r-- | include/irrString.h | 6 | ||||
-rw-r--r-- | source/Irrlicht/CColorConverter.cpp | 17 | ||||
-rw-r--r-- | source/Irrlicht/CIrrDeviceLinux.cpp | 2 | ||||
-rw-r--r-- | source/Irrlicht/COpenGLDriver.h | 3 | ||||
-rw-r--r-- | source/Irrlicht/CSceneManager.cpp | 3 | ||||
-rw-r--r-- | source/Irrlicht/CSkinnedMesh.cpp | 2 |
6 files changed, 18 insertions, 15 deletions
diff --git a/include/irrString.h b/include/irrString.h index 3178c39..f454aed 100644 --- a/include/irrString.h +++ b/include/irrString.h @@ -920,8 +920,10 @@ public: if ((length+begin) > size())
length = size()-begin;
+ // accounting for null terminator.
+ s32 substrAllocLength = length + 1;
string<T> o;
- o.reserve(length+1);
+ o.reserve(substrAllocLength);
if ( !make_lower )
{
@@ -934,7 +936,7 @@ public: o.array[i] = locale_lower ( array[i+begin] );
}
- o.array[length] = 0;
+ o.array[substrAllocLength - 1] = 0;
o.used = length + 1;
return o;
diff --git a/source/Irrlicht/CColorConverter.cpp b/source/Irrlicht/CColorConverter.cpp index f1e5411..9f9b48e 100644 --- a/source/Irrlicht/CColorConverter.cpp +++ b/source/Irrlicht/CColorConverter.cpp @@ -760,10 +760,9 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
-#ifndef _DEBUG
+
default:
break;
-#endif
}
break;
case ECF_R5G6B5:
@@ -784,10 +783,9 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
-#ifndef _DEBUG
+
default:
break;
-#endif
}
break;
case ECF_A8R8G8B8:
@@ -808,10 +806,9 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
-#ifndef _DEBUG
+
default:
break;
-#endif
}
break;
case ECF_R8G8B8:
@@ -832,19 +829,17 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
-#ifndef _DEBUG
+
default:
break;
-#endif
}
break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
-#ifndef _DEBUG
+
default:
- break;
-#endif
+ break;
}
}
diff --git a/source/Irrlicht/CIrrDeviceLinux.cpp b/source/Irrlicht/CIrrDeviceLinux.cpp index c23a02b..c4f8d4e 100644 --- a/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/source/Irrlicht/CIrrDeviceLinux.cpp @@ -102,7 +102,7 @@ namespace #if defined(_IRR_LINUX_X11_XINPUT2_)
int XI_EXTENSIONS_OPCODE;
#endif
-};
+}
namespace irr
{
diff --git a/source/Irrlicht/COpenGLDriver.h b/source/Irrlicht/COpenGLDriver.h index 8b2616e..281605f 100644 --- a/source/Irrlicht/COpenGLDriver.h +++ b/source/Irrlicht/COpenGLDriver.h @@ -148,6 +148,9 @@ namespace video const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
const video::SColor* const colors = 0, bool useAlphaChannelOfTexture = false) _IRR_OVERRIDE_;
+ // Explicitly bring in base class methods, otherwise
+ // this overload would hide them.
+ using CNullDriver::draw2DImage;
virtual void draw2DImage(const video::ITexture* texture, u32 layer, bool flip);
//! draws a set of 2d images, using a color and the alpha channel of the
diff --git a/source/Irrlicht/CSceneManager.cpp b/source/Irrlicht/CSceneManager.cpp index 849b4e3..3223f4e 100644 --- a/source/Irrlicht/CSceneManager.cpp +++ b/source/Irrlicht/CSceneManager.cpp @@ -607,6 +607,9 @@ u32 CSceneManager::registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDE taken = 1;
}
+ // as of yet unused
+ case ESNRP_LIGHT:
+ case ESNRP_SHADOW:
case ESNRP_NONE: // ignore this one
break;
}
diff --git a/source/Irrlicht/CSkinnedMesh.cpp b/source/Irrlicht/CSkinnedMesh.cpp index 31b8450..eb9fb27 100644 --- a/source/Irrlicht/CSkinnedMesh.cpp +++ b/source/Irrlicht/CSkinnedMesh.cpp @@ -82,7 +82,7 @@ namespace {
return a.rotation == b.rotation;
}
-};
+}
namespace irr
{
|