Fossil SCM
Improve comments. Style and consistency fixes.
Commit
d1b7c8765057e1d12289bea85646d92496c1bc8c
Parent
4f0c38d81d03701…
1 file changed
+5
-4
+5
-4
| --- src/winfile.c | ||
| +++ src/winfile.c | ||
| @@ -13,16 +13,17 @@ | ||
| 13 | 13 | ** [email protected] |
| 14 | 14 | ** http://www.hwaci.com/drh/ |
| 15 | 15 | ** |
| 16 | 16 | ******************************************************************************* |
| 17 | 17 | ** |
| 18 | -** Win32 File utilities. | |
| 18 | +** This file implements several non-trivial file handling wrapper functions | |
| 19 | +** on Windows using the Win32 API. | |
| 19 | 20 | */ |
| 20 | 21 | #include "config.h" |
| 21 | 22 | #ifdef _WIN32 |
| 22 | -#include <sys/stat.h> | |
| 23 | 23 | /* This code is for win32 only */ |
| 24 | +#include <sys/stat.h> | |
| 24 | 25 | #include <windows.h> |
| 25 | 26 | #include "winfile.h" |
| 26 | 27 | |
| 27 | 28 | /* |
| 28 | 29 | ** Fill stat buf with information received from stat() or lstat(). |
| @@ -249,11 +250,11 @@ | ||
| 249 | 250 | ** If bChroot=1, do a chroot to this dir as well |
| 250 | 251 | ** (UNIX only) |
| 251 | 252 | */ |
| 252 | 253 | int win32_chdir(const char *zChDir, int bChroot){ |
| 253 | 254 | wchar_t *zPath = fossil_utf8_to_filename(zChDir); |
| 254 | - int rc = SetCurrentDirectoryW(zPath)==0; | |
| 255 | + int rc = (int)!SetCurrentDirectoryW(zPath); | |
| 255 | 256 | fossil_filename_free(zPath); |
| 256 | 257 | return rc; |
| 257 | 258 | } |
| 258 | 259 | |
| 259 | 260 | /* |
| @@ -266,14 +267,14 @@ | ||
| 266 | 267 | void win32_getcwd(char *zBuf, int nBuf){ |
| 267 | 268 | int i; |
| 268 | 269 | char *zUtf8; |
| 269 | 270 | wchar_t *zWide = fossil_malloc( sizeof(wchar_t)*nBuf ); |
| 270 | 271 | if( GetCurrentDirectoryW(nBuf, zWide)==0 ){ |
| 271 | - fossil_fatal("cannot obtain current working directory."); | |
| 272 | + fossil_fatal("cannot find current working directory."); | |
| 272 | 273 | } |
| 273 | 274 | zUtf8 = fossil_filename_to_utf8(zWide); |
| 274 | 275 | fossil_free(zWide); |
| 275 | 276 | for(i=0; zUtf8[i]; i++) if( zUtf8[i]=='\\' ) zUtf8[i] = '/'; |
| 276 | 277 | strncpy(zBuf, zUtf8, nBuf); |
| 277 | 278 | fossil_filename_free(zUtf8); |
| 278 | 279 | } |
| 279 | 280 | #endif /* _WIN32 -- This code is for win32 only */ |
| 280 | 281 |
| --- src/winfile.c | |
| +++ src/winfile.c | |
| @@ -13,16 +13,17 @@ | |
| 13 | ** [email protected] |
| 14 | ** http://www.hwaci.com/drh/ |
| 15 | ** |
| 16 | ******************************************************************************* |
| 17 | ** |
| 18 | ** Win32 File utilities. |
| 19 | */ |
| 20 | #include "config.h" |
| 21 | #ifdef _WIN32 |
| 22 | #include <sys/stat.h> |
| 23 | /* This code is for win32 only */ |
| 24 | #include <windows.h> |
| 25 | #include "winfile.h" |
| 26 | |
| 27 | /* |
| 28 | ** Fill stat buf with information received from stat() or lstat(). |
| @@ -249,11 +250,11 @@ | |
| 249 | ** If bChroot=1, do a chroot to this dir as well |
| 250 | ** (UNIX only) |
| 251 | */ |
| 252 | int win32_chdir(const char *zChDir, int bChroot){ |
| 253 | wchar_t *zPath = fossil_utf8_to_filename(zChDir); |
| 254 | int rc = SetCurrentDirectoryW(zPath)==0; |
| 255 | fossil_filename_free(zPath); |
| 256 | return rc; |
| 257 | } |
| 258 | |
| 259 | /* |
| @@ -266,14 +267,14 @@ | |
| 266 | void win32_getcwd(char *zBuf, int nBuf){ |
| 267 | int i; |
| 268 | char *zUtf8; |
| 269 | wchar_t *zWide = fossil_malloc( sizeof(wchar_t)*nBuf ); |
| 270 | if( GetCurrentDirectoryW(nBuf, zWide)==0 ){ |
| 271 | fossil_fatal("cannot obtain current working directory."); |
| 272 | } |
| 273 | zUtf8 = fossil_filename_to_utf8(zWide); |
| 274 | fossil_free(zWide); |
| 275 | for(i=0; zUtf8[i]; i++) if( zUtf8[i]=='\\' ) zUtf8[i] = '/'; |
| 276 | strncpy(zBuf, zUtf8, nBuf); |
| 277 | fossil_filename_free(zUtf8); |
| 278 | } |
| 279 | #endif /* _WIN32 -- This code is for win32 only */ |
| 280 |
| --- src/winfile.c | |
| +++ src/winfile.c | |
| @@ -13,16 +13,17 @@ | |
| 13 | ** [email protected] |
| 14 | ** http://www.hwaci.com/drh/ |
| 15 | ** |
| 16 | ******************************************************************************* |
| 17 | ** |
| 18 | ** This file implements several non-trivial file handling wrapper functions |
| 19 | ** on Windows using the Win32 API. |
| 20 | */ |
| 21 | #include "config.h" |
| 22 | #ifdef _WIN32 |
| 23 | /* This code is for win32 only */ |
| 24 | #include <sys/stat.h> |
| 25 | #include <windows.h> |
| 26 | #include "winfile.h" |
| 27 | |
| 28 | /* |
| 29 | ** Fill stat buf with information received from stat() or lstat(). |
| @@ -249,11 +250,11 @@ | |
| 250 | ** If bChroot=1, do a chroot to this dir as well |
| 251 | ** (UNIX only) |
| 252 | */ |
| 253 | int win32_chdir(const char *zChDir, int bChroot){ |
| 254 | wchar_t *zPath = fossil_utf8_to_filename(zChDir); |
| 255 | int rc = (int)!SetCurrentDirectoryW(zPath); |
| 256 | fossil_filename_free(zPath); |
| 257 | return rc; |
| 258 | } |
| 259 | |
| 260 | /* |
| @@ -266,14 +267,14 @@ | |
| 267 | void win32_getcwd(char *zBuf, int nBuf){ |
| 268 | int i; |
| 269 | char *zUtf8; |
| 270 | wchar_t *zWide = fossil_malloc( sizeof(wchar_t)*nBuf ); |
| 271 | if( GetCurrentDirectoryW(nBuf, zWide)==0 ){ |
| 272 | fossil_fatal("cannot find current working directory."); |
| 273 | } |
| 274 | zUtf8 = fossil_filename_to_utf8(zWide); |
| 275 | fossil_free(zWide); |
| 276 | for(i=0; zUtf8[i]; i++) if( zUtf8[i]=='\\' ) zUtf8[i] = '/'; |
| 277 | strncpy(zBuf, zUtf8, nBuf); |
| 278 | fossil_filename_free(zUtf8); |
| 279 | } |
| 280 | #endif /* _WIN32 -- This code is for win32 only */ |
| 281 |