Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: third_party/sqlite/patches/0012-Use-safe-macros-for-UTF-8-iteration-in-sqlite-icu-ex.patch

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 From 840d5ead53a23f8e1f54db479f2f5fc27f5821bf Mon Sep 17 00:00:00 2001
2 From: Scott Hess <shess@chromium.org>
3 Date: Mon, 1 Feb 2016 17:07:24 -0800
4 Subject: [PATCH 12/12] Use safe macros for UTF-8 iteration in sqlite icu
5 extension.
6
7 Instead of U8_NEXT_UNSAFE and U8_FWD1_UNSAFE, use
8 U8_NEXT_OR_FFFD (efficient) and U8_FWD1 (slower than UNSAFE version).
9
10 BUG=575205
11 ---
12 third_party/sqlite/src/ext/icu/icu.c | 10 +++++-----
13 1 file changed, 5 insertions(+), 5 deletions(-)
14
15 diff --git a/third_party/sqlite/src/ext/icu/icu.c b/third_party/sqlite/src/ext/i cu/icu.c
16 index a2ff492..7e2b800 100644
17 --- a/third_party/sqlite/src/ext/icu/icu.c
18 +++ b/third_party/sqlite/src/ext/icu/icu.c
19 @@ -82,7 +82,7 @@ static int icuLikeCompare(
20
21 /* Read (and consume) the next character from the input pattern. */
22 UChar32 uPattern;
23 - U8_NEXT_UNSAFE(zPattern, iPattern, uPattern);
24 + U8_NEXT_OR_FFFD(zPattern, iPattern, -1, uPattern);
25
26 /* There are now 4 possibilities:
27 **
28 @@ -102,7 +102,7 @@ static int icuLikeCompare(
29 while( (c=zPattern[iPattern]) == MATCH_ALL || c == MATCH_ONE ){
30 if( c==MATCH_ONE ){
31 if( zString[iString]==0 ) return 0;
32 - U8_FWD_1_UNSAFE(zString, iString);
33 + U8_FWD_1(zString, iString, -1);
34 }
35 iPattern++;
36 }
37 @@ -113,14 +113,14 @@ static int icuLikeCompare(
38 if( icuLikeCompare(&zPattern[iPattern], &zString[iString], uEsc) ){
39 return 1;
40 }
41 - U8_FWD_1_UNSAFE(zString, iString);
42 + U8_FWD_1(zString, iString, -1);
43 }
44 return 0;
45
46 }else if( !prevEscape && uPattern==MATCH_ONE ){
47 /* Case 2. */
48 if( zString[iString]==0 ) return 0;
49 - U8_FWD_1_UNSAFE(zString, iString);
50 + U8_FWD_1(zString, iString, -1);
51
52 }else if( !prevEscape && uPattern==uEsc){
53 /* Case 3. */
54 @@ -129,7 +129,7 @@ static int icuLikeCompare(
55 }else{
56 /* Case 4. */
57 UChar32 uString;
58 - U8_NEXT_UNSAFE(zString, iString, uString);
59 + U8_NEXT_OR_FFFD(zString, iString, -1, uString);
60 uString = u_foldCase(uString, U_FOLD_CASE_DEFAULT);
61 uPattern = u_foldCase(uPattern, U_FOLD_CASE_DEFAULT);
62 if( uString!=uPattern ){
63 --
64 2.7.0
65
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698