1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-25 20:58:26 +03:00

More fixes to the microsoft code-page nightmare... (CVS 3544)

FossilOrigin-Name: 0b47d88060069781e7e184806d6ecaeff9b9e5d1
This commit is contained in:
drh
2006-12-21 03:20:40 +00:00
parent 2a4d54b2cd
commit 584c094ba4
3 changed files with 27 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
C Use\sGetProcAddressA()\son\swince.\s\sTicket\s#2123\s(CVS\s3543) C More\sfixes\sto\sthe\smicrosoft\scode-page\snightmare...\s(CVS\s3544)
D 2006-12-21T02:21:57 D 2006-12-21T03:20:41
F Makefile.in 8e14898d41a53033ecb687d93c9cd5d109fb9ae3 F Makefile.in 8e14898d41a53033ecb687d93c9cd5d109fb9ae3
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -83,7 +83,7 @@ F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3 F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
F src/os_unix.c d4bc8cbe1c0dc330bd55bf7821db5b7dbfbf183e F src/os_unix.c d4bc8cbe1c0dc330bd55bf7821db5b7dbfbf183e
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c d7cf0fc2acd9d2a519a9442f78b4bdbf30e730d6 F src/os_win.c ca46001d4ec446885f72d3b7fd6a657136156228
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c 814268d5bbd69f30069867142f1d460b8b7ab778 F src/pager.c 814268d5bbd69f30069867142f1d460b8b7ab778
F src/pager.h 2e6d42f4ae004ae748a037b8468112b851c447a7 F src/pager.h 2e6d42f4ae004ae748a037b8468112b851c447a7
@@ -423,7 +423,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 6d2ff0962dff0477fe2af0323032dc16337f42ab P e3dddd1cef5877c009852fd7f484973843e26e00
R 1a4c9add7b3dd8462c8e8800ce5e3721 R 73c89ed5916e57284a7ee348ebe00fd3
U drh U drh
Z 485f836110e73c29878298d90fc161b1 Z da8e9bd7450544645912de3f756444c4

View File

@@ -1 +1 @@
e3dddd1cef5877c009852fd7f484973843e26e00 0b47d88060069781e7e184806d6ecaeff9b9e5d1

View File

@@ -124,8 +124,9 @@ int sqlite3_os_type = 0;
#endif /* OS_WINCE */ #endif /* OS_WINCE */
/* /*
** Convert a UTF-8 string to UTF-32. Space to hold the returned string ** Convert a UTF-8 string to microsoft unicode (UTF-16?).
** is obtained from sqliteMalloc. **
** Space to hold the returned string is obtained from sqliteMalloc.
*/ */
static WCHAR *utf8ToUnicode(const char *zFilename){ static WCHAR *utf8ToUnicode(const char *zFilename){
int nChar; int nChar;
@@ -145,7 +146,7 @@ static WCHAR *utf8ToUnicode(const char *zFilename){
} }
/* /*
** Convert UTF-32 to UTF-8. Space to hold the returned string is ** Convert microsoft unicode to UTF-8. Space to hold the returned string is
** obtained from sqliteMalloc(). ** obtained from sqliteMalloc().
*/ */
static char *unicodeToUtf8(const WCHAR *zWideFilename){ static char *unicodeToUtf8(const WCHAR *zWideFilename){
@@ -167,20 +168,23 @@ static char *unicodeToUtf8(const WCHAR *zWideFilename){
} }
/* /*
** Convert a multibyte character string to UTF-32, based on the current ** Convert an ansi string to microsoft unicode, based on the
** Ansi codepage (CP_ACP). Space to hold the returned string is obtained ** current codepage settings for file apis.
**
** Space to hold the returned string is obtained
** from sqliteMalloc. ** from sqliteMalloc.
*/ */
static WCHAR *mbcsToUnicode(const char *zFilename){ static WCHAR *mbcsToUnicode(const char *zFilename){
int nByte; int nByte;
WCHAR *zMbcsFilename; WCHAR *zMbcsFilename;
int codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;
nByte = MultiByteToWideChar(CP_ACP, 0, zFilename, -1, NULL, 0)*sizeof(WCHAR); nByte = MultiByteToWideChar(codepage, 0, zFilename, -1, NULL,0)*sizeof(WCHAR);
zMbcsFilename = sqliteMalloc( nByte*sizeof(zMbcsFilename[0]) ); zMbcsFilename = sqliteMalloc( nByte*sizeof(zMbcsFilename[0]) );
if( zMbcsFilename==0 ){ if( zMbcsFilename==0 ){
return 0; return 0;
} }
nByte = MultiByteToWideChar(CP_ACP, 0, zFilename, -1, zMbcsFilename, nByte); nByte = MultiByteToWideChar(codepage, 0, zFilename, -1, zMbcsFilename, nByte);
if( nByte==0 ){ if( nByte==0 ){
sqliteFree(zMbcsFilename); sqliteFree(zMbcsFilename);
zMbcsFilename = 0; zMbcsFilename = 0;
@@ -189,20 +193,23 @@ static WCHAR *mbcsToUnicode(const char *zFilename){
} }
/* /*
** Convert UTF-32 to multibyte character string, based on the user's Ansi ** Convert microsoft unicode to multibyte character string, based on the
** codepage (CP_ACP). Space to hold the returned string is obtained from ** user's Ansi codepage.
**
** Space to hold the returned string is obtained from
** sqliteMalloc(). ** sqliteMalloc().
*/ */
static char *unicodeToMbcs(const WCHAR *zWideFilename){ static char *unicodeToMbcs(const WCHAR *zWideFilename){
int nByte; int nByte;
char *zFilename; char *zFilename;
int codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;
nByte = WideCharToMultiByte(CP_ACP, 0, zWideFilename, -1, 0, 0, 0, 0); nByte = WideCharToMultiByte(codepage, 0, zWideFilename, -1, 0, 0, 0, 0);
zFilename = sqliteMalloc( nByte ); zFilename = sqliteMalloc( nByte );
if( zFilename==0 ){ if( zFilename==0 ){
return 0; return 0;
} }
nByte = WideCharToMultiByte(CP_ACP, 0, zWideFilename, -1, zFilename, nByte, nByte = WideCharToMultiByte(codepage, 0, zWideFilename, -1, zFilename, nByte,
0, 0); 0, 0);
if( nByte == 0 ){ if( nByte == 0 ){
sqliteFree(zFilename); sqliteFree(zFilename);
@@ -1513,12 +1520,12 @@ void *sqlite3WinDlopen(const char *zFilename){
return 0; return 0;
} }
if( isNT() ){ if( isNT() ){
h = LoadLibraryW(zConverted); h = LoadLibraryW((WCHAR*)zConverted);
}else{ }else{
#if OS_WINCE #if OS_WINCE
return 0; return 0;
#else #else
h = LoadLibraryA(zConverted); h = LoadLibraryA((char*)zConverted);
#endif #endif
} }
sqliteFree(zConverted); sqliteFree(zConverted);