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

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

Issue 6990047: Import SQLite 3.7.6.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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
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 Contains backport for upstream http://www.sqlite.org/src/ci/b8b465ed2c.
8
9 Index: ext/fts3/fts3.c
10 ===================================================================
11 --- ext/fts3/fts3.c 2009-09-04 13:37:41.000000000 -0700
12 +++ ext/fts3/fts3.c 2009-09-14 18:17:45.000000000 -0700
13 @@ -326,7 +326,7 @@
14 return (c&0x80)==0 ? isspace(c) : 0;
15 }
16 static int safe_tolower(char c){
17 - return (c&0x80)==0 ? tolower(c) : c;
18 + return (c>='A' && c<='Z') ? (c-'A'+'a') : c;
19 }
20 static int safe_isalnum(char c){
21 return (c&0x80)==0 ? isalnum(c) : 0;
22 Index: ext/fts3/fts3_expr.c
23 ===================================================================
24 --- ext/fts3/fts3_expr.c
25 +++ ext/fts3/fts3_expr.c
26 @@ -58,7 +58,6 @@ int sqlite3_fts3_enable_parentheses = 0;
27
28 #include "fts3_expr.h"
29 #include "sqlite3.h"
30 -#include <ctype.h>
31 #include <string.h>
32 #include <assert.h>
33
34 @@ -84,7 +83,7 @@ struct ParseContext {
35 ** negative values).
36 */
37 static int fts3isspace(char c){
38 - return (c&0x80)==0 ? isspace(c) : 0;
39 + return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f';
40 }
41
42 /*
43 Index: ext/fts3/fts3_porter.c
44 ===================================================================
45 --- ext/fts3/fts3_porter.c
46 +++ ext/fts3/fts3_porter.c
47 @@ -29,7 +29,6 @@
48 #include <stdlib.h>
49 #include <stdio.h>
50 #include <string.h>
51 -#include <ctype.h>
52
53 #include "fts3_tokenizer.h"
54
55 Index: ext/fts3/fts3_tokenizer1.c
56 ===================================================================
57 --- ext/fts3/fts3_tokenizer1.c
58 +++ ext/fts3/fts3_tokenizer1.c
59 @@ -29,7 +29,6 @@
60 #include <stdlib.h>
61 #include <stdio.h>
62 #include <string.h>
63 -#include <ctype.h>
64
65 #include "fts3_tokenizer.h"
66
67 @@ -55,6 +54,9 @@ static const sqlite3_tokenizer_module simpleTokenizerModule;
68 static int simpleDelim(simple_tokenizer *t, unsigned char c){
69 return c<0x80 && t->delim[c];
70 }
71 +static int fts3_isalnum(int x){
72 + return (x>='0' && x<='9') || (x>='A' && x<='Z') || (x>='a' && x<='z');
73 +}
74
75 /*
76 ** Create a new tokenizer instance.
77 @@ -89,7 +91,7 @@ static int simpleCreate(
78 /* Mark non-alphanumeric ASCII characters as delimiters */
79 int i;
80 for(i=1; i<0x80; i++){
81 - t->delim[i] = !isalnum(i);
82 + t->delim[i] = !fts3_isalnum(i);
83 }
84 }
85
86 @@ -191,7 +193,7 @@ static int simpleNext(
87 ** case-insensitivity.
88 */
89 unsigned char ch = p[iStartOffset+i];
90 - c->pToken[i] = ch<0x80 ? tolower(ch) : ch;
91 + c->pToken[i] = (ch>='A' && ch<='Z') ? ch-'A'+'a' : ch;
92 }
93 *ppToken = c->pToken;
94 *pnBytes = n;
95 Index: ext/fts2/fts2.c
96 ===================================================================
97 --- ext/fts2/fts2.c 2009-09-04 13:37:41.000000000 -0700
98 +++ ext/fts2/fts2.c 2009-09-14 18:17:02.000000000 -0700
99 @@ -372,7 +372,7 @@
100 return (c&0x80)==0 ? isspace(c) : 0;
101 }
102 static int safe_tolower(char c){
103 - return (c&0x80)==0 ? tolower(c) : c;
104 + return (c>='A' && c<='Z') ? (c-'A'+'a') : c;
105 }
106 static int safe_isalnum(char c){
107 return (c&0x80)==0 ? isalnum(c) : 0;
108 Index: ext/fts2/fts2_tokenizer1.c
109 ===================================================================
110 --- ext/fts2/fts2_tokenizer1.c 2009-09-03 13:32:06.000000000 -0700
111 +++ ext/fts2/fts2_tokenizer1.c 2009-09-02 11:40:21.000000000 -0700
112 @@ -191,7 +191,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;
OLDNEW
« no previous file with comments | « third_party/sqlite/icu-regexp.patch ('k') | third_party/sqlite/src/Makefile.arm-wince-mingw32ce-gcc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698