Index: third_party/sqlite/sqlite-src-3080704/ext/fts3/fts3_icu.c |
diff --git a/third_party/sqlite/sqlite-src-3070603/ext/fts3/fts3_icu.c b/third_party/sqlite/sqlite-src-3080704/ext/fts3/fts3_icu.c |
similarity index 96% |
copy from third_party/sqlite/sqlite-src-3070603/ext/fts3/fts3_icu.c |
copy to third_party/sqlite/sqlite-src-3080704/ext/fts3/fts3_icu.c |
index 85390d3b065b5c422fb07d2bdd69614893f56ccf..52df8c7d8128e3f6e71bc0571653232eac06a9a5 100644 |
--- a/third_party/sqlite/sqlite-src-3070603/ext/fts3/fts3_icu.c |
+++ b/third_party/sqlite/sqlite-src-3080704/ext/fts3/fts3_icu.c |
@@ -10,10 +10,8 @@ |
** |
************************************************************************* |
** This file implements a tokenizer for fts3 based on the ICU library. |
-** |
-** $Id: fts3_icu.c,v 1.3 2008/09/01 18:34:20 danielk1977 Exp $ |
*/ |
- |
+#include "fts3Int.h" |
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) |
#ifdef SQLITE_ENABLE_ICU |
@@ -112,13 +110,16 @@ static int icuOpen( |
*ppCursor = 0; |
- if( nInput<0 ){ |
+ if( zInput==0 ){ |
+ nInput = 0; |
+ zInput = ""; |
+ }else if( nInput<0 ){ |
nInput = strlen(zInput); |
} |
nChar = nInput+1; |
pCsr = (IcuCursor *)sqlite3_malloc( |
sizeof(IcuCursor) + /* IcuCursor */ |
- nChar * sizeof(UChar) + /* IcuCursor.aChar[] */ |
+ ((nChar+3)&~3) * sizeof(UChar) + /* IcuCursor.aChar[] */ |
(nChar+1) * sizeof(int) /* IcuCursor.aOffset[] */ |
); |
if( !pCsr ){ |
@@ -126,7 +127,7 @@ static int icuOpen( |
} |
memset(pCsr, 0, sizeof(IcuCursor)); |
pCsr->aChar = (UChar *)&pCsr[1]; |
- pCsr->aOffset = (int *)&pCsr->aChar[nChar]; |
+ pCsr->aOffset = (int *)&pCsr->aChar[(nChar+3)&~3]; |
pCsr->aOffset[iOut] = iInput; |
U8_NEXT(zInput, iInput, nInput, c); |
@@ -198,7 +199,7 @@ static int icuNext( |
while( iStart<iEnd ){ |
int iWhite = iStart; |
- U8_NEXT(pCsr->aChar, iWhite, pCsr->nChar, c); |
+ U16_NEXT(pCsr->aChar, iWhite, pCsr->nChar, c); |
if( u_isspace(c) ){ |
iStart = iWhite; |
}else{ |