| OLD | NEW |
| 1 /* | 1 /* |
| 2 ** 2006 Oct 10 | 2 ** 2006 Oct 10 |
| 3 ** | 3 ** |
| 4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
| 5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
| 6 ** | 6 ** |
| 7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
| 8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
| 9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
| 10 ** | 10 ** |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 if( n>c->nTokenAllocated ){ | 184 if( n>c->nTokenAllocated ){ |
| 185 c->nTokenAllocated = n+20; | 185 c->nTokenAllocated = n+20; |
| 186 c->pToken = sqlite3_realloc(c->pToken, c->nTokenAllocated); | 186 c->pToken = sqlite3_realloc(c->pToken, c->nTokenAllocated); |
| 187 if( c->pToken==NULL ) return SQLITE_NOMEM; | 187 if( c->pToken==NULL ) return SQLITE_NOMEM; |
| 188 } | 188 } |
| 189 for(i=0; i<n; i++){ | 189 for(i=0; i<n; i++){ |
| 190 /* TODO(shess) This needs expansion to handle UTF-8 | 190 /* TODO(shess) This needs expansion to handle UTF-8 |
| 191 ** case-insensitivity. | 191 ** case-insensitivity. |
| 192 */ | 192 */ |
| 193 unsigned char ch = p[iStartOffset+i]; | 193 unsigned char ch = p[iStartOffset+i]; |
| 194 c->pToken[i] = ch<0x80 ? tolower(ch) : ch; | 194 c->pToken[i] = (ch>='A' && ch<='Z') ? (ch-'A'+'a') : ch; |
| 195 } | 195 } |
| 196 *ppToken = c->pToken; | 196 *ppToken = c->pToken; |
| 197 *pnBytes = n; | 197 *pnBytes = n; |
| 198 *piStartOffset = iStartOffset; | 198 *piStartOffset = iStartOffset; |
| 199 *piEndOffset = c->iOffset; | 199 *piEndOffset = c->iOffset; |
| 200 *piPosition = c->iToken++; | 200 *piPosition = c->iToken++; |
| 201 | 201 |
| 202 return SQLITE_OK; | 202 return SQLITE_OK; |
| 203 } | 203 } |
| 204 } | 204 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 221 ** Allocate a new simple tokenizer. Return a pointer to the new | 221 ** Allocate a new simple tokenizer. Return a pointer to the new |
| 222 ** tokenizer in *ppModule | 222 ** tokenizer in *ppModule |
| 223 */ | 223 */ |
| 224 void sqlite3Fts3SimpleTokenizerModule( | 224 void sqlite3Fts3SimpleTokenizerModule( |
| 225 sqlite3_tokenizer_module const**ppModule | 225 sqlite3_tokenizer_module const**ppModule |
| 226 ){ | 226 ){ |
| 227 *ppModule = &simpleTokenizerModule; | 227 *ppModule = &simpleTokenizerModule; |
| 228 } | 228 } |
| 229 | 229 |
| 230 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ | 230 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ |
| OLD | NEW |