瀏覽代碼

muted some compiler warnings for clang

Evgeny Grin (Karlson2k) 3 年之前
父節點
當前提交
6933158a95
共有 2 個文件被更改,包括 4 次插入5 次删除
  1. 3 4
      src/examples/http_chunked_compression.c
  2. 1 1
      src/microhttpd/mhd_str.c

+ 3 - 4
src/examples/http_chunked_compression.c

@@ -88,7 +88,7 @@ compress_buf (z_stream *strm, const void *src, size_t src_size, size_t *offset,
     {
       strm->avail_out = CHUNK;
       strm->next_out = tmp;
-      ret = deflate (strm, flush);
+      ret = (Z_OK == deflate (strm, flush)) ? MHD_YES : MHD_NO;
       have = CHUNK - strm->avail_out;
       *dest_size += have;
       tmp_dest = realloc (*dest, *dest_size);
@@ -104,7 +104,7 @@ compress_buf (z_stream *strm, const void *src, size_t src_size, size_t *offset,
     while (0 == strm->avail_out);
   }
   while (flush != Z_SYNC_FLUSH);
-  return (Z_OK == ret) ? MHD_YES : MHD_NO;
+  return ret;
 }
 
 
@@ -183,8 +183,7 @@ ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const
   holder->file = fopen (__FILE__, "rb");
   if (NULL == holder->file)
     goto file_error;
-  ret = deflateInit (&holder->stream, Z_BEST_COMPRESSION);
-  if (ret != Z_OK)
+  if (Z_OK != deflateInit (&holder->stream, Z_BEST_COMPRESSION))
     goto stream_error;
   holder->buf = malloc (CHUNK);
   if (NULL == holder->buf)

+ 1 - 1
src/microhttpd/mhd_str.c

@@ -1428,7 +1428,7 @@ MHD_hex_to_bin (const char *hex,
     const int l = toxdigitvalue (hex[r++]);
     if ((0 > h) || (0 > l))
       return 0;
-    out[w++] = ( (((uint8_t) ((unsigned int) h)) << 4)
+    out[w++] = ( ((uint8_t) (((uint8_t) ((unsigned int) h)) << 4))
                  | ((uint8_t) ((unsigned int) l)) );
   }
   mhd_assert (len == r);