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

Side by Side Diff: third_party/sqlite/safe-tolower.patch

Issue 174387: Fix issue 15261: Crash in history::TextDatabase::GetTextMatches... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/ext/fts3/fts3_tokenizer1.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
OLDNEW
(Empty)
1 This patch removes the usage of tolower() in fts code, which is not locale
2 neutral and causes problem in some locales such as Turkish.
3 See http://crbug.com/15261 for details.
4 An upstream ticket was also created for this issue:
5 http://www.sqlite.org/src/tktview/991789d9f3136a0460dc83a33e815c1aa9757c26
6
7 Index: ext/fts3/fts3.c
8 ===================================================================
9 --- ext/fts3/fts3.c (revision 24387)
10 +++ ext/fts3/fts3.c (working copy)
11 @@ -330,7 +330,7 @@
12 return (c&0x80)==0 ? isspace(c) : 0;
13 }
14 static int safe_tolower(char c){
15 - return (c&0x80)==0 ? tolower(c) : c;
16 + return (c>='A' && c<='Z') ? (c-'A'+'a') : c;
17 }
18 static int safe_isalnum(char c){
19 return (c&0x80)==0 ? isalnum(c) : 0;
20 Index: ext/fts3/fts3_tokenizer1.c
21 ===================================================================
22 --- ext/fts3/fts3_tokenizer1.c (revision 24387)
23 +++ ext/fts3/fts3_tokenizer1.c (working copy)
24 @@ -191,7 +191,7 @@
25 ** case-insensitivity.
26 */
27 unsigned char ch = p[iStartOffset+i];
28 - c->pToken[i] = ch<0x80 ? tolower(ch) : ch;
29 + c->pToken[i] = (ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch;
30 }
31 *ppToken = c->pToken;
32 *pnBytes = n;
33 Index: ext/fts1/simple_tokenizer.c
34 ===================================================================
35 --- ext/fts1/simple_tokenizer.c (revision 24387)
36 +++ ext/fts1/simple_tokenizer.c (working copy)
37 @@ -138,7 +138,7 @@
38 ** case-insensitivity.
39 */
40 char ch = c->pCurrent[ii];
41 - c->zToken[ii] = (unsigned char)ch<0x80 ? tolower(ch) : ch;
42 + c->zToken[ii] = ((ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch);
43 }
44 c->zToken[n] = '\0';
45 *ppToken = c->zToken;
46 Index: ext/fts1/fts1_tokenizer1.c
47 ===================================================================
48 --- ext/fts1/fts1_tokenizer1.c (revision 24387)
49 +++ ext/fts1/fts1_tokenizer1.c (working copy)
50 @@ -182,7 +182,7 @@
51 ** case-insensitivity.
52 */
53 unsigned char ch = p[iStartOffset+i];
54 - c->pToken[i] = ch<0x80 ? tolower(ch) : ch;
55 + c->pToken[i] = (ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch;
56 }
57 *ppToken = c->pToken;
58 *pnBytes = n;
59 Index: ext/fts1/fts1.c
60 ===================================================================
61 --- ext/fts1/fts1.c (revision 24387)
62 +++ ext/fts1/fts1.c (working copy)
63 @@ -208,7 +208,7 @@
64 return (c&0x80)==0 ? isspace(c) : 0;
65 }
66 static int safe_tolower(char c){
67 - return (c&0x80)==0 ? tolower(c) : c;
68 + return (c>='A' && c<='Z') ? (c-'A'+'a') : c;
69 }
70 static int safe_isalnum(char c){
71 return (c&0x80)==0 ? isalnum(c) : 0;
72 Index: ext/fts2/fts2.c
73 ===================================================================
74 --- ext/fts2/fts2.c (revision 24387)
75 +++ ext/fts2/fts2.c (working copy)
76 @@ -372,7 +372,7 @@
77 return (c&0x80)==0 ? isspace(c) : 0;
78 }
79 static int safe_tolower(char c){
80 - return (c&0x80)==0 ? tolower(c) : c;
81 + return (c>='A' && c<='Z') ? (c-'A'+'a') : c;
82 }
83 static int safe_isalnum(char c){
84 return (c&0x80)==0 ? isalnum(c) : 0;
85 Index: ext/fts2/fts2_tokenizer1.c
86 ===================================================================
87 --- ext/fts2/fts2_tokenizer1.c (revision 24387)
88 +++ ext/fts2/fts2_tokenizer1.c (working copy)
89 @@ -191,7 +191,7 @@
90 ** case-insensitivity.
91 */
92 unsigned char ch = p[iStartOffset+i];
93 - c->pToken[i] = ch<0x80 ? tolower(ch) : ch;
94 + c->pToken[i] = (ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch;
95 }
96 *ppToken = c->pToken;
97 *pnBytes = n;
OLDNEW
« no previous file with comments | « third_party/sqlite/ext/fts3/fts3_tokenizer1.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698