-C Implement\soptimize()\sfunction.\s\sThis\smerges\sall\ssegments\sin\sthe\sfts\nindex\sinto\sa\ssingle\ssegment,\sincluding\sdropping\sdelete\scookies.\s(CVS\s5417)
-D 2008-07-15T21:32:07
+C Work\saround\sbugs\sin\solder\sversions\sof\sthe\sOS/2\sconversion\slibrary\sby\strying\sto\sminimize\scalls\sto\sUniCreateUconvObject()\setc.\sUse\sglobal\suconv\sobjects\sinstead.\s(CVS\s5418)
+D 2008-07-15T22:59:05
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a03f7cb4f7ad50bc53a788c6c544430e81f95de4
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/os.c 292b3b4a49fe5bf6cf2f1cf0af186ebd334e80b8
F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892
F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
-F src/os_os2.c 6c33e61f0fab256b0136650cdee35c3eaab2fa04
+F src/os_os2.c b16aee2f727842f758140641835a46caad322f5d
F src/os_unix.c 1df6108efdb7957a9f28b9700600e58647c9c12d
F src/os_win.c 2bf2f8cd700299564cc236262c2668e1e02c626a
F src/pager.c bb286b2fc0c7c87d0a8cbfee96a3e953da1e53dd
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 61f6e19755b85bcb065f85fc425c2172badea308
-R 801d6f0acc1dc5b802184549b77ec890
-U shess
-Z 136d2d664a48bc67bfa7ab0ac78c0104
+P b22e187bc2b38bd219dd0feba19b97279bd83089
+R 3e4111cc48212173ac6c652db5b424aa
+U pweilbacher
+Z 2bd5796475610dfaaebbcccc19839580
**
** This file contains code that is specific to OS/2.
**
-** $Id: os_os2.c,v 1.49 2008/07/08 22:34:07 pweilbacher Exp $
+** $Id: os_os2.c,v 1.50 2008/07/15 22:59:05 pweilbacher Exp $
*/
#include "sqliteInt.h"
return 0;
}
+
+/*
+** Character set conversion objects used by conversion routines.
+*/
+static UconvObject ucUtf8 = NULL; /* convert between UTF-8 and UCS-2 */
+static UconvObject uclCp = NULL; /* convert between local codepage and UCS-2 */
+
+/*
+** Helper function to initialize the conversion objects from and to UTF-8.
+*/
+static void initUconvObjects( void ){
+ printf("init them\n");
+ if( UniCreateUconvObject( UTF_8, &ucUtf8 ) != ULS_SUCCESS )
+ ucUtf8 = NULL;
+ if ( UniCreateUconvObject( (UniChar *)L"@path=yes", &uclCp ) != ULS_SUCCESS )
+ uclCp = NULL;
+}
+
+/*
+** Helper function to free the conversion objects from and to UTF-8.
+*/
+static void freeUconvObjects( void ){
+ printf("free them\n");
+ if ( ucUtf8 )
+ UniFreeUconvObject( ucUtf8 );
+ if ( uclCp )
+ UniFreeUconvObject( uclCp );
+ ucUtf8 = NULL;
+ uclCp = NULL;
+}
+
/*
** Helper function to convert UTF-8 filenames to local OS/2 codepage.
** The two-step process: first convert the incoming UTF-8 string
** into UCS-2 and then from UCS-2 to the current codepage.
** The returned char pointer has to be freed.
*/
-static char *convertUtf8PathToCp(const char *in)
-{
- UconvObject uconv;
- UniChar ucsUtf8Cp[12],
- tempPath[CCHMAXPATH];
- char *out;
- int rc = 0;
+static char *convertUtf8PathToCp( const char *in ){
+ UniChar tempPath[CCHMAXPATH];
+ char *out = (char *)calloc( CCHMAXPATH, 1 );
+printf("convertUtf8PathToCp(%s)\n", in);
- out = (char *)calloc(CCHMAXPATH, 1);
+ if( !out )
+ return NULL;
+
+ if( !ucUtf8 || !uclCp )
+ initUconvObjects();
/* determine string for the conversion of UTF-8 which is CP1208 */
- rc = UniMapCpToUcsCp(1208, ucsUtf8Cp, 12);
- rc = UniCreateUconvObject(ucsUtf8Cp, &uconv);
- rc = UniStrToUcs(uconv, tempPath, (char *)in, CCHMAXPATH);
- rc = UniFreeUconvObject(uconv);
+ if( UniStrToUcs( ucUtf8, tempPath, (char *)in, CCHMAXPATH ) != ULS_SUCCESS )
+ return out; /* if conversion fails, return the empty string */
/* conversion for current codepage which can be used for paths */
- rc = UniCreateUconvObject((UniChar *)L"@path=yes", &uconv);
- rc = UniStrFromUcs(uconv, out, tempPath, CCHMAXPATH);
- rc = UniFreeUconvObject(uconv);
+ UniStrFromUcs( uclCp, out, tempPath, CCHMAXPATH );
+ printf("%s -> Cp = %s\n", in, out);
return out;
}
** The two-step process: first convert the incoming codepage-specific
** string into UCS-2 and then from UCS-2 to the codepage of UTF-8.
** The returned char pointer has to be freed.
+**
+** This function is non-static to be able to use this in shell.c and
+** similar applications that take command line arguments.
*/
-static char *convertCpPathToUtf8(const char *in)
-{
- UconvObject uconv;
- UniChar ucsUtf8Cp[12],
- tempPath[CCHMAXPATH];
- char *out;
- int rc = 0;
+char *convertCpPathToUtf8( const char *in ){
+ UniChar tempPath[CCHMAXPATH];
+ char *out = (char *)calloc( CCHMAXPATH, 1 );
+printf("convertCpPathToUtf8(%s)\n", in);
- out = (char *)calloc(CCHMAXPATH, 1);
+ if( !out )
+ return NULL;
+
+ if( !ucUtf8 || !uclCp )
+ initUconvObjects();
/* conversion for current codepage which can be used for paths */
- rc = UniCreateUconvObject((UniChar *)L"@path=yes", &uconv);
- rc = UniStrToUcs(uconv, tempPath, (char *)in, CCHMAXPATH);
- rc = UniFreeUconvObject(uconv);
+ if( UniStrToUcs( uclCp, tempPath, (char *)in, CCHMAXPATH ) != ULS_SUCCESS )
+ return out; /* if conversion fails, return the empty string */
/* determine string for the conversion of UTF-8 which is CP1208 */
- rc = UniMapCpToUcsCp(1208, ucsUtf8Cp, 12);
- rc = UniCreateUconvObject(ucsUtf8Cp, &uconv);
- rc = UniStrFromUcs(uconv, out, tempPath, CCHMAXPATH);
- rc = UniFreeUconvObject(uconv);
+ UniStrFromUcs( ucUtf8, out, tempPath, CCHMAXPATH );
+ printf("%s -> Utf8 = %s\n", in, out);
return out;
}
if( DosScanEnv( (PSZ)"TEMP", &zTempPath ) ){
if( DosScanEnv( (PSZ)"TMP", &zTempPath ) ){
if( DosScanEnv( (PSZ)"TMPDIR", &zTempPath ) ){
- ULONG ulDriveNum = 0, ulDriveMap = 0;
- DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
- sprintf( (char*)zTempPath, "%c:", (char)( 'A' + ulDriveNum - 1 ) );
+ ULONG ulDriveNum = 0, ulDriveMap = 0;
+ DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
+ sprintf( (char*)zTempPath, "%c:", (char)( 'A' + ulDriveNum - 1 ) );
}
}
}
** Initialize and deinitialize the operating system interface.
*/
int sqlite3_os_init(void){
+ initUconvObjects();
+
static sqlite3_vfs os2Vfs = {
1, /* iVersion */
sizeof(os2File), /* szOsFile */
return SQLITE_OK;
}
int sqlite3_os_end(void){
+ freeUconvObjects();
return SQLITE_OK;
}