[Pcre-svn] [1143] code/trunk: Get rid of compiler warnings f…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1143] code/trunk: Get rid of compiler warnings from pcre_compile. c in all modes.
Revision: 1143
          http://vcs.pcre.org/viewvc?view=rev&revision=1143
Author:   ph10
Date:     2012-10-19 17:14:27 +0100 (Fri, 19 Oct 2012)


Log Message:
-----------
Get rid of compiler warnings from pcre_compile.c in all modes.

Modified Paths:
--------------
    code/trunk/pcre_compile.c
    code/trunk/pcre_internal.h


Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2012-10-19 15:45:43 UTC (rev 1142)
+++ code/trunk/pcre_compile.c    2012-10-19 16:14:27 UTC (rev 1143)
@@ -3796,7 +3796,7 @@
   pcre_int32 subreqcharflags, subfirstcharflags;
   int terminator;
   unsigned int mclength;
-  int tempbracount;
+  unsigned int tempbracount;
   pcre_uint32 ec;
   pcre_uchar mcbuffer[8];


@@ -7107,8 +7107,8 @@
pcre_uint32 branchfirstchar, branchreqchar;
pcre_int32 branchfirstcharflags, branchreqcharflags;
int length;
-int orig_bracount;
-int max_bracount;
+unsigned int orig_bracount;
+unsigned int max_bracount;
branch_chain bc;

bc.outer = bcptr;

Modified: code/trunk/pcre_internal.h
===================================================================
--- code/trunk/pcre_internal.h    2012-10-19 15:45:43 UTC (rev 1142)
+++ code/trunk/pcre_internal.h    2012-10-19 16:14:27 UTC (rev 1143)
@@ -523,9 +523,13 @@
 #define PUT2(a,n,d)   \
   a[n] = (d) >> 8; \
   a[(n)+1] = (d) & 255
+  
+/* For reasons that I do not understand, the expression in this GET2 macro is 
+treated by gcc as a signed expression, even when a is declared as unsigned. It 
+seems that any kind of arithmetic results in a signed value. */


#define GET2(a,n) \
- (((a)[n] << 8) | (a)[(n)+1])
+ (unsigned int)(((a)[n] << 8) | (a)[(n)+1])

#elif defined COMPILE_PCRE16

@@ -2394,7 +2398,7 @@
   int  names_found;                 /* Number of entries so far */
   int  name_entry_size;             /* Size of each entry */
   int  workspace_size;              /* Size of workspace */
-  int  bracount;                    /* Count of capturing parens as we compile */
+  unsigned int  bracount;           /* Count of capturing parens as we compile */
   int  final_bracount;              /* Saved value after first pass */
   int  max_lookbehind;              /* Maximum lookbehind (characters) */
   int  top_backref;                 /* Maximum back reference */