Fix warnings in liblrzip_demo.c

This commit is contained in:
Con Kolivas 2021-02-16 11:54:56 +11:00
parent 2f5c9c083e
commit 321c9ce93e

View file

@ -317,16 +317,17 @@ int main(int argc, char *argv[])
if (!lrzip_files_count(lr)) lrzip_file_add(lr, stdin); if (!lrzip_files_count(lr)) lrzip_file_add(lr, stdin);
if (lrzip_filenames_count(lr)) { if (lrzip_filenames_count(lr)) {
if (!lrzip_outfilename_get(lr)) { if (!lrzip_outfilename_get(lr)) {
char buf[4096]; char *buf;
const char *infile; const char *infile;
size_t len; size_t len;
infile = lrzip_filenames_get(lr)[0]; infile = lrzip_filenames_get(lr)[0];
len = strlen(infile); len = strlen(infile);
buf = alloca(len + 8);
if (!strcmp(infile + len - 4, ".lrz")) if (!strcmp(infile + len - 4, ".lrz"))
strncat(buf, infile, len - 4); strcat(buf, infile);
else else
snprintf(buf, sizeof(buf), "%s.out", infile); sprintf(buf, "%s.out", infile);
lrzip_outfilename_set(lr, buf); lrzip_outfilename_set(lr, buf);
} }
} else if (!lrzip_outfile_get(lr)) lrzip_outfile_set(lr, stdout); } else if (!lrzip_outfile_get(lr)) lrzip_outfile_set(lr, stdout);