[Pcre-svn] [1477] code/trunk: Casts and type changes for com…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1477] code/trunk: Casts and type changes for compiler warnings.
Revision: 1477
          http://vcs.pcre.org/viewvc?view=rev&revision=1477
Author:   ph10
Date:     2014-05-21 18:53:49 +0100 (Wed, 21 May 2014)


Log Message:
-----------
Casts and type changes for compiler warnings.

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


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2014-04-28 06:49:36 UTC (rev 1476)
+++ code/trunk/ChangeLog    2014-05-21 17:53:49 UTC (rev 1477)
@@ -22,6 +22,9 @@


 5.  Fixed an issue, which occures when nested alternatives are optimized
     with table jumps.
+    
+6.  Inserted two casts and changed some ints to size_t in the light of some
+    reported 64-bit compiler warnings (Bugzilla 1477). 



Version 8.35 04-April-2014

Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2014-04-28 06:49:36 UTC (rev 1476)
+++ code/trunk/pcre_compile.c    2014-05-21 17:53:49 UTC (rev 1477)
@@ -3035,7 +3035,7 @@
     end += 1 + 2 * IMM2_SIZE;
     break;
     }
-  list[2] = end - code;
+  list[2] = (pcre_uint32)(end - code);
   return end;
   }
 return NULL;    /* Opcode not accepted */
@@ -4860,7 +4860,7 @@
       if (lengthptr != NULL && class_uchardata > class_uchardata_base)
         {
         xclass = TRUE;
-        *lengthptr += class_uchardata - class_uchardata_base;
+        *lengthptr += (int)(class_uchardata - class_uchardata_base);
         class_uchardata = class_uchardata_base;
         }
 #endif
@@ -6005,8 +6005,8 @@
               while (cd->hwm > cd->start_workspace + cd->workspace_size -
                      WORK_SIZE_SAFETY_MARGIN - (this_hwm - save_hwm))
                 {
-                int save_offset = save_hwm - cd->start_workspace;
-                int this_offset = this_hwm - cd->start_workspace;
+                size_t save_offset = save_hwm - cd->start_workspace;
+                size_t this_offset = this_hwm - cd->start_workspace;
                 *errorcodeptr = expand_workspace(cd);
                 if (*errorcodeptr != 0) goto FAILED;
                 save_hwm = (pcre_uchar *)cd->start_workspace + save_offset;
@@ -6087,8 +6087,8 @@
           while (cd->hwm > cd->start_workspace + cd->workspace_size -
                  WORK_SIZE_SAFETY_MARGIN - (this_hwm - save_hwm))
             {
-            int save_offset = save_hwm - cd->start_workspace;
-            int this_offset = this_hwm - cd->start_workspace;
+            size_t save_offset = save_hwm - cd->start_workspace;
+            size_t this_offset = this_hwm - cd->start_workspace;
             *errorcodeptr = expand_workspace(cd);
             if (*errorcodeptr != 0) goto FAILED;
             save_hwm = (pcre_uchar *)cd->start_workspace + save_offset;


Modified: code/trunk/pcre_dfa_exec.c
===================================================================
--- code/trunk/pcre_dfa_exec.c    2014-04-28 06:49:36 UTC (rev 1476)
+++ code/trunk/pcre_dfa_exec.c    2014-05-21 17:53:49 UTC (rev 1477)
@@ -3242,7 +3242,7 @@


 if (extra_data != NULL)
   {
-  unsigned int flags = extra_data->flags;
+  unsigned long int flags = extra_data->flags;
   if ((flags & PCRE_EXTRA_STUDY_DATA) != 0)
     study = (const pcre_study_data *)extra_data->study_data;
   if ((flags & PCRE_EXTRA_MATCH_LIMIT) != 0) return PCRE_ERROR_DFA_UMLIMIT;


Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2014-04-28 06:49:36 UTC (rev 1476)
+++ code/trunk/pcre_exec.c    2014-05-21 17:53:49 UTC (rev 1477)
@@ -6490,7 +6490,7 @@


 if (extra_data != NULL)
   {
-  register unsigned int flags = extra_data->flags;
+  unsigned long int flags = extra_data->flags;
   if ((flags & PCRE_EXTRA_STUDY_DATA) != 0)
     study = (const pcre_study_data *)extra_data->study_data;
   if ((flags & PCRE_EXTRA_MATCH_LIMIT) != 0)