compat: add unzGetCurrentFileZStreamPos64 (#848)

Returns the absolute offset where the current entry's compressed
data begins, matching the original minizip API used by chromium and
other consumers. The position is already tracked internally via
entry_pos for STORE-method seek support, so this just exposes it.
This commit is contained in:
Nathan Moin Vaziri 2026-04-26 18:47:40 -07:00
parent 6b9defc73c
commit a6300c3b29
2 changed files with 8 additions and 0 deletions

View file

@ -629,6 +629,13 @@ int unzSetOffset64(unzFile file, int64_t pos) {
return (int)mz_zip_goto_entry(compat->handle, pos);
}
uint64_t unzGetCurrentFileZStreamPos64(unzFile file) {
mz_unzip_compat *compat = (mz_unzip_compat *)file;
if (!compat || mz_zip_entry_is_open(compat->handle) != MZ_OK)
return 0;
return (uint64_t)compat->entry_pos;
}
int unzGetLocalExtrafield(unzFile file, void *buf, unsigned int len) {
mz_unzip_compat *compat = (mz_unzip_compat *)file;
mz_zip_file *file_info = NULL;

View file

@ -217,6 +217,7 @@ ZEXPORT int64_t unzGetOffset64(unzFile file);
ZEXPORT unsigned long unzGetOffset(unzFile file);
ZEXPORT int unzSetOffset64(unzFile file, int64_t pos);
ZEXPORT int unzSetOffset(unzFile file, unsigned long pos);
ZEXPORT uint64_t unzGetCurrentFileZStreamPos64(unzFile file);
ZEXPORT int32_t unztell(unzFile file);
ZEXPORT uint64_t unztell64(unzFile file);
ZEXPORT int unzeof(unzFile file);