Fossil SCM

Improve comments. Style and consistency fixes.

mistachkin 2013-12-14 01:54 UTC win32File
Commit d1b7c8765057e1d12289bea85646d92496c1bc8c
1 file changed +5 -4
+5 -4
--- src/winfile.c
+++ src/winfile.c
@@ -13,16 +13,17 @@
1313
** [email protected]
1414
** http://www.hwaci.com/drh/
1515
**
1616
*******************************************************************************
1717
**
18
-** Win32 File utilities.
18
+** This file implements several non-trivial file handling wrapper functions
19
+** on Windows using the Win32 API.
1920
*/
2021
#include "config.h"
2122
#ifdef _WIN32
22
-#include <sys/stat.h>
2323
/* This code is for win32 only */
24
+#include <sys/stat.h>
2425
#include <windows.h>
2526
#include "winfile.h"
2627
2728
/*
2829
** Fill stat buf with information received from stat() or lstat().
@@ -249,11 +250,11 @@
249250
** If bChroot=1, do a chroot to this dir as well
250251
** (UNIX only)
251252
*/
252253
int win32_chdir(const char *zChDir, int bChroot){
253254
wchar_t *zPath = fossil_utf8_to_filename(zChDir);
254
- int rc = SetCurrentDirectoryW(zPath)==0;
255
+ int rc = (int)!SetCurrentDirectoryW(zPath);
255256
fossil_filename_free(zPath);
256257
return rc;
257258
}
258259
259260
/*
@@ -266,14 +267,14 @@
266267
void win32_getcwd(char *zBuf, int nBuf){
267268
int i;
268269
char *zUtf8;
269270
wchar_t *zWide = fossil_malloc( sizeof(wchar_t)*nBuf );
270271
if( GetCurrentDirectoryW(nBuf, zWide)==0 ){
271
- fossil_fatal("cannot obtain current working directory.");
272
+ fossil_fatal("cannot find current working directory.");
272273
}
273274
zUtf8 = fossil_filename_to_utf8(zWide);
274275
fossil_free(zWide);
275276
for(i=0; zUtf8[i]; i++) if( zUtf8[i]=='\\' ) zUtf8[i] = '/';
276277
strncpy(zBuf, zUtf8, nBuf);
277278
fossil_filename_free(zUtf8);
278279
}
279280
#endif /* _WIN32 -- This code is for win32 only */
280281
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button