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

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

Issue 6823057: Cleanup SQLite 3.6.18 import. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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/preprocessed/sqlite3.h ('k') | third_party/sqlite/sqlite-poison.patch » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 This patch removes the usage of tolower() in fts code, which is not locale 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. 2 neutral and causes problem in some locales such as Turkish.
3 See http://crbug.com/15261 for details. 3 See http://crbug.com/15261 for details.
4 An upstream ticket was also created for this issue: 4 An upstream ticket was also created for this issue:
5 http://www.sqlite.org/src/tktview/991789d9f3136a0460dc83a33e815c1aa9757c26 5 http://www.sqlite.org/src/tktview/991789d9f3136a0460dc83a33e815c1aa9757c26
6 6
7 Contains backport for upstream http://www.sqlite.org/src/ci/b8b465ed2c. 7 Contains backport for upstream http://www.sqlite.org/src/ci/b8b465ed2c.
8 8
9 Index: ext/fts3/fts3.c 9 Index: ext/fts3/fts3.c
10 =================================================================== 10 ===================================================================
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 @@ -191,7 +193,7 @@ static int simpleNext( 86 @@ -191,7 +193,7 @@ static int simpleNext(
87 ** case-insensitivity. 87 ** case-insensitivity.
88 */ 88 */
89 unsigned char ch = p[iStartOffset+i]; 89 unsigned char ch = p[iStartOffset+i];
90 - c->pToken[i] = ch<0x80 ? tolower(ch) : ch; 90 - c->pToken[i] = ch<0x80 ? tolower(ch) : ch;
91 + c->pToken[i] = (ch>='A' && ch<='Z') ? ch-'A'+'a' : ch; 91 + c->pToken[i] = (ch>='A' && ch<='Z') ? ch-'A'+'a' : ch;
92 } 92 }
93 *ppToken = c->pToken; 93 *ppToken = c->pToken;
94 *pnBytes = n; 94 *pnBytes = n;
95 Index: ext/fts1/simple_tokenizer.c
96 ===================================================================
97 --- ext/fts1/simple_tokenizer.c 2009-09-03 13:32:06.000000000 -0700
98 +++ ext/fts1/simple_tokenizer.c 2009-09-02 11:40:21.000000000 -0700
99 @@ -138,7 +138,7 @@
100 ** case-insensitivity.
101 */
102 char ch = c->pCurrent[ii];
103 - c->zToken[ii] = (unsigned char)ch<0x80 ? tolower(ch) : ch;
104 + c->zToken[ii] = ((ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch);
105 }
106 c->zToken[n] = '\0';
107 *ppToken = c->zToken;
108 Index: ext/fts1/fts1_tokenizer1.c
109 ===================================================================
110 --- ext/fts1/fts1_tokenizer1.c 2009-09-03 13:32:06.000000000 -0700
111 +++ ext/fts1/fts1_tokenizer1.c 2009-09-02 11:40:21.000000000 -0700
112 @@ -182,7 +182,7 @@
113 ** case-insensitivity.
114 */
115 unsigned char ch = p[iStartOffset+i];
116 - c->pToken[i] = ch<0x80 ? tolower(ch) : ch;
117 + c->pToken[i] = (ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch;
118 }
119 *ppToken = c->pToken;
120 *pnBytes = n;
121 Index: ext/fts1/fts1.c
122 ===================================================================
123 --- ext/fts1/fts1.c 2009-09-04 13:37:41.000000000 -0700
124 +++ ext/fts1/fts1.c 2009-09-14 18:16:55.000000000 -0700
125 @@ -208,7 +208,7 @@
126 return (c&0x80)==0 ? isspace(c) : 0;
127 }
128 static int safe_tolower(char c){
129 - return (c&0x80)==0 ? tolower(c) : c;
130 + return (c>='A' && c<='Z') ? (c-'A'+'a') : c;
131 }
132 static int safe_isalnum(char c){
133 return (c&0x80)==0 ? isalnum(c) : 0;
134 Index: ext/fts2/fts2.c 95 Index: ext/fts2/fts2.c
135 =================================================================== 96 ===================================================================
136 --- ext/fts2/fts2.c 2009-09-04 13:37:41.000000000 -0700 97 --- ext/fts2/fts2.c 2009-09-04 13:37:41.000000000 -0700
137 +++ ext/fts2/fts2.c 2009-09-14 18:17:02.000000000 -0700 98 +++ ext/fts2/fts2.c 2009-09-14 18:17:02.000000000 -0700
138 @@ -372,7 +372,7 @@ 99 @@ -372,7 +372,7 @@
139 return (c&0x80)==0 ? isspace(c) : 0; 100 return (c&0x80)==0 ? isspace(c) : 0;
140 } 101 }
141 static int safe_tolower(char c){ 102 static int safe_tolower(char c){
142 - return (c&0x80)==0 ? tolower(c) : c; 103 - return (c&0x80)==0 ? tolower(c) : c;
143 + return (c>='A' && c<='Z') ? (c-'A'+'a') : c; 104 + return (c>='A' && c<='Z') ? (c-'A'+'a') : c;
144 } 105 }
145 static int safe_isalnum(char c){ 106 static int safe_isalnum(char c){
146 return (c&0x80)==0 ? isalnum(c) : 0; 107 return (c&0x80)==0 ? isalnum(c) : 0;
147 Index: ext/fts2/fts2_tokenizer1.c 108 Index: ext/fts2/fts2_tokenizer1.c
148 =================================================================== 109 ===================================================================
149 --- ext/fts2/fts2_tokenizer1.c 2009-09-03 13:32:06.000000000 -0700 110 --- ext/fts2/fts2_tokenizer1.c 2009-09-03 13:32:06.000000000 -0700
150 +++ ext/fts2/fts2_tokenizer1.c 2009-09-02 11:40:21.000000000 -0700 111 +++ ext/fts2/fts2_tokenizer1.c 2009-09-02 11:40:21.000000000 -0700
151 @@ -191,7 +191,7 @@ 112 @@ -191,7 +191,7 @@
152 ** case-insensitivity. 113 ** case-insensitivity.
153 */ 114 */
154 unsigned char ch = p[iStartOffset+i]; 115 unsigned char ch = p[iStartOffset+i];
155 - c->pToken[i] = ch<0x80 ? tolower(ch) : ch; 116 - c->pToken[i] = ch<0x80 ? tolower(ch) : ch;
156 + c->pToken[i] = (ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch; 117 + c->pToken[i] = (ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch;
157 } 118 }
158 *ppToken = c->pToken; 119 *ppToken = c->pToken;
159 *pnBytes = n; 120 *pnBytes = n;
OLDNEW
« no previous file with comments | « third_party/sqlite/preprocessed/sqlite3.h ('k') | third_party/sqlite/sqlite-poison.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698