diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-12-02 10:39:32 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-12-02 10:39:32 +0000 |
commit | 3d39f0a5f16085686668180e80e3008cb3fe878f (patch) | |
tree | e03c5e39d9eada6a903f7bd4cdc29febd66a6ec0 | |
parent | 6b343554a0bc93c892c11365221c7094aaa4f5ff (diff) | |
download | pcre-3d39f0a5f16085686668180e80e3008cb3fe878f.tar.gz |
Added (int) casts to reduce 64-bit warnings.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@779 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | pcre_compile.c | 6 | ||||
-rw-r--r-- | pcre_dfa_exec.c | 2 | ||||
-rw-r--r-- | pcre_exec.c | 6 | ||||
-rw-r--r-- | pcre_valid_utf8.c | 46 | ||||
-rw-r--r-- | pcregrep.c | 4 |
6 files changed, 35 insertions, 32 deletions
@@ -93,6 +93,9 @@ Version 8.21 22. A caseless match of a UTF-8 character whose other case uses fewer bytes did not work when the shorter character appeared right at the end of the subject string. + +23. Added some (int) casts to non-JIT modules to reduce warnings on 64-bit + systems. Version 8.20 21-Oct-2011 diff --git a/pcre_compile.c b/pcre_compile.c index 6641121..f3d8dd5 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -3683,7 +3683,7 @@ for (;; ptr++) if (lengthptr != NULL) { - *lengthptr += class_utf8data - class_utf8data_base; + *lengthptr += (int)(class_utf8data - class_utf8data_base); class_utf8data = class_utf8data_base; } @@ -4382,7 +4382,7 @@ for (;; ptr++) /* Now fill in the complete length of the item */ - PUT(previous, 1, code - previous); + PUT(previous, 1, (int)(code - previous)); break; /* End of class handling */ } #endif @@ -4524,7 +4524,7 @@ for (;; ptr++) { uschar *lastchar = code - 1; while((*lastchar & 0xc0) == 0x80) lastchar--; - c = code - lastchar; /* Length of UTF-8 character */ + c = (int)(code - lastchar); /* Length of UTF-8 character */ memcpy(utf8_char, lastchar, c); /* Save the char */ c |= 0x80; /* Flag c as a length */ } diff --git a/pcre_dfa_exec.c b/pcre_dfa_exec.c index 047c82d..1ffbe3b 100644 --- a/pcre_dfa_exec.c +++ b/pcre_dfa_exec.c @@ -2781,7 +2781,7 @@ for (;;) { const uschar *p = ptr; const uschar *pp = local_ptr; - charcount = pp - p; + charcount = (int)(pp - p); while (p < pp) if ((*p++ & 0xc0) == 0x80) charcount--; ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1)); } diff --git a/pcre_exec.c b/pcre_exec.c index 2dd8a55..5a52192 100644 --- a/pcre_exec.c +++ b/pcre_exec.c @@ -217,7 +217,7 @@ else while (length-- > 0) if (*p++ != *eptr++) return -1; } -return eptr - eptr_start; +return (int)(eptr - eptr_start); } @@ -1070,7 +1070,7 @@ for (;;) if (offset < md->offset_max) { matched_once = FALSE; - code_offset = ecode - md->start_code; + code_offset = (int)(ecode - md->start_code); save_offset1 = md->offset_vector[offset]; save_offset2 = md->offset_vector[offset+1]; @@ -1160,7 +1160,7 @@ for (;;) POSSESSIVE_NON_CAPTURE: matched_once = FALSE; - code_offset = ecode - md->start_code; + code_offset = (int)(ecode - md->start_code); for (;;) { diff --git a/pcre_valid_utf8.c b/pcre_valid_utf8.c index fef6538..b94bcc9 100644 --- a/pcre_valid_utf8.c +++ b/pcre_valid_utf8.c @@ -111,7 +111,7 @@ register USPTR p; if (length < 0) { for (p = string; *p != 0; p++); - length = p - string; + length = (int)(p - string); } for (p = string; length-- > 0; p++) @@ -123,20 +123,20 @@ for (p = string; length-- > 0; p++) if (c < 0xc0) /* Isolated 10xx xxxx byte */ { - *erroroffset = p - string; + *erroroffset = (int)(p - string); return PCRE_UTF8_ERR20; } if (c >= 0xfe) /* Invalid 0xfe or 0xff bytes */ { - *erroroffset = p - string; + *erroroffset = (int)(p - string); return PCRE_UTF8_ERR21; } ab = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */ if (length < ab) { - *erroroffset = p - string; /* Missing bytes */ + *erroroffset = (int)(p - string); /* Missing bytes */ return ab - length; /* Codes ERR1 to ERR5 */ } length -= ab; /* Length remaining */ @@ -145,7 +145,7 @@ for (p = string; length-- > 0; p++) if (((d = *(++p)) & 0xc0) != 0x80) { - *erroroffset = p - string - 1; + *erroroffset = (int)(p - string) - 1; return PCRE_UTF8_ERR6; } @@ -160,7 +160,7 @@ for (p = string; length-- > 0; p++) case 1: if ((c & 0x3e) == 0) { - *erroroffset = p - string - 1; + *erroroffset = (int)(p - string) - 1; return PCRE_UTF8_ERR15; } break; @@ -172,17 +172,17 @@ for (p = string; length-- > 0; p++) case 2: if ((*(++p) & 0xc0) != 0x80) /* Third byte */ { - *erroroffset = p - string - 2; + *erroroffset = (int)(p - string) - 2; return PCRE_UTF8_ERR7; } if (c == 0xe0 && (d & 0x20) == 0) { - *erroroffset = p - string - 2; + *erroroffset = (int)(p - string) - 2; return PCRE_UTF8_ERR16; } if (c == 0xed && d >= 0xa0) { - *erroroffset = p - string - 2; + *erroroffset = (int)(p - string) - 2; return PCRE_UTF8_ERR14; } break; @@ -194,22 +194,22 @@ for (p = string; length-- > 0; p++) case 3: if ((*(++p) & 0xc0) != 0x80) /* Third byte */ { - *erroroffset = p - string - 2; + *erroroffset = (int)(p - string) - 2; return PCRE_UTF8_ERR7; } if ((*(++p) & 0xc0) != 0x80) /* Fourth byte */ { - *erroroffset = p - string - 3; + *erroroffset = (int)(p - string) - 3; return PCRE_UTF8_ERR8; } if (c == 0xf0 && (d & 0x30) == 0) { - *erroroffset = p - string - 3; + *erroroffset = (int)(p - string) - 3; return PCRE_UTF8_ERR17; } if (c > 0xf4 || (c == 0xf4 && d > 0x8f)) { - *erroroffset = p - string - 3; + *erroroffset = (int)(p - string) - 3; return PCRE_UTF8_ERR13; } break; @@ -225,22 +225,22 @@ for (p = string; length-- > 0; p++) case 4: if ((*(++p) & 0xc0) != 0x80) /* Third byte */ { - *erroroffset = p - string - 2; + *erroroffset = (int)(p - string) - 2; return PCRE_UTF8_ERR7; } if ((*(++p) & 0xc0) != 0x80) /* Fourth byte */ { - *erroroffset = p - string - 3; + *erroroffset = (int)(p - string) - 3; return PCRE_UTF8_ERR8; } if ((*(++p) & 0xc0) != 0x80) /* Fifth byte */ { - *erroroffset = p - string - 4; + *erroroffset = (int)(p - string) - 4; return PCRE_UTF8_ERR9; } if (c == 0xf8 && (d & 0x38) == 0) { - *erroroffset = p - string - 4; + *erroroffset = (int)(p - string) - 4; return PCRE_UTF8_ERR18; } break; @@ -251,27 +251,27 @@ for (p = string; length-- > 0; p++) case 5: if ((*(++p) & 0xc0) != 0x80) /* Third byte */ { - *erroroffset = p - string - 2; + *erroroffset = (int)(p - string) - 2; return PCRE_UTF8_ERR7; } if ((*(++p) & 0xc0) != 0x80) /* Fourth byte */ { - *erroroffset = p - string - 3; + *erroroffset = (int)(p - string) - 3; return PCRE_UTF8_ERR8; } if ((*(++p) & 0xc0) != 0x80) /* Fifth byte */ { - *erroroffset = p - string - 4; + *erroroffset = (int)(p - string) - 4; return PCRE_UTF8_ERR9; } if ((*(++p) & 0xc0) != 0x80) /* Sixth byte */ { - *erroroffset = p - string - 5; + *erroroffset = (int)(p - string) - 5; return PCRE_UTF8_ERR10; } if (c == 0xfc && (d & 0x3c) == 0) { - *erroroffset = p - string - 5; + *erroroffset = (int)(p - string) - 5; return PCRE_UTF8_ERR19; } break; @@ -283,7 +283,7 @@ for (p = string; length-- > 0; p++) if (ab > 3) { - *erroroffset = p - string - ab; + *erroroffset = (int)(p - string) - ab; return (ab == 4)? PCRE_UTF8_ERR11 : PCRE_UTF8_ERR12; } } @@ -1410,7 +1410,7 @@ while (ptr < endptr) and its line-ending characters (if they matched the pattern), so there may be no more to print. */ - plength = (linelength + endlinelength) - startoffset; + plength = (int)((linelength + endlinelength) - startoffset); if (plength > 0) FWRITE(ptr + startoffset, 1, plength, stdout); } @@ -1462,7 +1462,7 @@ while (ptr < endptr) if (input_line_buffered && bufflength < (size_t)bufsize) { - int add = read_one_line(ptr, bufsize - (ptr - main_buffer), in); + int add = read_one_line(ptr, bufsize - (int)(ptr - main_buffer), in); bufflength += add; endptr += add; } |