]> Sergey Matveev's repositories - tofuproxy.git/commitdiff
Remove redundant ";"
authorSergey Matveev <stargrave@stargrave.org>
Fri, 17 Dec 2021 14:45:02 +0000 (17:45 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 17 Dec 2021 14:50:17 +0000 (17:50 +0300)
cmd/zstd/enzstd.c
cmd/zstd/unzstd.c

index fa63e3682a5e19f9b459ee488f9e97c1c9965d69..33f0b8d791a3b85d7fef949a8f94b414b92f7748 100644 (file)
@@ -36,17 +36,17 @@ main(int argc, char **argv)
     if (ctx == NULL) {
         fputs("can not initialize ZSTD_createCCtx\n", stderr);
         return EXIT_FAILURE;
-    };
+    }
     size_t zCode = ZSTD_CCtx_setParameter(ctx, ZSTD_c_checksumFlag, 1);
     if (ZSTD_isError(zCode)) {
         fprintf(stderr, "can not setParameter: %s\n", ZSTD_getErrorName(zCode));
         return EXIT_FAILURE;
-    };
+    }
     zCode = ZSTD_CCtx_setParameter(ctx, ZSTD_c_compressionLevel, ZSTD_maxCLevel());
     if (ZSTD_isError(zCode)) {
         fprintf(stderr, "can not setParameter: %s\n", ZSTD_getErrorName(zCode));
         return EXIT_FAILURE;
-    };
+    }
 
     char *src      = NULL;
     char *dst      = NULL;
@@ -56,7 +56,7 @@ main(int argc, char **argv)
     if (src == NULL) {
         fprintf(stderr, "can not allocate memory: %zu\n", srcSize);
         goto Exit;
-    };
+    }
     size_t dstSize     = 0;
     size_t srcWantSize = 0;
     size_t dstWantSize = 0;
@@ -66,10 +66,10 @@ main(int argc, char **argv)
         if (n < 8) {
             if (feof(stdin)) {
                 break;
-            };
+            }
             perror("can not fread(stdin)");
             goto Exit;
-        };
+        }
         srcWantSize = (size_t)be64dec(src);
         if (srcWantSize > srcSize) {
             free(src);
@@ -78,13 +78,13 @@ main(int argc, char **argv)
             if (src == NULL) {
                 fprintf(stderr, "can not allocate memory: %zu\n", srcSize);
                 goto Exit;
-            };
-        };
+            }
+        }
         n = fread(src, 1, srcWantSize, stdin);
         if (n < srcWantSize) {
             fputs("insufficient data fed\n", stderr);
             goto Exit;
-        };
+        }
         dstWantSize = ZSTD_compressBound(srcWantSize);
         if (dstWantSize > dstSize) {
             free(dst);
@@ -93,19 +93,19 @@ main(int argc, char **argv)
             if (dst == NULL) {
                 fprintf(stderr, "can not allocate memory: %zu\n", dstSize);
                 goto Exit;
-            };
-        };
+            }
+        }
         zCode = ZSTD_compress2(ctx, dst, dstSize, src, srcWantSize);
         if (ZSTD_isError(zCode)) {
             fprintf(stderr, "can not compress: %s\n", ZSTD_getErrorName(zCode));
             goto Exit;
-        };
+        }
         n = fwrite(dst, 1, zCode, stdout);
         if (n < zCode) {
             perror("can not fwrite(stdout)");
             goto Exit;
-        };
-    };
+        }
+    }
     rc = EXIT_SUCCESS;
 
 Exit:
@@ -113,4 +113,4 @@ Exit:
     free(src);
     ZSTD_freeCCtx(ctx);
     return rc;
-};
+}
index dda5aa4afcb872486e9a95c7fa94d9090b03b597..1ecbbda182799bc7e930d99e4415c8b898806598 100644 (file)
@@ -41,7 +41,7 @@ main(int argc, char **argv)
 #ifdef __FreeBSD__
     if ((fdOff != NULL) && (caph_limit_stream(3, CAPH_WRITE)) != 0) {
         errx(EX_OSERR, "can not caph_limit_stream(3)");
-    };
+    }
     capsicum_start();
 #endif // __FreeBSD__
 
@@ -49,7 +49,7 @@ main(int argc, char **argv)
     if (ctx == NULL) {
         fputs("can not initialize ZSTD_DCtx\n", stderr);
         return 1;
-    };
+    }
     int rc                 = EXIT_FAILURE;
     char *bufIn            = NULL;
     char *bufOut           = NULL;
@@ -58,13 +58,13 @@ main(int argc, char **argv)
     if (bufIn == NULL) {
         fputs("no memory\n", stderr);
         goto Exit;
-    };
+    }
     const size_t bufOutSize = ZSTD_DStreamOutSize();
     bufOut                  = malloc(bufOutSize);
     if (bufOut == NULL) {
         fputs("no memory\n", stderr);
         goto Exit;
-    };
+    }
 
     unsigned long long bufSize = 0;
 
@@ -87,8 +87,8 @@ ReadAgain:
             } else {
                 perror("can not fread(FILE)");
                 goto Exit;
-            };
-        };
+            }
+        }
         if (n >= 8 && le32dec(bufIn) == 0x184D2A5D) {
             // dictionary frame
             size_t dictSize = (size_t)le32dec(bufIn + 4);
@@ -96,7 +96,7 @@ ReadAgain:
             if (dict == NULL) {
                 fprintf(stderr, "insufficient memory for dictionary: %zu\n", dictSize);
                 goto Exit;
-            };
+            }
             const size_t alreadyRead = n - 8;
             memcpy(dict, bufIn + 8, alreadyRead);
             errno = 0;
@@ -105,12 +105,12 @@ ReadAgain:
                 perror("can not read dictionary data");
                 free(dict);
                 goto Exit;
-            };
+            }
             offset     = dictSize + 8;
             offsetPrev = offset;
             if (fdOff != NULL) {
                 fprintf(fdOff, "%zu\t0\n", offset);
-            };
+            }
             uint32_t hdr = le32dec(dict);
             switch (hdr) {
             case ZSTD_MAGIC_DICTIONARY:
@@ -122,7 +122,7 @@ ReadAgain:
                         "can not load dictionary: %s\n",
                         ZSTD_getErrorName(zCode));
                     goto Exit;
-                };
+                }
                 goto ReadAgain;
             case ZSTD_MAGICNUMBER:
                 bufSize = ZSTD_getFrameContentSize(dict, dictSize);
@@ -132,14 +132,14 @@ ReadAgain:
                     fprintf(stderr, "can not determine dictionary's size\n");
                     free(dict);
                     goto Exit;
-                };
+                }
                 char *buf = malloc(bufSize);
                 if (buf == NULL) {
                     fprintf(
                         stderr, "insufficient memory for dictionary: %llu\n", bufSize);
                     free(dict);
                     goto Exit;
-                };
+                }
                 zCode = ZSTD_decompress(buf, bufSize, dict, dictSize);
                 free(dict);
                 if (ZSTD_isError(zCode)) {
@@ -149,7 +149,7 @@ ReadAgain:
                         ZSTD_getErrorName(zCode));
                     free(buf);
                     goto Exit;
-                };
+                }
                 zCode = ZSTD_DCtx_loadDictionary(ctx, buf, zCode);
                 free(buf);
                 if ((zCode != 0) && (ZSTD_isError(zCode))) {
@@ -158,14 +158,14 @@ ReadAgain:
                         "can not load dictionary: %s\n",
                         ZSTD_getErrorName(zCode));
                     goto Exit;
-                };
+                }
                 goto ReadAgain;
             default:
                 fprintf(stderr, "unknown dictionary header\n");
                 free(dict);
                 goto Exit;
-            };
-        };
+            }
+        }
         isEmpty  = false;
         bIn.size = n;
         bIn.pos  = 0;
@@ -176,49 +176,49 @@ ReadAgain:
             if ((zCode != 0) && (ZSTD_isError(zCode))) {
                 fprintf(stderr, "can not decompress: %s\n", ZSTD_getErrorName(zCode));
                 goto Exit;
-            };
+            }
             n = fwrite(bufOut, 1, bOut.pos, stdout);
             if (n != bOut.pos) {
                 perror("can not fwrite(stdout)");
                 goto Exit;
-            };
+            }
             written += n;
             if (zCode == 0) {
                 offset += bIn.pos;
                 if (fdOff != NULL) {
                     fprintf(fdOff, "%zu\t%zu\n", offset - offsetPrev, written);
-                };
+                }
                 offsetPrev = offset + bIn.pos;
                 written    = 0;
-            };
-        };
+            }
+        }
         if (lastBlock) {
             break;
-        };
+        }
         offset += bIn.pos;
-    };
+    }
 
     if (isEmpty) {
         fputs("empty input\n", stderr);
         goto Exit;
-    };
+    }
     if (zCode != 0) {
         fprintf(stderr, "unfinished decompression: %s\n", ZSTD_getErrorName(zCode));
         goto Exit;
-    };
+    }
     rc = EXIT_SUCCESS;
 
 Exit:
     if (bufOut != NULL) {
         free(bufOut);
-    };
+    }
     if (bufIn != NULL) {
         free(bufIn);
-    };
+    }
     ZSTD_freeDCtx(ctx);
     if ((fdOff != NULL) && (fclose(fdOff) != 0)) {
         perror("can not fclose(4)");
         return EXIT_FAILURE;
-    };
+    }
     return rc;
-};
+}