summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2016-11-22 00:42:23 (GMT)
committerYann Collet <cyan@fb.com>2016-11-22 00:42:23 (GMT)
commit8875e7dbb56e16b5bb30de731c87f4e24b6d43ba (patch)
tree092340d6a16deb7fd7cd40f1db270d3bdbb0cbd8 /examples
parent8b233b228dbda484d1d545c5a3ecaf06aef3e930 (diff)
downloadlz4-8875e7dbb56e16b5bb30de731c87f4e24b6d43ba.zip
lz4-8875e7dbb56e16b5bb30de731c87f4e24b6d43ba.tar.gz
lz4-8875e7dbb56e16b5bb30de731c87f4e24b6d43ba.tar.bz2
fix minor analyzer warning
Diffstat (limited to 'examples')
-rw-r--r--examples/frameCompress.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/examples/frameCompress.c b/examples/frameCompress.c
index df41451..75f1576 100644
--- a/examples/frameCompress.c
+++ b/examples/frameCompress.c
@@ -189,7 +189,6 @@ static size_t decompress_file(FILE *in, FILE *out) {
printf("Writing %zu bytes\n", dstSize);
if (written != dstSize) {
printf("Decompress: Failed to write to file\n");
- ret = 1;
goto cleanup;
}
}
@@ -210,9 +209,8 @@ static size_t decompress_file(FILE *in, FILE *out) {
cleanup:
free(src);
- if (dst) free(dst);
- if (dctx) ret = LZ4F_freeDecompressionContext(dctx);
- return ret;
+ free(dst);
+ return LZ4F_freeDecompressionContext(dctx); /* note : free works on NULL */
}
int compare(FILE* fp0, FILE* fp1)
@@ -238,7 +236,7 @@ int compare(FILE* fp0, FILE* fp1)
return result;
}
-int main(int argc, char **argv) {
+int main(int argc, const char **argv) {
char inpFilename[256] = { 0 };
char lz4Filename[256] = { 0 };
char decFilename[256] = { 0 };
@@ -257,9 +255,8 @@ int main(int argc, char **argv) {
printf("dec = [%s]\n", decFilename);
/* compress */
- {
- FILE* inpFp = fopen(inpFilename, "rb");
- FILE* outFp = fopen(lz4Filename, "wb");
+ { FILE* const inpFp = fopen(inpFilename, "rb");
+ FILE* const outFp = fopen(lz4Filename, "wb");
size_t sizeIn = 0;
size_t sizeOut = 0;
size_t ret;
@@ -280,9 +277,8 @@ int main(int argc, char **argv) {
}
/* decompress */
- {
- FILE* inpFp = fopen(lz4Filename, "rb");
- FILE* outFp = fopen(decFilename, "wb");
+ { FILE* const inpFp = fopen(lz4Filename, "rb");
+ FILE* const outFp = fopen(decFilename, "wb");
size_t ret;
printf("decompress : %s -> %s\n", lz4Filename, decFilename);
@@ -298,9 +294,8 @@ int main(int argc, char **argv) {
}
/* verify */
- {
- FILE* inpFp = fopen(inpFilename, "rb");
- FILE* decFp = fopen(decFilename, "rb");
+ { FILE* const inpFp = fopen(inpFilename, "rb");
+ FILE* const decFp = fopen(decFilename, "rb");
printf("verify : %s <-> %s\n", inpFilename, decFilename);
const int cmp = compare(inpFp, decFp);