Avoid warnings on snprintf() return value.

This commit is contained in:
Mark Adler 2017-01-01 12:23:04 -08:00
parent 20e472546e
commit 7358ef23c2

View File

@ -211,7 +211,7 @@ local gzFile gz_open(path, fd, mode)
else else
#endif #endif
#if !defined(NO_snprintf) && !defined(NO_vsnprintf) #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(state->path, len + 1, "%s", (const char *)path); (void)snprintf(state->path, len + 1, "%s", (const char *)path);
#else #else
strcpy(state->path, path); strcpy(state->path, path);
#endif #endif
@ -293,7 +293,7 @@ gzFile ZEXPORT gzdopen(fd, mode)
if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL) if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
return NULL; return NULL;
#if !defined(NO_snprintf) && !defined(NO_vsnprintf) #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd); /* for debugging */ (void)snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd);
#else #else
sprintf(path, "<fd:%d>", fd); /* for debugging */ sprintf(path, "<fd:%d>", fd); /* for debugging */
#endif #endif
@ -608,8 +608,8 @@ void ZLIB_INTERNAL gz_error(state, err, msg)
return; return;
} }
#if !defined(NO_snprintf) && !defined(NO_vsnprintf) #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(state->msg, strlen(state->path) + strlen(msg) + 3, (void)snprintf(state->msg, strlen(state->path) + strlen(msg) + 3,
"%s%s%s", state->path, ": ", msg); "%s%s%s", state->path, ": ", msg);
#else #else
strcpy(state->msg, state->path); strcpy(state->msg, state->path);
strcat(state->msg, ": "); strcat(state->msg, ": ");