From 2f84ab0cdc8f4888d5d141f8e81c10c735b5deaf Mon Sep 17 00:00:00 2001 From: cutealien Date: Thu, 12 Dec 2019 16:52:46 +0000 Subject: [PATCH] Avoid some gcc warnings. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6001 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/CGUITabControl.cpp | 4 ++-- source/Irrlicht/CImageLoaderPNG.cpp | 2 +- source/Irrlicht/CMY3DHelper.h | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/source/Irrlicht/CGUITabControl.cpp b/source/Irrlicht/CGUITabControl.cpp index a09ced2e..998856b1 100644 --- a/source/Irrlicht/CGUITabControl.cpp +++ b/source/Irrlicht/CGUITabControl.cpp @@ -295,7 +295,7 @@ s32 CGUITabControl::insertTab(s32 idx, IGUITab* tab, bool serializationMode) return -1; // Not allowing to add same tab twice as it would make things complicated (serialization or setting active visible) if ( getTabIndex(tab) >= 0 ) - return -1; + return -1; if ( idx < 0 ) idx = (s32)Tabs.size(); @@ -380,7 +380,7 @@ void CGUITabControl::removeTabButNotChild(s32 idx) } else if ( idx == ActiveTabIndex ) { - if ( idx == Tabs.size() ) + if ( (u32)idx == Tabs.size() ) --ActiveTabIndex; setVisibleTab(ActiveTabIndex); } diff --git a/source/Irrlicht/CImageLoaderPNG.cpp b/source/Irrlicht/CImageLoaderPNG.cpp index feae1918..1df1eada 100644 --- a/source/Irrlicht/CImageLoaderPNG.cpp +++ b/source/Irrlicht/CImageLoaderPNG.cpp @@ -92,7 +92,6 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const if (!file) return 0; - video::IImage* image = 0; //Used to point to image rows u8** RowPointers = 0; @@ -222,6 +221,7 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const } // Create the image structure to be filled by png data + video::IImage* image = 0; if (ColorType==PNG_COLOR_TYPE_RGB_ALPHA) image = new CImage(ECF_A8R8G8B8, core::dimension2d(Width, Height)); else diff --git a/source/Irrlicht/CMY3DHelper.h b/source/Irrlicht/CMY3DHelper.h index 8f0906f0..c1566d11 100644 --- a/source/Irrlicht/CMY3DHelper.h +++ b/source/Irrlicht/CMY3DHelper.h @@ -188,7 +188,7 @@ int rle_encode ( { unsigned long ret_code; - unsigned char ch; + unsigned char ch=0; nCodedBytes=0; nReadedBytes=0; @@ -271,7 +271,7 @@ unsigned long process_comp( // we start out with 3 repeating bytes int len = 3; - unsigned char ch; + unsigned char ch = 0; // we're starting a repeating chunk - end the non-repeaters flush_outbuf(out_buf, out_buf_size); @@ -338,11 +338,12 @@ void flush_outbuf(unsigned char *out_buf, int out_buf_size) put_byte((unsigned char)outbuf[pos++], out_buf, out_buf_size); } //--------------------------------------------------- -void put_byte(unsigned char ch, unsigned char *out_buf, int out_buf_size) +void put_byte(unsigned char b, unsigned char *out_buf, int out_buf_size) { if (nCodedBytes<=(out_buf_size-1)) - { out_buf[nCodedBytes++]=ch; - out_buf[nCodedBytes]=0; + { + out_buf[nCodedBytes++] = b; + out_buf[nCodedBytes] = 0; } } //---------------------------------------------------