gdraheim / zziplib

The ZZIPlib provides read access on ZIP-archives and unpacked data. It features an additional simplified API following the standard Posix API for file access
Other
62 stars 50 forks source link

WIN64 - mmap handle for LLP64 model #30

Closed gdraheim closed 6 years ago

gdraheim commented 6 years ago

On WIN64 sizeof(long) < sizeof(*ptr), so the mmap-handle storage variable (->user/->sys) needs to be rechecked.

A patch exists at TexLive =>

https://www.tug.org/svn/texlive/trunk/Build/source/libs/zziplib/TLpatches/patch-02-bugfix

gdraheim commented 6 years ago

Also check how MINGW chose to use the windows-native HANDLE int-type to capture the value.

https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-zziplib/mingw-mmap-workaround.patch

gdraheim commented 6 years ago

as the mmap-handle is almost always a kind of pointer-reference it may be best to use stdint's intptr_t (wrapped as a zzip_intptr_t) as the type of ->user (and perhaps ->sys).

Since the fd-map on unix-machines won't exceed even 32k in the majority of cases, that should be good enough even for very small machines where sizeof(intptr_t) == sizeof(short)

gdraheim commented 6 years ago

Actually, the MINGW code shows that we do not need to store the filemapping-handle at all.

That makes it even easier to keep binary backward compatibility.

=> please test.

gdraheim commented 6 years ago

done.