From: drh <> Date: Tue, 30 Dec 2025 12:38:43 +0000 (+0000) Subject: Improved handling of the process entry point in Windows, to translate X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02ceb918754ee8b142681a92a9a8304ac3447ad4;p=thirdparty%2Fsqlite.git Improved handling of the process entry point in Windows, to translate arguments into UTF8. FossilOrigin-Name: 1d4ee6c35e69d43e2b801c425308de0ef5d5d9d2d0af9b406b664bf0f9cfa337 --- diff --git a/manifest b/manifest index 4ea3ac7cec..bbe71990f3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\ssigned\sinteger\soverflow\swhen\san\sfts5\s'merge'\scommand\sis\spassed\s-2147483648\sas\sa\sparameter. -D 2025-12-30T11:36:23.388 +C Improved\shandling\sof\sthe\sprocess\sentry\spoint\sin\sWindows,\sto\stranslate\narguments\sinto\sUTF8. +D 2025-12-30T12:38:43.349 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -737,7 +737,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 47aa7fdc9ec4c19b103ac5e79d7887d30119b5675309facf5eed1118391c868b F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 85852256d860f3ba5be4a9edc1238e68dbea082a0167f31b7345c821ae45775d -F src/shell.c.in a1bbd7dd24c10c18190c66b4f6258dcd04a77fba5c60c4d92fe04b4f20a316b9 +F src/shell.c.in eda201c925ef603dcbd602aa9175d33c6239c3504cacd09bcf06978ba270fa15 F src/sqlite.h.in b6599377f02ef9d545a8da48959213928b63291ad83ff65e5f3a72bf4fec595d F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 5d5330f5f8461f5ce74960436ddcfa53ecd09c2b8b23901e22ae38aec3243998 @@ -2189,9 +2189,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c f40bccf0236f8bcc34b299781b7d34cb269ace23afe5c1b8a9d966e2fa1ce9e5 -P d58846e74b6971a5fd80e5f030985273b7dfa0087c2f3c9d0c088c248e183f8a 7f0b9e7a8bba1b73ef16257e72a055ea84fb10eb5cf0e6431fca81b2f040c5ee -R 4b14869b8ea6686a23e18d14ecb69d10 -T +closed 7f0b9e7a8bba1b73ef16257e72a055ea84fb10eb5cf0e6431fca81b2f040c5ee -U dan -Z f65be022e8b9c70a31eec0ffafb9ac65 +P 52738908b04848b93d54431def37ffaa9723043270ff8ba1e2fa59ab0040afc5 +R cb09b246c37bfff2eb717b355f39c425 +U drh +Z d5389fca5c5b11091c96d873f13e083b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5358059ee9..d03f77ff2d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -52738908b04848b93d54431def37ffaa9723043270ff8ba1e2fa59ab0040afc5 +1d4ee6c35e69d43e2b801c425308de0ef5d5d9d2d0af9b406b664bf0f9cfa337 diff --git a/src/shell.c.in b/src/shell.c.in index 381459a1fc..8ce10228cd 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -556,6 +556,14 @@ static char mainPrompt[PROMPT_LEN_MAX]; /* Continuation prompt. default: " ...> " */ static char continuePrompt[PROMPT_LEN_MAX]; +/* +** Write I/O traces to the following stream. +*/ +#ifdef SQLITE_ENABLE_IOTRACE +static FILE *iotrace = 0; +#endif + + /* This is variant of the standard-library strncpy() routine with the ** one change that the destination string is always zero-terminated, even ** if there is no zero-terminator in the first n-1 characters of the source @@ -675,13 +683,6 @@ static void shell_check_oom(const void *p){ if( p==0 ) shell_out_of_memory(); } -/* -** Write I/O traces to the following stream. -*/ -#ifdef SQLITE_ENABLE_IOTRACE -static FILE *iotrace = 0; -#endif - /* ** This routine works like printf in that its first argument is a ** format string and subsequent arguments are values to be substituted @@ -12654,25 +12655,60 @@ static int vfstraceOut(const char *z, void *pArg){ return 1; } -#ifndef SQLITE_SHELL_IS_UTF8 -# if (defined(_WIN32) || defined(WIN32)) \ - && (defined(_MSC_VER) || (defined(UNICODE) && defined(__GNUC__))) -# define SQLITE_SHELL_IS_UTF8 (0) -# else -# define SQLITE_SHELL_IS_UTF8 (1) -# endif -#endif - +/* Alternative name to the entry point for Fiddle */ #ifdef SQLITE_SHELL_FIDDLE # define main fiddle_main #endif -#if SQLITE_SHELL_IS_UTF8 -int SQLITE_CDECL main(int argc, char **argv){ -#else +/* Use the wmain() entry point on Windows. Translate arguments to +** UTF8, then invoke the traditional main() entry point which is +** renamed using a #define to utf8_main() . +*/ +#if defined(_WIN32) && !defined(main) +# define main utf8_main /* Rename entry point to utf_main() */ +int SQLITE_CDECL utf8_main(int,char**); /* Forward declaration */ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ - char **argv; -#endif + int rc, i; + char **argv = malloc( sizeof(char*) * (argc+1) ); + char **orig = argv; + if( argv==0 ){ + fprintf(stderr, "malloc failed\n"); + exit(1); + } + for(i=0; i=1 && argv && argv[0] ); Argv0 = argv[0]; @@ -12973,6 +12979,16 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ }else if( cli_strcmp(z,"-escape")==0 && i+1