diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-05-22 09:57:18 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-05-22 09:57:18 +0000 |
commit | 03f0e46d6f41fab84c927eb6b340df6afd030410 (patch) | |
tree | 779ebbf742d286af19f03b55015607ccbe464fcb /wsutil | |
parent | 2a2dc8c5f32799706c9ac9fc6b3b0a7020a4b65e (diff) |
Update comments to reflect that the GLib version is no longer relevant
(we require GLib 2.14 or later, and always use UTF-8 for pathnames on
Windows), to note that ws_stdio_rename() should have UN*X-style
rename semantics in that it removes the target if necessary, and to give
more details in other ways.
Clean up indetation a bit.
svn path=/trunk/; revision=42775
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/file_util.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/wsutil/file_util.h b/wsutil/file_util.h index e50cf73708..6c926230ec 100644 --- a/wsutil/file_util.h +++ b/wsutil/file_util.h @@ -48,9 +48,19 @@ extern "C" { */ #define ws_statb64 struct _stat64 -/* Win32: Since GLib2.6, we use UTF8 throughout the code, so file functions - * must tweak a given filename from UTF8 to UTF16 as we use NT Unicode (Win9x - * - now unsupported - used locale based encoding here). +/* Win32 (and Win64): we use UTF-8 for filenames and pathnames throughout + * the code, so file functions must convert filenames and pathnames from + * UTF-8 to UTF-16 as we use NT Unicode (Win9x - now unsupported - used + * locale-based encoding here). Microsoft's UN*X-style wrappers don't + * do that - they expect locale-based encodings - so we need our own + * wrappers. (We don't use the wrappers from GLib as that would, at + * least for the wrappers that return file descriptors or take them + * as arguments, require that we use the version of the C runtime with + * which the GLib binaries were built, and we can't guarantee to do that.) + * + * Note also that ws_stdio_rename() uses MoveFileEx() with + * MOVEFILE_REPLACE_EXISTING, so that it acts like UN*X rename(), + * removing the target if necessary. */ #include <stdio.h> @@ -75,8 +85,8 @@ extern FILE * ws_stdio_freopen (const gchar *filename, const gchar *mode, FILE * #define ws_freopen ws_stdio_freopen /* - * These routines don't take pathnames, so they're the same regardless - * of what version of GLib we have. + * These routines don't take pathnames, so they don't require + * pathname-converting wrappers on Windows. */ #define ws_read _read #define ws_write _write @@ -148,7 +158,7 @@ extern char *getenv_utf8(const char *varname); #define WS_DIRENT const char #define ws_dir_open g_dir_open #define ws_dir_read_name g_dir_read_name -#define ws_dir_get_name(dirent) dirent +#define ws_dir_get_name(dirent) dirent #define ws_dir_rewind g_dir_rewind #define ws_dir_close g_dir_close |