Skip to content
Snippets Groups Projects
Commit 024319d6 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Speed up list_archive_contents()

Don't use iniSet* since we know we're not updating existing ini entries. Use strListAppendFormat() instead.
parent 498187eb
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2155 passed
...@@ -764,12 +764,13 @@ str_list_t list_archive_contents(const char* filename, const char* pattern, bool ...@@ -764,12 +764,13 @@ str_list_t list_archive_contents(const char* filename, const char* pattern, bool
continue; continue;
} }
iniSetString(&list, pathname, "type", type, /* style: */NULL); strListAppendFormat(&list, "[%s]", pathname);
iniSetBytes(&list, pathname, "size", 1, archive_entry_size(entry), /* style: */NULL); strListAppendFormat(&list, "type=%s", type);
iniSetDateTime(&list, pathname, "time", true, archive_entry_mtime(entry), NULL); strListAppendFormat(&list, "size=%"PRId64, archive_entry_size(entry));
iniSetInteger(&list, pathname, "mode", archive_entry_mode(entry), NULL); strListAppendFormat(&list, "time=%"PRId64,archive_entry_mtime(entry));
iniSetString(&list, pathname, "format", archive_format_name(ar), NULL); strListAppendFormat(&list, "mode=%d", archive_entry_mode(entry));
iniSetString(&list, pathname, "compression", archive_filter_name(ar, 0), NULL); strListAppendFormat(&list, "format=%s", archive_format_name(ar));
strListAppendFormat(&list, "compression=%s", archive_filter_name(ar, 0));
if(hash && archive_entry_filetype(entry) == AE_IFREG) { if(hash && archive_entry_filetype(entry) == AE_IFREG) {
MD5 md5_ctx; MD5 md5_ctx;
...@@ -795,10 +796,10 @@ str_list_t list_archive_contents(const char* filename, const char* pattern, bool ...@@ -795,10 +796,10 @@ str_list_t list_archive_contents(const char* filename, const char* pattern, bool
} }
MD5_close(&md5_ctx, md5); MD5_close(&md5_ctx, md5);
SHA1Final(&sha1_ctx, sha1); SHA1Final(&sha1_ctx, sha1);
iniSetHexInt(&list, pathname, "crc32", crc32, NULL); strListAppendFormat(&list, "crc32=0x%lx", crc32);
char hex[128]; char hex[128];
iniSetString(&list, pathname, "md5", MD5_hex(hex, md5), NULL); strListAppendFormat(&list, "md5=%s", MD5_hex(hex, md5));
iniSetString(&list, pathname, "sha1", SHA1_hex(hex, sha1), NULL); strListAppendFormat(&list, "sha1=%s", SHA1_hex(hex, sha1));
} }
} }
archive_read_free(ar); archive_read_free(ar);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment