comments added

This commit is contained in:
Yakov Olkhovskiy 2022-08-22 12:14:29 +00:00
parent 47d5a64f13
commit 088a969500
2 changed files with 2 additions and 0 deletions

View File

@ -287,6 +287,7 @@ int compressFiles(const char* out_name, const char* exec, char* filenames[], int
size_t nlen = strlen(names[i]) + 1;
files_data[i].name_length = htole64(nlen);
sum_file_size += nlen;
/// if no --exec is specified nor it's empty - file which is matching output name is executable
if (!is_exec && !exec && strcmp(names[i], out_name) == 0)
files_data[i].exec = true;

View File

@ -226,6 +226,7 @@ int decompressFiles(int input_fd, char * path, char * name, bool & have_compress
file_info = *reinterpret_cast<FileData*>(input + files_pointer);
files_pointer += sizeof(FileData);
/// for output filename matching compressed allow additional 13 + 7 symbols for ".decompressed.XXXXXX" suffix
size_t file_name_len = file_info.exec ? strlen(name) + 13 + 7 + 1 : le64toh(file_info.name_length);
size_t file_path_len = path ? strlen(path) + 1 + file_name_len : file_name_len;