diff options
| author | Alex Richard <richard4@cs.stanford.edu> | 2021-11-30 01:05:31 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-30 04:05:31 -0300 |
| commit | 91b25d87b1852f0066e6875efe0bce7438ea1fb1 (patch) | |
| tree | 0923ea2693c705752b6462c53a9977efea3abe88 /src | |
| parent | a19608c08a7d7c5020a7159bc8c6d496d09ad5b9 (diff) | |
| download | luarocks-91b25d87b1852f0066e6875efe0bce7438ea1fb1.tar.gz luarocks-91b25d87b1852f0066e6875efe0bce7438ea1fb1.tar.bz2 luarocks-91b25d87b1852f0066e6875efe0bce7438ea1fb1.zip | |
Improve performance of reading zip file by not processing header (#1370)
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/tools/zip.lua | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/luarocks/tools/zip.lua b/src/luarocks/tools/zip.lua index 7803b509..82d582fa 100644 --- a/src/luarocks/tools/zip.lua +++ b/src/luarocks/tools/zip.lua | |||
| @@ -329,19 +329,13 @@ local function read_file_in_zip(zh, cdr) | |||
| 329 | return nil, "failed reading Local File Header signature" | 329 | return nil, "failed reading Local File Header signature" |
| 330 | end | 330 | end |
| 331 | 331 | ||
| 332 | local lfh = {} | 332 | -- Skip over the rest of the zip file header. See |
| 333 | lfh.version_needed = lestring_to_number(zh:read(2)) | 333 | -- zipwriter_close_file_in_zip for the format. |
| 334 | lfh.bitflag = lestring_to_number(zh:read(2)) | 334 | zh:seek("cur", 22) |
| 335 | lfh.compression_method = lestring_to_number(zh:read(2)) | 335 | local file_name_length = lestring_to_number(zh:read(2)) |
| 336 | lfh.last_mod_file_time = lestring_to_number(zh:read(2)) | 336 | local extra_field_length = lestring_to_number(zh:read(2)) |
| 337 | lfh.last_mod_file_date = lestring_to_number(zh:read(2)) | 337 | zh:read(file_name_length) |
| 338 | lfh.crc32 = lestring_to_number(zh:read(4)) | 338 | zh:read(extra_field_length) |
| 339 | lfh.compressed_size = lestring_to_number(zh:read(4)) | ||
| 340 | lfh.uncompressed_size = lestring_to_number(zh:read(4)) | ||
| 341 | lfh.file_name_length = lestring_to_number(zh:read(2)) | ||
| 342 | lfh.extra_field_length = lestring_to_number(zh:read(2)) | ||
| 343 | lfh.file_name = zh:read(lfh.file_name_length) | ||
| 344 | lfh.extra_field = zh:read(lfh.extra_field_length) | ||
| 345 | 339 | ||
| 346 | local data = zh:read(cdr.compressed_size) | 340 | local data = zh:read(cdr.compressed_size) |
| 347 | 341 | ||
