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
This commit is contained in:
JosiahWI 2021-11-11 15:53:46 -06:00 committed by sfan5
parent d4119ba664
commit 6d133e1bcc
6 changed files with 18 additions and 15 deletions

@ -920,8 +920,10 @@ public:
if ((length+begin) > size()) if ((length+begin) > size())
length = size()-begin; length = size()-begin;
// accounting for null terminator.
s32 substrAllocLength = length + 1;
string<T> o; string<T> o;
o.reserve(length+1); o.reserve(substrAllocLength);
if ( !make_lower ) if ( !make_lower )
{ {
@ -934,7 +936,7 @@ public:
o.array[i] = locale_lower ( array[i+begin] ); o.array[i] = locale_lower ( array[i+begin] );
} }
o.array[length] = 0; o.array[substrAllocLength - 1] = 0;
o.used = length + 1; o.used = length + 1;
return o; return o;

@ -760,10 +760,9 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
IRR_CASE_IIMAGE_COMPRESSED_FORMAT IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING); os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break; break;
#ifndef _DEBUG
default: default:
break; break;
#endif
} }
break; break;
case ECF_R5G6B5: case ECF_R5G6B5:
@ -784,10 +783,9 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
IRR_CASE_IIMAGE_COMPRESSED_FORMAT IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING); os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break; break;
#ifndef _DEBUG
default: default:
break; break;
#endif
} }
break; break;
case ECF_A8R8G8B8: case ECF_A8R8G8B8:
@ -808,10 +806,9 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
IRR_CASE_IIMAGE_COMPRESSED_FORMAT IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING); os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break; break;
#ifndef _DEBUG
default: default:
break; break;
#endif
} }
break; break;
case ECF_R8G8B8: case ECF_R8G8B8:
@ -832,19 +829,17 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
IRR_CASE_IIMAGE_COMPRESSED_FORMAT IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING); os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break; break;
#ifndef _DEBUG
default: default:
break; break;
#endif
} }
break; break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING); os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break; break;
#ifndef _DEBUG
default: default:
break; break;
#endif
} }
} }

@ -102,7 +102,7 @@ namespace
#if defined(_IRR_LINUX_X11_XINPUT2_) #if defined(_IRR_LINUX_X11_XINPUT2_)
int XI_EXTENSIONS_OPCODE; int XI_EXTENSIONS_OPCODE;
#endif #endif
}; }
namespace irr namespace irr
{ {

@ -148,6 +148,9 @@ namespace video
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
const video::SColor* const colors = 0, bool useAlphaChannelOfTexture = false) _IRR_OVERRIDE_; 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); 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 //! draws a set of 2d images, using a color and the alpha channel of the

@ -607,6 +607,9 @@ u32 CSceneManager::registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDE
taken = 1; taken = 1;
} }
// as of yet unused
case ESNRP_LIGHT:
case ESNRP_SHADOW:
case ESNRP_NONE: // ignore this one case ESNRP_NONE: // ignore this one
break; break;
} }

@ -82,7 +82,7 @@ namespace
{ {
return a.rotation == b.rotation; return a.rotation == b.rotation;
} }
}; }
namespace irr namespace irr
{ {