diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-12-28 16:10:09 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-12-28 16:10:09 +0000 |
commit | a29cc4dc66d82b59de7616c53517c58271e6e0e8 (patch) | |
tree | c74caa3f756e12f475c840392d507a89bcfe8bc8 /pcre_valid_utf8.c | |
parent | 77b62a421481e0547788d4c0dc7539ac7f41d85b (diff) | |
download | pcre-a29cc4dc66d82b59de7616c53517c58271e6e0e8.tar.gz |
Rolled back trunk to r755 to prepare for merging the 16-bit branch.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@835 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_valid_utf8.c')
-rw-r--r-- | pcre_valid_utf8.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/pcre_valid_utf8.c b/pcre_valid_utf8.c index b94bcc9..fef6538 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 = (int)(p - string); + length = 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 = (int)(p - string); + *erroroffset = p - string; return PCRE_UTF8_ERR20; } if (c >= 0xfe) /* Invalid 0xfe or 0xff bytes */ { - *erroroffset = (int)(p - string); + *erroroffset = p - string; return PCRE_UTF8_ERR21; } ab = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */ if (length < ab) { - *erroroffset = (int)(p - string); /* Missing bytes */ + *erroroffset = 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 = (int)(p - string) - 1; + *erroroffset = p - string - 1; return PCRE_UTF8_ERR6; } @@ -160,7 +160,7 @@ for (p = string; length-- > 0; p++) case 1: if ((c & 0x3e) == 0) { - *erroroffset = (int)(p - string) - 1; + *erroroffset = 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 = (int)(p - string) - 2; + *erroroffset = p - string - 2; return PCRE_UTF8_ERR7; } if (c == 0xe0 && (d & 0x20) == 0) { - *erroroffset = (int)(p - string) - 2; + *erroroffset = p - string - 2; return PCRE_UTF8_ERR16; } if (c == 0xed && d >= 0xa0) { - *erroroffset = (int)(p - string) - 2; + *erroroffset = 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 = (int)(p - string) - 2; + *erroroffset = p - string - 2; return PCRE_UTF8_ERR7; } if ((*(++p) & 0xc0) != 0x80) /* Fourth byte */ { - *erroroffset = (int)(p - string) - 3; + *erroroffset = p - string - 3; return PCRE_UTF8_ERR8; } if (c == 0xf0 && (d & 0x30) == 0) { - *erroroffset = (int)(p - string) - 3; + *erroroffset = p - string - 3; return PCRE_UTF8_ERR17; } if (c > 0xf4 || (c == 0xf4 && d > 0x8f)) { - *erroroffset = (int)(p - string) - 3; + *erroroffset = 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 = (int)(p - string) - 2; + *erroroffset = p - string - 2; return PCRE_UTF8_ERR7; } if ((*(++p) & 0xc0) != 0x80) /* Fourth byte */ { - *erroroffset = (int)(p - string) - 3; + *erroroffset = p - string - 3; return PCRE_UTF8_ERR8; } if ((*(++p) & 0xc0) != 0x80) /* Fifth byte */ { - *erroroffset = (int)(p - string) - 4; + *erroroffset = p - string - 4; return PCRE_UTF8_ERR9; } if (c == 0xf8 && (d & 0x38) == 0) { - *erroroffset = (int)(p - string) - 4; + *erroroffset = 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 = (int)(p - string) - 2; + *erroroffset = p - string - 2; return PCRE_UTF8_ERR7; } if ((*(++p) & 0xc0) != 0x80) /* Fourth byte */ { - *erroroffset = (int)(p - string) - 3; + *erroroffset = p - string - 3; return PCRE_UTF8_ERR8; } if ((*(++p) & 0xc0) != 0x80) /* Fifth byte */ { - *erroroffset = (int)(p - string) - 4; + *erroroffset = p - string - 4; return PCRE_UTF8_ERR9; } if ((*(++p) & 0xc0) != 0x80) /* Sixth byte */ { - *erroroffset = (int)(p - string) - 5; + *erroroffset = p - string - 5; return PCRE_UTF8_ERR10; } if (c == 0xfc && (d & 0x3c) == 0) { - *erroroffset = (int)(p - string) - 5; + *erroroffset = p - string - 5; return PCRE_UTF8_ERR19; } break; @@ -283,7 +283,7 @@ for (p = string; length-- > 0; p++) if (ab > 3) { - *erroroffset = (int)(p - string) - ab; + *erroroffset = p - string - ab; return (ab == 4)? PCRE_UTF8_ERR11 : PCRE_UTF8_ERR12; } } |