[Pcre-svn] [530] code/trunk: Added a lot of (int) casts to a…

Página Inicial
Delete this message
Autor: Subversion repository
Data:  
Para: pcre-svn
Assunto: [Pcre-svn] [530] code/trunk: Added a lot of (int) casts to avoid compiler warnings in systems where
Revision: 530
          http://vcs.pcre.org/viewvc?view=rev&revision=530
Author:   ph10
Date:     2010-06-01 14:42:06 +0100 (Tue, 01 Jun 2010)


Log Message:
-----------
Added a lot of (int) casts to avoid compiler warnings in systems where      
size_t is 64-bit.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_compile.c
    code/trunk/pcre_dfa_exec.c
    code/trunk/pcre_exec.c
    code/trunk/pcre_scanner.cc
    code/trunk/pcre_scanner_unittest.cc
    code/trunk/pcrecpp.cc
    code/trunk/pcregrep.c
    code/trunk/pcreposix.c
    code/trunk/pcretest.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2010-05-31 17:28:08 UTC (rev 529)
+++ code/trunk/ChangeLog    2010-06-01 13:42:06 UTC (rev 530)
@@ -64,6 +64,9 @@
     input, it could crash or give wrong results if characters with values 
     greater than 0xc0 were present in the subject string. (Detail: it assumed 
     UTF-8 input when processing these items.)
+    
+17. Added a lot of (int) casts to avoid compiler warnings in systems where
+    size_t is 64-bit.





Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2010-05-31 17:28:08 UTC (rev 529)
+++ code/trunk/pcre_compile.c    2010-06-01 13:42:06 UTC (rev 530)
@@ -2316,8 +2316,8 @@
 {
 *code++ = OP_CALLOUT;
 *code++ = 255;
-PUT(code, 0, ptr - cd->start_pattern);  /* Pattern offset */
-PUT(code, LINK_SIZE, 0);                /* Default length */
+PUT(code, 0, (int)(ptr - cd->start_pattern));  /* Pattern offset */
+PUT(code, LINK_SIZE, 0);                       /* Default length */
 return code + 2*LINK_SIZE;
 }


@@ -2342,7 +2342,7 @@
static void
complete_callout(uschar *previous_callout, const uschar *ptr, compile_data *cd)
{
-int length = ptr - cd->start_pattern - GET(previous_callout, 2);
+int length = (int)(ptr - cd->start_pattern - GET(previous_callout, 2));
PUT(previous_callout, 2 + LINK_SIZE, length);
}

@@ -2901,7 +2901,7 @@
       goto FAILED;
       }


-    *lengthptr += code - last_code;
+    *lengthptr += (int)(code - last_code);
     DPRINTF(("length=%d added %d c=%c\n", *lengthptr, code - last_code, c));


     /* If "previous" is set and it is not at the start of the work space, move
@@ -3019,7 +3019,7 @@
         *errorcodeptr = ERR20;
         goto FAILED;
         }
-      *lengthptr += code - last_code;   /* To include callout length */
+      *lengthptr += (int)(code - last_code);   /* To include callout length */
       DPRINTF((">> end branch\n"));
       }
     return TRUE;
@@ -3224,7 +3224,7 @@
           ptr++;
           }


-        posix_class = check_posix_name(ptr, tempptr - ptr);
+        posix_class = check_posix_name(ptr, (int)(tempptr - ptr));
         if (posix_class < 0)
           {
           *errorcodeptr = ERR30;
@@ -4254,7 +4254,7 @@
       {
       register int i;
       int ketoffset = 0;
-      int len = code - previous;
+      int len = (int)(code - previous);
       uschar *bralink = NULL;


       /* Repeating a DEFINE group is pointless */
@@ -4275,7 +4275,7 @@
         {
         register uschar *ket = previous;
         do ket += GET(ket, 1); while (*ket != OP_KET);
-        ketoffset = code - ket;
+        ketoffset = (int)(code - ket);
         }


       /* The case of a zero minimum is special because of the need to stick
@@ -4343,7 +4343,7 @@
           /* We chain together the bracket offset fields that have to be
           filled in later when the ends of the brackets are reached. */


-          offset = (bralink == NULL)? 0 : previous - bralink;
+          offset = (bralink == NULL)? 0 : (int)(previous - bralink);
           bralink = previous;
           PUTINC(previous, 0, offset);
           }
@@ -4452,7 +4452,7 @@
             {
             int offset;
             *code++ = OP_BRA;
-            offset = (bralink == NULL)? 0 : code - bralink;
+            offset = (bralink == NULL)? 0 : (int)(code - bralink);
             bralink = code;
             PUTINC(code, 0, offset);
             }
@@ -4473,7 +4473,7 @@
         while (bralink != NULL)
           {
           int oldlinkoffset;
-          int offset = code - bralink + 1;
+          int offset = (int)(code - bralink + 1);
           uschar *bra = code - offset;
           oldlinkoffset = GET(bra, 1);
           bralink = (oldlinkoffset == 0)? NULL : bralink - oldlinkoffset;
@@ -4561,7 +4561,7 @@
 #endif
         }


-      len = code - tempcode;
+      len = (int)(code - tempcode);
       if (len > 0) switch (*tempcode)
         {
         case OP_STAR:  *tempcode = OP_POSSTAR; break;
@@ -4630,7 +4630,7 @@
       const uschar *arg = NULL;
       previous = NULL;
       while ((cd->ctypes[*++ptr] & ctype_letter) != 0) {};
-      namelen = ptr - name;
+      namelen = (int)(ptr - name);


       if (*ptr == CHAR_COLON)
         {
@@ -4818,7 +4818,7 @@
               recno * 10 + *ptr - CHAR_0 : -1;
           ptr++;
           }
-        namelen = ptr - name;
+        namelen = (int)(ptr - name);


         if ((terminator > 0 && *ptr++ != terminator) ||
             *ptr++ != CHAR_RIGHT_PARENTHESIS)
@@ -5014,8 +5014,8 @@
             goto FAILED;
             }
           *code++ = n;
-          PUT(code, 0, ptr - cd->start_pattern + 1);  /* Pattern offset */
-          PUT(code, LINK_SIZE, 0);                    /* Default length */
+          PUT(code, 0, (int)(ptr - cd->start_pattern + 1)); /* Pattern offset */
+          PUT(code, LINK_SIZE, 0);                          /* Default length */
           code += 2 * LINK_SIZE;
           }
         previous = NULL;
@@ -5048,7 +5048,7 @@
           name = ++ptr;


           while ((cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
-          namelen = ptr - name;
+          namelen = (int)(ptr - name);


           /* In the pre-compile phase, just do a syntax check. */


@@ -5178,7 +5178,7 @@
         NAMED_REF_OR_RECURSE:
         name = ++ptr;
         while ((cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
-        namelen = ptr - name;
+        namelen = (int)(ptr - name);


         /* In the pre-compile phase, do a syntax check and set a dummy
         reference number. */
@@ -5347,7 +5347,7 @@
               of the group. */


               called = cd->start_code + recno;
-              PUTINC(cd->hwm, 0, code + 2 + LINK_SIZE - cd->start_code);
+              PUTINC(cd->hwm, 0, (int)(code + 2 + LINK_SIZE - cd->start_code));
               }


             /* If not a forward reference, and the subpattern is still open,
@@ -5371,7 +5371,7 @@
           code += 1 + LINK_SIZE;


           *code = OP_RECURSE;
-          PUT(code, 1, called - cd->start_code);
+          PUT(code, 1, (int)(called - cd->start_code));
           code += 1 + LINK_SIZE;


           *code = OP_KET;
@@ -6189,7 +6189,7 @@
     {
     if (lengthptr == NULL)
       {
-      int branch_length = code - last_branch;
+      int branch_length = (int)(code - last_branch);
       do
         {
         int prev_length = GET(last_branch, 1);
@@ -6203,7 +6203,7 @@
     /* Fill in the ket */


     *code = OP_KET;
-    PUT(code, 1, code - start_bracket);
+    PUT(code, 1, (int)(code - start_bracket));
     code += 1 + LINK_SIZE;


     /* If it was a capturing subpattern, check to see if it contained any
@@ -6218,9 +6218,9 @@
           code - start_bracket);
         *start_bracket = OP_ONCE;
         code += 1 + LINK_SIZE;
-        PUT(start_bracket, 1, code - start_bracket);
+        PUT(start_bracket, 1, (int)(code - start_bracket));
         *code = OP_KET;
-        PUT(code, 1, code - start_bracket);
+        PUT(code, 1, (int)(code - start_bracket));
         code += 1 + LINK_SIZE;
         length += 2 + 2*LINK_SIZE;
         }
@@ -6275,7 +6275,7 @@
   else
     {
     *code = OP_ALT;
-    PUT(code, 1, code - last_branch);
+    PUT(code, 1, (int)(code - last_branch));
     bc.current_branch = last_branch = code;
     code += 1 + LINK_SIZE;
     }
@@ -6847,7 +6847,7 @@
 pointers. */


 re->magic_number = MAGIC_NUMBER;
-re->size = size;
+re->size = (int)size;
 re->options = cd->external_options;
 re->flags = cd->external_flags;
 re->dummy1 = 0;
@@ -6918,7 +6918,7 @@
   recno = GET(codestart, offset);
   groupptr = _pcre_find_bracket(codestart, utf8, recno);
   if (groupptr == NULL) errorcode = ERR53;
-    else PUT(((uschar *)codestart), offset, groupptr - codestart);
+    else PUT(((uschar *)codestart), offset, (int)(groupptr - codestart));
   }


/* Give an error if there's back reference to a non-existent capturing
@@ -6973,7 +6973,7 @@
{
(pcre_free)(re);
PCRE_EARLY_ERROR_RETURN:
- *erroroffset = ptr - (const uschar *)pattern;
+ *erroroffset = (int)(ptr - (const uschar *)pattern);
PCRE_EARLY_ERROR_RETURN2:
*errorptr = find_error_text(errorcode);
if (errorcodeptr != NULL) *errorcodeptr = errorcode;

Modified: code/trunk/pcre_dfa_exec.c
===================================================================
--- code/trunk/pcre_dfa_exec.c    2010-05-31 17:28:08 UTC (rev 529)
+++ code/trunk/pcre_dfa_exec.c    2010-06-01 13:42:06 UTC (rev 530)
@@ -475,7 +475,7 @@


     {
     gone_back = (current_subject - max_back < start_subject)?
-      current_subject - start_subject : max_back;
+      (int)(current_subject - start_subject) : max_back;
     current_subject -= gone_back;
     }


@@ -492,7 +492,7 @@
     int back = GET(end_code, 2+LINK_SIZE);
     if (back <= gone_back)
       {
-      int bstate = end_code - start_code + 2 + 2*LINK_SIZE;
+      int bstate = (int)(end_code - start_code + 2 + 2*LINK_SIZE);
       ADD_NEW_DATA(-bstate, 0, gone_back - back);
       }
     end_code += GET(end_code, 1);
@@ -528,7 +528,7 @@
       ((*this_start_code == OP_CBRA || *this_start_code == OP_SCBRA)? 2:0);
     do
       {
-      ADD_NEW(end_code - start_code + length, 0);
+      ADD_NEW((int)(end_code - start_code + length), 0);
       end_code += GET(end_code, 1);
       length = 1 + LINK_SIZE;
       }
@@ -755,8 +755,8 @@
           if (count > 0) memmove(offsets + 2, offsets, count * sizeof(int));
           if (offsetcount >= 2)
             {
-            offsets[0] = current_subject - start_subject;
-            offsets[1] = ptr - start_subject;
+            offsets[0] = (int)(current_subject - start_subject);
+            offsets[1] = (int)(ptr - start_subject);
             DPRINTF(("%.*sSet matched string = \"%.*s\"\n", rlevel*2-2, SP,
               offsets[1] - offsets[0], current_subject));
             }
@@ -778,7 +778,7 @@
       /*-----------------------------------------------------------------*/
       case OP_ALT:
       do { code += GET(code, 1); } while (*code == OP_ALT);
-      ADD_ACTIVE(code - start_code, 0);
+      ADD_ACTIVE((int)(code - start_code), 0);
       break;


       /*-----------------------------------------------------------------*/
@@ -786,7 +786,7 @@
       case OP_SBRA:
       do
         {
-        ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);
+        ADD_ACTIVE((int)(code - start_code + 1 + LINK_SIZE), 0);
         code += GET(code, 1);
         }
       while (*code == OP_ALT);
@@ -795,11 +795,11 @@
       /*-----------------------------------------------------------------*/
       case OP_CBRA:
       case OP_SCBRA:
-      ADD_ACTIVE(code - start_code + 3 + LINK_SIZE,  0);
+      ADD_ACTIVE((int)(code - start_code + 3 + LINK_SIZE),  0);
       code += GET(code, 1);
       while (*code == OP_ALT)
         {
-        ADD_ACTIVE(code - start_code + 1 + LINK_SIZE,  0);
+        ADD_ACTIVE((int)(code - start_code + 1 + LINK_SIZE),  0);
         code += GET(code, 1);
         }
       break;
@@ -810,14 +810,14 @@
       ADD_ACTIVE(state_offset + 1, 0);
       code += 1 + GET(code, 2);
       while (*code == OP_ALT) code += GET(code, 1);
-      ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);
+      ADD_ACTIVE((int)(code - start_code + 1 + LINK_SIZE), 0);
       break;


       /*-----------------------------------------------------------------*/
       case OP_SKIPZERO:
       code += 1 + GET(code, 2);
       while (*code == OP_ALT) code += GET(code, 1);
-      ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);
+      ADD_ACTIVE((int)(code - start_code + 1 + LINK_SIZE), 0);
       break;


       /*-----------------------------------------------------------------*/
@@ -2359,7 +2359,7 @@
         points to the byte after the end of the class. If there is a
         quantifier, this is where it will be. */


-        next_state_offset = ecode - start_code;
+        next_state_offset = (int)(ecode - start_code);


         switch (*ecode)
           {
@@ -2430,7 +2430,7 @@
           md,                                   /* static match data */
           code,                                 /* this subexpression's code */
           ptr,                                  /* where we currently are */
-          ptr - start_subject,                  /* start offset */
+          (int)(ptr - start_subject),           /* start offset */
           local_offsets,                        /* offset vector */
           sizeof(local_offsets)/sizeof(int),    /* size of same */
           local_workspace,                      /* workspace vector */
@@ -2441,7 +2441,7 @@


         if (rc == PCRE_ERROR_DFA_UITEM) return rc;
         if ((rc >= 0) == (codevalue == OP_ASSERT || codevalue == OP_ASSERTBACK))
-            { ADD_ACTIVE(endasscode + LINK_SIZE + 1 - start_code, 0); }
+            { ADD_ACTIVE((int)(endasscode + LINK_SIZE + 1 - start_code), 0); }
         }
       break;


@@ -2468,9 +2468,9 @@
             cb.callout_number   = code[LINK_SIZE+2];
             cb.offset_vector    = offsets;
             cb.subject          = (PCRE_SPTR)start_subject;
-            cb.subject_length   = end_subject - start_subject;
-            cb.start_match      = current_subject - start_subject;
-            cb.current_position = ptr - start_subject;
+            cb.subject_length   = (int)(end_subject - start_subject);
+            cb.start_match      = (int)(current_subject - start_subject);
+            cb.current_position = (int)(ptr - start_subject);
             cb.pattern_position = GET(code, LINK_SIZE + 3);
             cb.next_item_length = GET(code, 3 + 2*LINK_SIZE);
             cb.capture_top      = 1;
@@ -2521,7 +2521,7 @@
             md,                                   /* fixed match data */
             asscode,                              /* this subexpression's code */
             ptr,                                  /* where we currently are */
-            ptr - start_subject,                  /* start offset */
+            (int)(ptr - start_subject),           /* start offset */
             local_offsets,                        /* offset vector */
             sizeof(local_offsets)/sizeof(int),    /* size of same */
             local_workspace,                      /* workspace vector */
@@ -2533,7 +2533,7 @@
           if (rc == PCRE_ERROR_DFA_UITEM) return rc;
           if ((rc >= 0) ==
                 (condcode == OP_ASSERT || condcode == OP_ASSERTBACK))
-            { ADD_ACTIVE(endasscode + LINK_SIZE + 1 - start_code, 0); }
+            { ADD_ACTIVE((int)(endasscode + LINK_SIZE + 1 - start_code), 0); }
           else
             { ADD_ACTIVE(state_offset + codelink + LINK_SIZE + 1, 0); }
           }
@@ -2554,7 +2554,7 @@
           md,                                   /* fixed match data */
           start_code + GET(code, 1),            /* this subexpression's code */
           ptr,                                  /* where we currently are */
-          ptr - start_subject,                  /* start offset */
+          (int)(ptr - start_subject),           /* start offset */
           local_offsets,                        /* offset vector */
           sizeof(local_offsets)/sizeof(int),    /* size of same */
           local_workspace,                      /* workspace vector */
@@ -2606,7 +2606,7 @@
           md,                                   /* fixed match data */
           code,                                 /* this subexpression's code */
           ptr,                                  /* where we currently are */
-          ptr - start_subject,                  /* start offset */
+          (int)(ptr - start_subject),           /* start offset */
           local_offsets,                        /* offset vector */
           sizeof(local_offsets)/sizeof(int),    /* size of same */
           local_workspace,                      /* workspace vector */
@@ -2623,7 +2623,8 @@


           do { end_subpattern += GET(end_subpattern, 1); }
             while (*end_subpattern == OP_ALT);
-          next_state_offset = end_subpattern - start_code + LINK_SIZE + 1;
+          next_state_offset = 
+            (int)(end_subpattern - start_code + LINK_SIZE + 1);


           /* If the end of this subpattern is KETRMAX or KETRMIN, we must
           arrange for the repeat state also to be added to the relevant list.
@@ -2631,7 +2632,7 @@


           repeat_state_offset = (*end_subpattern == OP_KETRMAX ||
                                  *end_subpattern == OP_KETRMIN)?
-            end_subpattern - start_code - GET(end_subpattern, 1) : -1;
+            (int)(end_subpattern - start_code - GET(end_subpattern, 1)) : -1;


           /* If we have matched an empty string, add the next state at the
           current character pointer. This is important so that the duplicate
@@ -2695,9 +2696,9 @@
         cb.callout_number   = code[1];
         cb.offset_vector    = offsets;
         cb.subject          = (PCRE_SPTR)start_subject;
-        cb.subject_length   = end_subject - start_subject;
-        cb.start_match      = current_subject - start_subject;
-        cb.current_position = ptr - start_subject;
+        cb.subject_length   = (int)(end_subject - start_subject);
+        cb.start_match      = (int)(current_subject - start_subject);
+        cb.current_position = (int)(ptr - start_subject);
         cb.pattern_position = GET(code, 2);
         cb.next_item_length = GET(code, 2 + LINK_SIZE);
         cb.capture_top      = 1;
@@ -2748,8 +2749,8 @@
       {
       if (offsetcount >= 2)
         {
-        offsets[0] = md->start_used_ptr - start_subject;
-        offsets[1] = end_subject - start_subject;
+        offsets[0] = (int)(md->start_used_ptr - start_subject);
+        offsets[1] = (int)(end_subject - start_subject);
         }
       match_count = PCRE_ERROR_PARTIAL;
       }


Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2010-05-31 17:28:08 UTC (rev 529)
+++ code/trunk/pcre_exec.c    2010-06-01 13:42:06 UTC (rev 530)
@@ -794,7 +794,8 @@
       save_capture_last = md->capture_last;


       DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
-      md->offset_vector[md->offset_end - number] = eptr - md->start_subject;
+      md->offset_vector[md->offset_end - number] = 
+        (int)(eptr - md->start_subject);


       flags = (op == OP_SCBRA)? match_cbegroup : 0;
       do
@@ -889,9 +890,9 @@
         cb.callout_number   = ecode[LINK_SIZE+2];
         cb.offset_vector    = md->offset_vector;
         cb.subject          = (PCRE_SPTR)md->start_subject;
-        cb.subject_length   = md->end_subject - md->start_subject;
-        cb.start_match      = mstart - md->start_subject;
-        cb.current_position = eptr - md->start_subject;
+        cb.subject_length   = (int)(md->end_subject - md->start_subject);
+        cb.start_match      = (int)(mstart - md->start_subject);
+        cb.current_position = (int)(eptr - md->start_subject);
         cb.pattern_position = GET(ecode, LINK_SIZE + 3);
         cb.next_item_length = GET(ecode, 3 + 2*LINK_SIZE);
         cb.capture_top      = offset_top/2;
@@ -1117,7 +1118,7 @@
       {
       md->offset_vector[offset] =
         md->offset_vector[md->offset_end - number];
-      md->offset_vector[offset+1] = eptr - md->start_subject;
+      md->offset_vector[offset+1] = (int)(eptr - md->start_subject);
       if (offset_top <= offset) offset_top = offset + 2;
       }
     ecode += 3;
@@ -1280,9 +1281,9 @@
       cb.callout_number   = ecode[1];
       cb.offset_vector    = md->offset_vector;
       cb.subject          = (PCRE_SPTR)md->start_subject;
-      cb.subject_length   = md->end_subject - md->start_subject;
-      cb.start_match      = mstart - md->start_subject;
-      cb.current_position = eptr - md->start_subject;
+      cb.subject_length   = (int)(md->end_subject - md->start_subject);
+      cb.start_match      = (int)(mstart - md->start_subject);
+      cb.current_position = (int)(eptr - md->start_subject);
       cb.pattern_position = GET(ecode, 2);
       cb.next_item_length = GET(ecode, 2 + LINK_SIZE);
       cb.capture_top      = offset_top/2;
@@ -1559,7 +1560,7 @@
         {
         md->offset_vector[offset] =
           md->offset_vector[md->offset_end - number];
-        md->offset_vector[offset+1] = eptr - md->start_subject;
+        md->offset_vector[offset+1] = (int)(eptr - md->start_subject);
         if (offset_top <= offset) offset_top = offset + 2;
         }


@@ -2233,7 +2234,7 @@
       referenced subpattern. */


       if (offset >= offset_top || md->offset_vector[offset] < 0)
-        length = (md->jscript_compat)? 0 : md->end_subject - eptr + 1;
+        length = (md->jscript_compat)? 0 : (int)(md->end_subject - eptr + 1);
       else
         length = md->offset_vector[offset+1] - md->offset_vector[offset];


@@ -6176,8 +6177,8 @@

   if (offsetcount < 2) rc = 0; else
     {
-    offsets[0] = md->start_match_ptr - md->start_subject;
-    offsets[1] = md->end_match_ptr - md->start_subject;
+    offsets[0] = (int)(md->start_match_ptr - md->start_subject);
+    offsets[1] = (int)(md->end_match_ptr - md->start_subject);
     }


   DPRINTF((">>>> returning %d\n", rc));
@@ -6209,8 +6210,8 @@
   md->mark = NULL;
   if (offsetcount > 1)
     {
-    offsets[0] = start_partial - (USPTR)subject;
-    offsets[1] = end_subject - (USPTR)subject;
+    offsets[0] = (int)(start_partial - (USPTR)subject);
+    offsets[1] = (int)(end_subject - (USPTR)subject);
     }
   rc = PCRE_ERROR_PARTIAL;
   }


Modified: code/trunk/pcre_scanner.cc
===================================================================
--- code/trunk/pcre_scanner.cc    2010-05-31 17:28:08 UTC (rev 529)
+++ code/trunk/pcre_scanner.cc    2010-06-01 13:42:06 UTC (rev 530)
@@ -121,7 +121,7 @@
 }


int Scanner::Offset() const {
- return input_.data() - data_.c_str();
+ return (int)(input_.data() - data_.c_str());
}

 bool Scanner::LookingAt(const RE& re) const {
@@ -153,7 +153,7 @@
       comments_ = new vector<StringPiece>;
     }
     // already pointing one past end, so no need to +1
-    int length = input_.data() - start_data;
+    int length = (int)(input_.data() - start_data);
     if (length > 0) {
       comments_->push_back(StringPiece(start_data, length));
     }


Modified: code/trunk/pcre_scanner_unittest.cc
===================================================================
--- code/trunk/pcre_scanner_unittest.cc    2010-05-31 17:28:08 UTC (rev 529)
+++ code/trunk/pcre_scanner_unittest.cc    2010-06-01 13:42:06 UTC (rev 530)
@@ -106,11 +106,11 @@
   CHECK_EQ(comments[2].as_string(), " /* and here is gamma */\n");
   comments.resize(0);


- s.GetComments(0, strchr(input, '/') - input, &comments);
+ s.GetComments(0, (int)(strchr(input, '/') - input), &comments);
CHECK_EQ(comments.size(), 0);
comments.resize(0);

-  s.GetComments(strchr(input, '/') - input - 1, sizeof(input),
+  s.GetComments((int)(strchr(input, '/') - input - 1), sizeof(input),
                 &comments);
   CHECK_EQ(comments.size(), 3);
   CHECK_EQ(comments[0].as_string(), " // this sets alpha\n");
@@ -118,8 +118,8 @@
   CHECK_EQ(comments[2].as_string(), " /* and here is gamma */\n");
   comments.resize(0);


-  s.GetComments(strchr(input, '/') - input - 1,
-                strchr(input + 1, '\n') - input + 1, &comments);
+  s.GetComments((int)(strchr(input, '/') - input - 1),
+                (int)(strchr(input + 1, '\n') - input + 1), &comments);
   CHECK_EQ(comments.size(), 1);
   CHECK_EQ(comments[0].as_string(), " // this sets alpha\n");
   comments.resize(0);


Modified: code/trunk/pcrecpp.cc
===================================================================
--- code/trunk/pcrecpp.cc    2010-05-31 17:28:08 UTC (rev 529)
+++ code/trunk/pcrecpp.cc    2010-06-01 13:42:06 UTC (rev 530)
@@ -605,7 +605,7 @@
                                        // (as for kVecSize)
   int space[21];   // use stack allocation for small vecsize (common case)
   int* vec = vecsize <= 21 ? space : new int[vecsize];
-  bool retval = DoMatchImpl(text, anchor, consumed, args, n, vec, vecsize);
+  bool retval = DoMatchImpl(text, anchor, consumed, args, n, vec, (int)vecsize);
   if (vec != space) delete [] vec;
   return retval;
 }


Modified: code/trunk/pcregrep.c
===================================================================
--- code/trunk/pcregrep.c    2010-05-31 17:28:08 UTC (rev 529)
+++ code/trunk/pcregrep.c    2010-06-01 13:42:06 UTC (rev 530)
@@ -909,7 +909,7 @@
 int i;
 for (i = 0; i < pattern_count; i++)
   {
-  *mrc = pcre_exec(pattern_list[i], hints_list[i], matchptr, length, 0,
+  *mrc = pcre_exec(pattern_list[i], hints_list[i], matchptr, (int)length, 0,
     PCRE_NOTEMPTY, offsets, OFFSET_SIZE);
   if (*mrc >= 0) return TRUE;
   if (*mrc == PCRE_ERROR_NOMATCH) continue;
@@ -1365,7 +1365,7 @@
   offset to the current line is maintained in filepos. */


ptr += linelength + endlinelength;
- filepos += linelength + endlinelength;
+ filepos += (int)(linelength + endlinelength);
linenumber++;

   /* If input is line buffered, and the buffer is not yet full, read another 
@@ -1531,7 +1531,7 @@
       {
       int frc, nflen;
       sprintf(buffer, "%.512s%c%.128s", pathname, sep, nextfile);
-      nflen = strlen(nextfile);
+      nflen = (int)(strlen(nextfile));


       if (isdirectory(buffer))
         {
@@ -1575,7 +1575,7 @@
 argument at top level, we don't show the file name, unless we are only showing
 the file name, or the filename was forced (-H). */


-pathlen = strlen(pathname);
+pathlen = (int)(strlen(pathname));

/* Open using zlib if it is supported and the file name ends with .gz. */

@@ -2028,8 +2028,9 @@
           }
         else                 /* Special case xxx=data */
           {
-          int oplen = equals - op->long_name;
-          int arglen = (argequals == NULL)? (int)strlen(arg) : argequals - arg;
+          int oplen = (int)(equals - op->long_name);
+          int arglen = (argequals == NULL)? 
+            (int)strlen(arg) : (int)(argequals - arg);
           if (oplen == arglen && strncmp(arg, op->long_name, oplen) == 0)
             {
             option_data = arg + arglen;
@@ -2050,10 +2051,10 @@
         char buff1[24];
         char buff2[24];


-        int baselen = opbra - op->long_name;
-        int fulllen = strchr(op->long_name, ')') - op->long_name + 1;
+        int baselen = (int)(opbra - op->long_name);
+        int fulllen = (int)(strchr(op->long_name, ')') - op->long_name + 1);
         int arglen = (argequals == NULL || equals == NULL)?
-          (int)strlen(arg) : argequals - arg;
+          (int)strlen(arg) : (int)(argequals - arg);


         sprintf(buff1, "%.*s", baselen, op->long_name);
         sprintf(buff2, "%s%.*s", buff1, fulllen - baselen - 2, opbra + 1);
@@ -2205,7 +2206,7 @@
         {
         char *equals = strchr(op->long_name, '=');
         int nlen = (equals == NULL)? (int)strlen(op->long_name) :
-          equals - op->long_name;
+          (int)(equals - op->long_name);
         fprintf(stderr, "pcregrep: Malformed number \"%s\" after --%.*s\n",
           option_data, nlen, op->long_name);
         }


Modified: code/trunk/pcreposix.c
===================================================================
--- code/trunk/pcreposix.c    2010-05-31 17:28:08 UTC (rev 529)
+++ code/trunk/pcreposix.c    2010-06-01 13:42:06 UTC (rev 530)
@@ -338,13 +338,13 @@
 else
   {
   so = 0;
-  eo = strlen(string);
+  eo = (int)strlen(string);
   }


rc = pcre_exec((const pcre *)preg->re_pcre, NULL, string + so, (eo - so),
- 0, options, ovector, nmatch * 3);
+ 0, options, ovector, (int)(nmatch * 3));

-if (rc == 0) rc = nmatch;    /* All captured slots were filled in */
+if (rc == 0) rc = (int)nmatch;    /* All captured slots were filled in */


/* Successful match */


Modified: code/trunk/pcretest.c
===================================================================
--- code/trunk/pcretest.c    2010-05-31 17:28:08 UTC (rev 529)
+++ code/trunk/pcretest.c    2010-06-01 13:42:06 UTC (rev 530)
@@ -221,7 +221,7 @@


for (;;)
{
- int rlen = buffer_size - (here - buffer);
+ int rlen = (int)(buffer_size - (here - buffer));

   if (rlen > 1000)
     {
@@ -1163,7 +1163,7 @@
     }


pp = p;
- poffset = p - buffer;
+ poffset = (int)(p - buffer);

   for(;;)
     {
@@ -2080,7 +2080,7 @@
       *q++ = c;
       }
     *q = 0;
-    len = q - dbuffer;
+    len = (int)(q - dbuffer);


     /* Move the data to the end of the buffer so that a read over the end of
     the buffer will be seen by valgrind, even if it doesn't cause a crash. If