]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Small formatting changes in inflate.c, inflate.h and inffast.c
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Sun, 18 Oct 2020 15:31:51 +0000 (17:31 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 24 Oct 2020 13:51:46 +0000 (15:51 +0200)
inffast.c
inflate.c
inflate.h

index f85a37e274ec4be79b2f69710bb4ccb00d793ec2..18ce570e9caf883c77bd962f5c935b7617b15d1a 100644 (file)
--- a/inffast.c
+++ b/inffast.c
@@ -260,11 +260,10 @@ void Z_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start) {
                         out = functable.chunkcopy_safe(out, from, len, safe);
                     }
                 } else {
-                    /* Whole reference is in range of current output.  No
-                       range checks are necessary because we start with room
-                       for at least 258 bytes of output, so unroll and roundoff
-                       operations can write beyond `out+len` so long as they
-                       stay within 258 bytes of `out`.
+                    /* Whole reference is in range of current output.  No range checks are
+                       necessary because we start with room for at least 258 bytes of output,
+                       so unroll and roundoff operations can write beyond `out+len` so long
+                       as they stay within 258 bytes of `out`.
                     */
                     if (dist >= len || dist >= state->chunksize)
                         out = functable.chunkcopy(out, out - dist, len);
@@ -300,12 +299,10 @@ void Z_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start) {
     /* update state and return */
     strm->next_in = in;
     strm->next_out = out;
-    strm->avail_in =
-        (unsigned)(in < last ? (INFLATE_FAST_MIN_HAVE - 1) + (last - in)
-                             : (INFLATE_FAST_MIN_HAVE - 1) - (in - last));
-    strm->avail_out =
-        (unsigned)(out < end ? (INFLATE_FAST_MIN_LEFT - 1) + (end - out)
-                             : (INFLATE_FAST_MIN_LEFT - 1) - (out - end));
+    strm->avail_in = (unsigned)(in < last ? (INFLATE_FAST_MIN_HAVE - 1) + (last - in)
+                                          : (INFLATE_FAST_MIN_HAVE - 1) - (in - last));
+    strm->avail_out = (unsigned)(out < end ? (INFLATE_FAST_MIN_LEFT - 1) + (end - out)
+                                           : (INFLATE_FAST_MIN_LEFT - 1) - (out - end));
 
     Assert(bits <= 32, "Remaining bits greater than 32");
     state->hold = (uint32_t)hold;
index faf72abcda9ba802b9c7ffb9f57d672d80055c32..5c30816ddfd53a687da8765b3059323d088e24aa 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -505,8 +505,7 @@ int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) {
                 if (copy > have)
                     copy = have;
                 if (copy) {
-                    if (state->head != NULL &&
-                        state->head->extra != NULL) {
+                    if (state->head != NULL && state->head->extra != NULL) {
                         len = state->head->extra_len - state->length;
                         memcpy(state->head->extra + len, next,
                                 len + copy > state->head->extra_max ?
@@ -798,8 +797,7 @@ int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) {
 
         case LEN:
             /* use inflate_fast() if we have enough input and output */
-            if (have >= INFLATE_FAST_MIN_HAVE &&
-                left >= INFLATE_FAST_MIN_LEFT) {
+            if (have >= INFLATE_FAST_MIN_HAVE && left >= INFLATE_FAST_MIN_LEFT) {
                 RESTORE();
                 zng_inflate_fast(strm, out);
                 LOAD();
@@ -1151,8 +1149,7 @@ int32_t Z_EXPORT PREFIX(inflateGetHeader)(PREFIX3(stream) *strm, PREFIX(gz_heade
    zero for the first call.
  */
 static uint32_t syncsearch(uint32_t *have, const uint8_t *buf, uint32_t len) {
-    uint32_t got;
-    uint32_t next;
+    uint32_t got, next;
 
     got = *have;
     next = 0;
@@ -1252,13 +1249,12 @@ int32_t Z_EXPORT PREFIX(inflateCopy)(PREFIX3(stream) *dest, PREFIX3(stream) *sou
     state = (struct inflate_state *)source->state;
 
     /* allocate space */
-    copy = (struct inflate_state *)
-           ZALLOC_STATE(source, 1, sizeof(struct inflate_state));
+    copy = (struct inflate_state *)ZALLOC_STATE(source, 1, sizeof(struct inflate_state));
     if (copy == NULL)
         return Z_MEM_ERROR;
     window = NULL;
     if (state->window != NULL) {
-        window = (unsigned char *) ZALLOC_WINDOW(source, 1U << state->wbits, sizeof(unsigned char));
+        window = (unsigned char *)ZALLOC_WINDOW(source, 1U << state->wbits, sizeof(unsigned char));
         if (window == NULL) {
             ZFREE_STATE(source, copy);
             return Z_MEM_ERROR;
index aa8a42a085432290890b6cb014b25dc58a14d970..a427494659146e53194263bb8a4d576df55aeae8 100644 (file)
--- a/inflate.h
+++ b/inflate.h
 #ifndef INFLATE_H_
 #define INFLATE_H_
 
-/* define NO_GZIP when compiling if you want to disable gzip header and
-   trailer decoding by inflate().  NO_GZIP would be used to avoid linking in
-   the crc code when it is not needed.  For shared libraries, gzip decoding
-   should be left enabled. */
+/* define NO_GZIP when compiling if you want to disable gzip header and trailer decoding by inflate().
+   NO_GZIP would be used to avoid linking in the crc code when it is not needed.
+   For shared libraries, gzip decoding should be left enabled. */
 #ifndef NO_GZIP
 #  define GUNZIP
 #endif