mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-24 09:53:10 +03:00
When not compiling for an EBCDIC system, use built-in alternatives to the tolowe
r(), toupper() and other ctype.h library functions. Ticket #3597. (CVS 6196) FossilOrigin-Name: 1041abd6784d283bebf646c54e93599522f7889d
This commit is contained in:
13
src/func.c
13
src/func.c
@@ -16,10 +16,9 @@
|
||||
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
||||
** All other code has file scope.
|
||||
**
|
||||
** $Id: func.c,v 1.209 2008/12/10 23:04:13 drh Exp $
|
||||
** $Id: func.c,v 1.210 2009/01/20 16:53:40 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "vdbeInt.h"
|
||||
@@ -276,14 +275,14 @@ static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
|
||||
if( z1 ){
|
||||
memcpy(z1, z2, n+1);
|
||||
for(i=0; z1[i]; i++){
|
||||
z1[i] = (char)toupper(z1[i]);
|
||||
z1[i] = (char)sqlite3Toupper(z1[i]);
|
||||
}
|
||||
sqlite3_result_text(context, z1, -1, sqlite3_free);
|
||||
}
|
||||
}
|
||||
}
|
||||
static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
|
||||
char *z1;
|
||||
u8 *z1;
|
||||
const char *z2;
|
||||
int i, n;
|
||||
if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
|
||||
@@ -296,9 +295,9 @@ static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
|
||||
if( z1 ){
|
||||
memcpy(z1, z2, n+1);
|
||||
for(i=0; z1[i]; i++){
|
||||
z1[i] = (char)tolower(z1[i]);
|
||||
z1[i] = sqlite3Tolower(z1[i]);
|
||||
}
|
||||
sqlite3_result_text(context, z1, -1, sqlite3_free);
|
||||
sqlite3_result_text(context, (char *)z1, -1, sqlite3_free);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -980,7 +979,7 @@ static void soundexFunc(
|
||||
for(i=0; zIn[i] && !isalpha(zIn[i]); i++){}
|
||||
if( zIn[i] ){
|
||||
u8 prevcode = iCode[zIn[i]&0x7f];
|
||||
zResult[0] = toupper(zIn[i]);
|
||||
zResult[0] = sqlite3Toupper(zIn[i]);
|
||||
for(j=1; j<4 && zIn[i]; i++){
|
||||
int code = iCode[zIn[i]&0x7f];
|
||||
if( code>0 ){
|
||||
|
||||
Reference in New Issue
Block a user