diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2013-03-24 15:18:02 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2013-03-24 16:09:08 -0700 |
commit | e9f0b78443884bfd88ead7235bcf5a6a1adae5cd (patch) | |
tree | 05561b485bbc8fe51a56634590d8eac025a247a5 /gzlib.c | |
parent | 0aac8cf7c4da2572609d177657fb5f947bf38cd2 (diff) | |
download | zlib-e9f0b78443884bfd88ead7235bcf5a6a1adae5cd.tar.gz |
Add casts and consts to ease user conversion to C++.
You would still need to run zlib2ansi on all of the *.c files.
Diffstat (limited to 'gzlib.c')
-rw-r--r-- | gzlib.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -108,7 +108,7 @@ local gzFile gz_open(path, fd, mode) return NULL; /* allocate gzFile structure to return */ - state = malloc(sizeof(gz_state)); + state = (gz_statep)malloc(sizeof(gz_state)); if (state == NULL) return NULL; state->size = 0; /* no buffers allocated yet */ @@ -196,8 +196,8 @@ local gzFile gz_open(path, fd, mode) } else #endif - len = strlen(path); - state->path = malloc(len + 1); + len = strlen((const char *)path); + state->path = (char *)malloc(len + 1); if (state->path == NULL) { free(state); return NULL; @@ -242,7 +242,7 @@ local gzFile gz_open(path, fd, mode) #ifdef _WIN32 fd == -2 ? _wopen(path, oflag, 0666) : #endif - open(path, oflag, 0666)); + open((const char *)path, oflag, 0666)); if (state->fd == -1) { free(state->path); free(state); @@ -288,7 +288,7 @@ gzFile ZEXPORT gzdopen(fd, mode) char *path; /* identifier for error messages */ gzFile gz; - if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL) + if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL) return NULL; #if !defined(NO_snprintf) && !defined(NO_vsnprintf) snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd); /* for debugging */ @@ -598,7 +598,8 @@ void ZLIB_INTERNAL gz_error(state, err, msg) return; /* construct error message with path */ - if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) { + if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) == + NULL) { state->err = Z_MEM_ERROR; return; } |