diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2012-03-18 09:29:44 -0700 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2012-03-18 09:29:44 -0700 |
| commit | 8e16df2c3f0dbe0f8a819e1913562073cf721636 (patch) | |
| tree | 1c91e0b2ccc16ad31c941f5ecfd063776a1bf30d | |
| parent | a1af6e96e35dfc3adfa2acba01883c14115f1090 (diff) | |
| download | zlib-8e16df2c3f0dbe0f8a819e1913562073cf721636.tar.gz zlib-8e16df2c3f0dbe0f8a819e1913562073cf721636.tar.bz2 zlib-8e16df2c3f0dbe0f8a819e1913562073cf721636.zip | |
More fixes for gzopen_w().
Also need to #include <stddef.h> for zlib.h, and need to workaround
the inability to use wide characters in constructed error messages
with zlib's interface.
| -rw-r--r-- | gzlib.c | 5 | ||||
| -rw-r--r-- | zconf.h | 4 | ||||
| -rw-r--r-- | zconf.h.cmakein | 4 | ||||
| -rw-r--r-- | zconf.h.in | 4 |
4 files changed, 15 insertions, 2 deletions
| @@ -185,12 +185,13 @@ local gzFile gz_open(path, fd, mode) | |||
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | /* save the path name for error messages */ | 187 | /* save the path name for error messages */ |
| 188 | state->path = malloc(strlen(path) + 1); | 188 | # define WPATH "<widepath>" |
| 189 | state->path = malloc(strlen(fd == -2 ? WPATH : (path) + 1); | ||
| 189 | if (state->path == NULL) { | 190 | if (state->path == NULL) { |
| 190 | free(state); | 191 | free(state); |
| 191 | return NULL; | 192 | return NULL; |
| 192 | } | 193 | } |
| 193 | strcpy(state->path, path); | 194 | strcpy(state->path, fd == -2 ? WPATH : path); |
| 194 | 195 | ||
| 195 | /* compute the flags for open() */ | 196 | /* compute the flags for open() */ |
| 196 | oflag = | 197 | oflag = |
| @@ -402,6 +402,10 @@ typedef uLong FAR uLongf; | |||
| 402 | # endif | 402 | # endif |
| 403 | #endif | 403 | #endif |
| 404 | 404 | ||
| 405 | #ifdef _WIN32 | ||
| 406 | # include <stddef.h> /* for wchar_t */ | ||
| 407 | #endif | ||
| 408 | |||
| 405 | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and | 409 | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and |
| 406 | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even | 410 | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even |
| 407 | * though the former does not conform to the LFS document), but considering | 411 | * though the former does not conform to the LFS document), but considering |
diff --git a/zconf.h.cmakein b/zconf.h.cmakein index 66368ad..4ade487 100644 --- a/zconf.h.cmakein +++ b/zconf.h.cmakein | |||
| @@ -404,6 +404,10 @@ typedef uLong FAR uLongf; | |||
| 404 | # endif | 404 | # endif |
| 405 | #endif | 405 | #endif |
| 406 | 406 | ||
| 407 | #ifdef _WIN32 | ||
| 408 | # include <stddef.h> /* for wchar_t */ | ||
| 409 | #endif | ||
| 410 | |||
| 407 | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and | 411 | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and |
| 408 | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even | 412 | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even |
| 409 | * though the former does not conform to the LFS document), but considering | 413 | * though the former does not conform to the LFS document), but considering |
| @@ -402,6 +402,10 @@ typedef uLong FAR uLongf; | |||
| 402 | # endif | 402 | # endif |
| 403 | #endif | 403 | #endif |
| 404 | 404 | ||
| 405 | #ifdef _WIN32 | ||
| 406 | # include <stddef.h> /* for wchar_t */ | ||
| 407 | #endif | ||
| 408 | |||
| 405 | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and | 409 | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and |
| 406 | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even | 410 | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even |
| 407 | * though the former does not conform to the LFS document), but considering | 411 | * though the former does not conform to the LFS document), but considering |
