Bug #15204 2009-02-05 10:30

yesno

Warning when compiling DigitView.cpp

When compiling DigitView.cpp, the compiler prints this message:
C:\SRC-Extern\codeblocks\trunk\src\plugins\contrib\HexEditor\DigitView.cpp: In member function `virtual void DigitView::OnProcessChar(wxChar)':
C:\SRC-Extern\codeblocks\trunk\src\plugins\contrib\HexEditor\DigitView.cpp:206: warning: converting of negative value `-0x000000001' to `unsigned int'

I have made changes (3 lines), then the warning disappeared

Index: DigitView.cpp
===================================================================
--- DigitView.cpp       (Revision 5440)
+++ DigitView.cpp       (Arbeitskopie)
@@ -201,9 +201,9 @@
     if ( GetCurrentOffset() >= GetContent()->GetSize() ) return;

     // Get the value of pressed character
-    int value = ( ch>='0' && ch<='9' ) ? ( ch - '0' ) :
-                ( ch>='A' && ch<='Z' ) ? ( ch - 'A' + 10 ) :
-                ( ch>='a' && ch<='z' ) ? ( ch - 'a' + 10 ) : -1;
+    int value = ( ch>='0' && ch<='9' ) ? static_cast<int>(( ch - '0' )) :
+                ( ch>='A' && ch<='Z' ) ? static_cast<int>(( ch - 'A' + 10 )) :
+                ( ch>='a' && ch<='z' ) ? static_cast<int>(( ch - 'a' + 10 )) : -1;

     if ( value<0 || value>GetMaxDigitValue() ) return;
Category
Plugin::Any
Group
 
Status
Open
Close date
 
Assigned to