clang tidy suggestions

This commit is contained in:
Yakov Olkhovskiy 2022-07-21 10:27:56 -04:00
parent 15496c63b9
commit c8ea6783dc

View File

@ -363,7 +363,14 @@ int copy_decompressor_self(const char *self, int output_fd)
return 1; return 1;
} }
int decompressor_size = atoi(size_str); char * end = nullptr;
int decompressor_size = strtol(size_str, &end, 10);
if (*end != 0)
{
std::cerr << "Error: unable to extract decompressor" << std::endl;
close(input_fd);
return 1;
}
if (-1 == lseek(input_fd, -(decompressor_size + 15), SEEK_END)) if (-1 == lseek(input_fd, -(decompressor_size + 15), SEEK_END))
{ {
@ -407,7 +414,7 @@ int copy_decompressor_file(const char *path, int output_fd)
inline void usage(FILE * out, const char * name) inline void usage(FILE * out, const char * name)
{ {
fprintf(out, (void)fprintf(out,
"%s [--level=<level>] [--decompressor=<path>] <output_file> <input_file> [... <input_file>]\n" "%s [--level=<level>] [--decompressor=<path>] <output_file> <input_file> [... <input_file>]\n"
"\t--level - compression level, max is %d, negative - prefer speed over compression\n" "\t--level - compression level, max is %d, negative - prefer speed over compression\n"
"\t default is 5\n" "\t default is 5\n"