[Pcre-svn] [913] code/trunk: Add a cast to fix a compiler wa…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [913] code/trunk: Add a cast to fix a compiler warning.
Revision: 913
          http://vcs.pcre.org/viewvc?view=rev&revision=913
Author:   ph10
Date:     2012-02-12 17:06:59 +0000 (Sun, 12 Feb 2012)


Log Message:
-----------
Add a cast to fix a compiler warning.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_exec.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2012-02-12 16:53:39 UTC (rev 912)
+++ code/trunk/ChangeLog    2012-02-12 17:06:59 UTC (rev 913)
@@ -8,7 +8,11 @@


2. Removed a bashism from the RunTest script.

+3.  Add a cast to pcre_exec.c to fix the warning "unary minus operator applied
+    to unsigned type, result still unsigned" that was given by an MS compiler 
+    on encountering the code "-sizeof(xxx)".


+
Version 8.30 04-February-2012
-----------------------------


Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2012-02-12 16:53:39 UTC (rev 912)
+++ code/trunk/pcre_exec.c    2012-02-12 17:06:59 UTC (rev 913)
@@ -6208,12 +6208,14 @@
 const REAL_PCRE *re = (const REAL_PCRE *)argument_re;


/* Check for the special magic call that measures the size of the stack used
-per recursive call of match(). */
+per recursive call of match(). Without the funny casting for sizeof, a Windows
+compiler gave this error: "unary minus operator applied to unsigned type,
+result still unsigned". Hopefully the cast fixes that. */

 if (re == NULL && extra_data == NULL && subject == NULL && length == -999 &&
     start_offset == -999)
 #ifdef NO_RECURSE
-  return -sizeof(heapframe);
+  return -((int)sizeof(heapframe));
 #else
   return match(NULL, NULL, NULL, 0, NULL, NULL, 0);
 #endif