[Pcre-svn] [1233] code/trunk: Fix some Microsoft compiler wa…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1233] code/trunk: Fix some Microsoft compiler warnings.
Revision: 1233
          http://vcs.pcre.org/viewvc?view=rev&revision=1233
Author:   ph10
Date:     2012-12-08 12:43:37 +0000 (Sat, 08 Dec 2012)


Log Message:
-----------
Fix some Microsoft compiler warnings.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_compile.c
    code/trunk/pcre_dfa_exec.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2012-12-07 12:08:44 UTC (rev 1232)
+++ code/trunk/ChangeLog    2012-12-08 12:43:37 UTC (rev 1233)
@@ -1,6 +1,15 @@
 ChangeLog for PCRE
 ------------------


+Version 8.33 xx-xxxx-201x
+-------------------------
+
+1.  Added 'U' to some constants that are compared to unsigned integers, to
+    avoid compiler signed/unsigned warnings. Added (int) casts to unsigned
+    variables that are added to signed variables, to ensure the result is
+    signed and can be negated.
+     
+
 Version 8.32 30-November-2012
 -----------------------------



Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2012-12-07 12:08:44 UTC (rev 1232)
+++ code/trunk/pcre_compile.c    2012-12-08 12:43:37 UTC (rev 1233)
@@ -847,11 +847,11 @@
           }


 #if defined COMPILE_PCRE8
-        if (c > (utf ? 0x10ffff : 0xff))
+        if (c > (utf ? 0x10ffffU : 0xffU))
 #elif defined COMPILE_PCRE16
-        if (c > (utf ? 0x10ffff : 0xffff))
+        if (c > (utf ? 0x10ffffU : 0xffffU))
 #elif defined COMPILE_PCRE32
-        if (utf && c > 0x10ffff)
+        if (utf && c > 0x10ffffU)
 #endif
           {
           *errorcodeptr = ERR76;
@@ -1085,11 +1085,11 @@
 #endif


 #if defined COMPILE_PCRE8
-        if (c > (utf ? 0x10ffff : 0xff)) { overflow = TRUE; break; }
+        if (c > (utf ? 0x10ffffU : 0xffU)) { overflow = TRUE; break; }
 #elif defined COMPILE_PCRE16
-        if (c > (utf ? 0x10ffff : 0xffff)) { overflow = TRUE; break; }
+        if (c > (utf ? 0x10ffffU : 0xffffU)) { overflow = TRUE; break; }
 #elif defined COMPILE_PCRE32
-        if (utf && c > 0x10ffff) { overflow = TRUE; break; }
+        if (utf && c > 0x10ffffU) { overflow = TRUE; break; }
 #endif
         }



Modified: code/trunk/pcre_dfa_exec.c
===================================================================
--- code/trunk/pcre_dfa_exec.c    2012-12-07 12:08:44 UTC (rev 1232)
+++ code/trunk/pcre_dfa_exec.c    2012-12-08 12:43:37 UTC (rev 1233)
@@ -1705,7 +1705,7 @@
             active_count--;           /* Remove non-match possibility */
             next_active_state--;
             }
-          ADD_NEW_DATA(-(state_offset + count), 0, ncount);
+          ADD_NEW_DATA(-(state_offset + (int)count), 0, ncount);
           break;


           default:
@@ -1749,7 +1749,7 @@
             active_count--;           /* Remove non-match possibility */
             next_active_state--;
             }
-          ADD_NEW_DATA(-(state_offset + count), 0, 0);
+          ADD_NEW_DATA(-(state_offset + (int)count), 0, 0);
           }
         }
       break;
@@ -1790,7 +1790,7 @@
             active_count--;           /* Remove non-match possibility */
             next_active_state--;
             }
-          ADD_NEW_DATA(-(state_offset + count), 0, 0);
+          ADD_NEW_DATA(-(state_offset + (int)count), 0, 0);
           }
         }
       break;