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

Unified Diff: third_party/sqlite/src/ext/fts3/fts3_tokenizer1.c

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/ext/fts3/fts3_tokenizer.c ('k') | third_party/sqlite/src/ext/fts3/fts3_write.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/ext/fts3/fts3_tokenizer1.c
diff --git a/third_party/sqlite/src/ext/fts3/fts3_tokenizer1.c b/third_party/sqlite/src/ext/fts3/fts3_tokenizer1.c
index bbc56969e918f5e52ceb9dda4f08f322e87dbbea..432c35d1a2518065965ec918afac208c4cd776dd 100644
--- a/third_party/sqlite/src/ext/fts3/fts3_tokenizer1.c
+++ b/third_party/sqlite/src/ext/fts3/fts3_tokenizer1.c
@@ -24,6 +24,7 @@
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
+#include "fts3Int.h"
#include <assert.h>
#include <stdlib.h>
@@ -48,9 +49,6 @@ typedef struct simple_tokenizer_cursor {
} simple_tokenizer_cursor;
-/* Forward declaration */
-static const sqlite3_tokenizer_module simpleTokenizerModule;
-
static int simpleDelim(simple_tokenizer *t, unsigned char c){
return c<0x80 && t->delim[c];
}
@@ -77,7 +75,7 @@ static int simpleCreate(
** information on the initial create.
*/
if( argc>1 ){
- int i, n = strlen(argv[1]);
+ int i, n = (int)strlen(argv[1]);
for(i=0; i<n; i++){
unsigned char ch = argv[1][i];
/* We explicitly don't support UTF-8 delimiters for now. */
@@ -91,7 +89,7 @@ static int simpleCreate(
/* Mark non-alphanumeric ASCII characters as delimiters */
int i;
for(i=1; i<0x80; i++){
- t->delim[i] = !fts3_isalnum(i);
+ t->delim[i] = !fts3_isalnum(i) ? -1 : 0;
}
}
@@ -120,6 +118,8 @@ static int simpleOpen(
){
simple_tokenizer_cursor *c;
+ UNUSED_PARAMETER(pTokenizer);
+
c = (simple_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));
if( c==NULL ) return SQLITE_NOMEM;
@@ -184,16 +184,18 @@ static int simpleNext(
if( c->iOffset>iStartOffset ){
int i, n = c->iOffset-iStartOffset;
if( n>c->nTokenAllocated ){
+ char *pNew;
c->nTokenAllocated = n+20;
- c->pToken = sqlite3_realloc(c->pToken, c->nTokenAllocated);
- if( c->pToken==NULL ) return SQLITE_NOMEM;
+ pNew = sqlite3_realloc(c->pToken, c->nTokenAllocated);
+ if( !pNew ) return SQLITE_NOMEM;
+ c->pToken = pNew;
}
for(i=0; i<n; i++){
/* TODO(shess) This needs expansion to handle UTF-8
** case-insensitivity.
*/
unsigned char ch = p[iStartOffset+i];
- c->pToken[i] = (ch>='A' && ch<='Z') ? ch-'A'+'a' : ch;
+ c->pToken[i] = (char)((ch>='A' && ch<='Z') ? ch-'A'+'a' : ch);
}
*ppToken = c->pToken;
*pnBytes = n;
« no previous file with comments | « third_party/sqlite/src/ext/fts3/fts3_tokenizer.c ('k') | third_party/sqlite/src/ext/fts3/fts3_write.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698