From e49d98fb0a5f0e2987d128110d08c833babd6606 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Sat, 24 Aug 2013 23:55:01 +0000 Subject: [PATCH] Several modifications to the use of the MAX_PATH macro on Windows to improve consistency. FossilOrigin-Name: bda4c47df8e80b4cc9e8aac8fd74482869f96107 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_win.c | 35 ++++++++++++++++++++++------------- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/manifest b/manifest index 50cfe34e75..99343dbe57 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\scouple\scompilation\sissues\son\sUnix. -D 2013-08-24T01:12:03.598 +C Several\smodifications\sto\sthe\suse\sof\sthe\sMAX_PATH\smacro\son\sWindows\sto\simprove\sconsistency. +D 2013-08-24T23:55:01.356 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -203,7 +203,7 @@ F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c 44a2b26acd3f3f3a0b5d8495af945cec70a9e9df -F src/os_win.c 1d84f2079d9b91f91a4b5dbfa5e08f1b1a0ed0ff +F src/os_win.c 339cdb887654f805a3e7225dd67f210cd5c831d3 F src/pager.c 2aa4444ffe86e9282d03bc349a4a5e49bd77c0e8 F src/pager.h f094af9f6ececfaa8a1e93876905a4f34233fb0c F src/parse.y 27c6b4138497d6f8360ba7847da6ed48033f957f @@ -1105,7 +1105,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac -P 032c31593d6f569842830cac6222362be68b2084 -R e9c8a1891e536319ba2e72bdf41d1b7c +P 25b029d8f32440a94ef8af45153423f6702d7431 +R 43a5201efd5c79e69d4099d70d2d8790 U mistachkin -Z cf772d6485c0eea6b9958d111508c114 +Z 68ffb990c84dd84cc8ba4e540d45c8d3 diff --git a/manifest.uuid b/manifest.uuid index 3992a4377e..ad42030f96 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -25b029d8f32440a94ef8af45153423f6702d7431 \ No newline at end of file +bda4c47df8e80b4cc9e8aac8fd74482869f96107 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 10c4316448..0f27ac43f2 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -50,6 +50,24 @@ # define SQLITE_WIN32_HAS_WIDE #endif +/* +** Maximum pathname length (in bytes) for Win32. The MAX_PATH macro is in +** characters, so we allocate 3 bytes per character assuming worst-case of +** 3-bytes-per-character for UTF8. +*/ +#ifndef SQLITE_WIN32_MAX_PATH +# define SQLITE_WIN32_MAX_PATH (MAX_PATH*3) +#endif + +/* +** Maximum error message length (in bytes) for WinRT. The MAX_PATH macro is +** in characters, so we allocate 3 bytes per character assuming worst-case of +** 3-bytes-per-character for UTF8. +*/ +#ifndef SQLITE_WIN32_MAX_ERRMSG +# define SQLITE_WIN32_MAX_ERRMSG (MAX_PATH*3) +#endif + /* ** Do we need to manually define the Win32 file mapping APIs for use with WAL ** mode (e.g. these APIs are available in the Windows CE SDK; however, they @@ -1463,14 +1481,14 @@ static int getLastErrorMsg(DWORD lastErrno, int nBuf, char *zBuf){ if( isNT() ){ #if SQLITE_OS_WINRT - WCHAR zTempWide[MAX_PATH+1]; /* NOTE: Somewhat arbitrary. */ + WCHAR zTempWide[SQLITE_WIN32_MAX_ERRMSG+1]; /* NOTE: Somewhat arbitrary. */ dwLen = osFormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lastErrno, 0, zTempWide, - MAX_PATH, + SQLITE_WIN32_MAX_ERRMSG, 0); #else LPWSTR zTempWide = NULL; @@ -3868,15 +3886,6 @@ static void *convertUtf8Filename(const char *zFilename){ return zConverted; } -/* -** Maximum pathname length (in bytes) for windows. The MAX_PATH macro is -** in characters, so we allocate 3 bytes per character assuming worst-case -** 3-bytes-per-character UTF8. -*/ -#ifndef SQLITE_WIN32_MAX_PATH -# define SQLITE_WIN32_MAX_PATH (MAX_PATH*3) -#endif - /* ** Create a temporary file name in zBuf. zBuf must be big enough to ** hold at pVfs->mxPathname characters. @@ -3903,8 +3912,8 @@ static int getTempname(int nBuf, char *zBuf){ #if !SQLITE_OS_WINRT else if( isNT() ){ char *zMulti; - WCHAR zWidePath[MAX_PATH]; - if( osGetTempPathW(MAX_PATH-30, zWidePath)==0 ){ + WCHAR zWidePath[SQLITE_WIN32_MAX_PATH]; + if( osGetTempPathW(SQLITE_WIN32_MAX_PATH-30, zWidePath)==0 ){ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); return SQLITE_IOERR_GETTEMPPATH; } -- 2.47.2