diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-09 23:43:04 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-09 23:43:04 +0000 |
commit | 5fe6316e730734e9fb2f60f0a8b861f8c1192420 (patch) | |
tree | f06b71f5fe0b046fa48476018cbbc42dfe63e12b /third_party | |
parent | 99178111dddd6c8770cc021870f2bca48b218565 (diff) | |
download | chromium_src-5fe6316e730734e9fb2f60f0a8b861f8c1192420.zip chromium_src-5fe6316e730734e9fb2f60f0a8b861f8c1192420.tar.gz chromium_src-5fe6316e730734e9fb2f60f0a8b861f8c1192420.tar.bz2 |
Backport SQLite http://www.sqlite.org/src/ci/b8b465ed2c
This brings some improvements for ctype's locale-sensitive
handling of some ASCII characters, see http://crbug.com/15261.
TEST=none
BUG=50769
Review URL: http://codereview.chromium.org/2884069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55504 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/sqlite/ext/fts3/fts3_expr.c | 3 | ||||
-rw-r--r-- | third_party/sqlite/ext/fts3/fts3_porter.c | 1 | ||||
-rw-r--r-- | third_party/sqlite/ext/fts3/fts3_tokenizer1.c | 8 | ||||
-rw-r--r-- | third_party/sqlite/safe-tolower.patch | 70 |
4 files changed, 72 insertions, 10 deletions
diff --git a/third_party/sqlite/ext/fts3/fts3_expr.c b/third_party/sqlite/ext/fts3/fts3_expr.c index 49bea2f..bfca3e1 100644 --- a/third_party/sqlite/ext/fts3/fts3_expr.c +++ b/third_party/sqlite/ext/fts3/fts3_expr.c @@ -58,7 +58,6 @@ int sqlite3_fts3_enable_parentheses = 0; #include "fts3_expr.h" #include "sqlite3.h" -#include <ctype.h> #include <string.h> #include <assert.h> @@ -84,7 +83,7 @@ struct ParseContext { ** negative values). */ static int fts3isspace(char c){ - return (c&0x80)==0 ? isspace(c) : 0; + return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f'; } /* diff --git a/third_party/sqlite/ext/fts3/fts3_porter.c b/third_party/sqlite/ext/fts3/fts3_porter.c index 6ff67a9..001060c 100644 --- a/third_party/sqlite/ext/fts3/fts3_porter.c +++ b/third_party/sqlite/ext/fts3/fts3_porter.c @@ -29,7 +29,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <ctype.h> #include "fts3_tokenizer.h" diff --git a/third_party/sqlite/ext/fts3/fts3_tokenizer1.c b/third_party/sqlite/ext/fts3/fts3_tokenizer1.c index 1df3910..bbc5696 100644 --- a/third_party/sqlite/ext/fts3/fts3_tokenizer1.c +++ b/third_party/sqlite/ext/fts3/fts3_tokenizer1.c @@ -29,7 +29,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <ctype.h> #include "fts3_tokenizer.h" @@ -55,6 +54,9 @@ static const sqlite3_tokenizer_module simpleTokenizerModule; static int simpleDelim(simple_tokenizer *t, unsigned char c){ return c<0x80 && t->delim[c]; } +static int fts3_isalnum(int x){ + return (x>='0' && x<='9') || (x>='A' && x<='Z') || (x>='a' && x<='z'); +} /* ** Create a new tokenizer instance. @@ -89,7 +91,7 @@ static int simpleCreate( /* Mark non-alphanumeric ASCII characters as delimiters */ int i; for(i=1; i<0x80; i++){ - t->delim[i] = !isalnum(i); + t->delim[i] = !fts3_isalnum(i); } } @@ -191,7 +193,7 @@ static int simpleNext( ** case-insensitivity. */ unsigned char ch = p[iStartOffset+i]; - c->pToken[i] = (ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch; + c->pToken[i] = (ch>='A' && ch<='Z') ? ch-'A'+'a' : ch; } *ppToken = c->pToken; *pnBytes = n; diff --git a/third_party/sqlite/safe-tolower.patch b/third_party/sqlite/safe-tolower.patch index c42bb06..a2ea8af 100644 --- a/third_party/sqlite/safe-tolower.patch +++ b/third_party/sqlite/safe-tolower.patch @@ -4,6 +4,8 @@ See http://crbug.com/15261 for details. An upstream ticket was also created for this issue: http://www.sqlite.org/src/tktview/991789d9f3136a0460dc83a33e815c1aa9757c26 +Contains backport for upstream http://www.sqlite.org/src/ci/b8b465ed2c. + Index: ext/fts3/fts3.c =================================================================== --- ext/fts3/fts3.c 2009-09-04 13:37:41.000000000 -0700 @@ -17,16 +19,76 @@ Index: ext/fts3/fts3.c } static int safe_isalnum(char c){ return (c&0x80)==0 ? isalnum(c) : 0; +Index: ext/fts3/fts3_expr.c +=================================================================== +--- ext/fts3/fts3_expr.c ++++ ext/fts3/fts3_expr.c +@@ -58,7 +58,6 @@ int sqlite3_fts3_enable_parentheses = 0; + + #include "fts3_expr.h" + #include "sqlite3.h" +-#include <ctype.h> + #include <string.h> + #include <assert.h> + +@@ -84,7 +83,7 @@ struct ParseContext { + ** negative values). + */ + static int fts3isspace(char c){ +- return (c&0x80)==0 ? isspace(c) : 0; ++ return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f'; + } + + /* +Index: ext/fts3/fts3_porter.c +=================================================================== +--- ext/fts3/fts3_porter.c ++++ ext/fts3/fts3_porter.c +@@ -29,7 +29,6 @@ + #include <stdlib.h> + #include <stdio.h> + #include <string.h> +-#include <ctype.h> + + #include "fts3_tokenizer.h" + Index: ext/fts3/fts3_tokenizer1.c =================================================================== ---- ext/fts3/fts3_tokenizer1.c 2009-09-03 13:32:06.000000000 -0700 -+++ ext/fts3/fts3_tokenizer1.c 2009-09-02 11:40:21.000000000 -0700 -@@ -191,7 +191,7 @@ +--- ext/fts3/fts3_tokenizer1.c ++++ ext/fts3/fts3_tokenizer1.c +@@ -29,7 +29,6 @@ + #include <stdlib.h> + #include <stdio.h> + #include <string.h> +-#include <ctype.h> + + #include "fts3_tokenizer.h" + +@@ -55,6 +54,9 @@ static const sqlite3_tokenizer_module simpleTokenizerModule; + static int simpleDelim(simple_tokenizer *t, unsigned char c){ + return c<0x80 && t->delim[c]; + } ++static int fts3_isalnum(int x){ ++ return (x>='0' && x<='9') || (x>='A' && x<='Z') || (x>='a' && x<='z'); ++} + + /* + ** Create a new tokenizer instance. +@@ -89,7 +91,7 @@ static int simpleCreate( + /* Mark non-alphanumeric ASCII characters as delimiters */ + int i; + for(i=1; i<0x80; i++){ +- t->delim[i] = !isalnum(i); ++ t->delim[i] = !fts3_isalnum(i); + } + } + +@@ -191,7 +193,7 @@ static int simpleNext( ** case-insensitivity. */ unsigned char ch = p[iStartOffset+i]; - c->pToken[i] = ch<0x80 ? tolower(ch) : ch; -+ c->pToken[i] = (ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch; ++ c->pToken[i] = (ch>='A' && ch<='Z') ? ch-'A'+'a' : ch; } *ppToken = c->pToken; *pnBytes = n; |