Comments (5)
I haven't tested them on those. It depends how file reading operations and such arrange uint32_t and similar multibyte variables. One would need to run the code and see if the signature check against 0x02014B50 in the code works, and if file offsets, sizes etc. work correctly. Unfortunately I don't have access to big-endian systems at the moment.
from junzip.
some properties of file header need converstion on big-endian systems.
i will try test and report you
system: arm32 big endian
from junzip.
A possible solution is to use <endian.h>
. For example in jzReadLocalFileHeader
instead of:
memcpy(header, &localHeader.compressionMethod, sizeof(JZFileHeader));
write:
header->compressionMethod = le16toh(localHeader.compressionMethod);
header->lastModFileTime = le16toh(localHeader.lastModFileTime);
and so on. Of course this conversion must be done before any of the values are actually used.
A disadvantage is that <endian.h>
isn't very portable - but the existing code isn't very portable anyway, as it requires __attribute__ ((__packed__))
. The macros in <endian.h>
should be pretty efficient.
from junzip.
For DomTerm I started with JUnzip, but re-wrote it pretty extensively. It should now be more portable, and I expect no byte-order problems. It is also simpler and faster, by using a simplifying assuming that the entire zip file is mmap'd into memory. See files lws-term/junzip.h
and lws-term/junzip.c
in the GitHub source code.
from junzip.
@PerBothner very nice. :) I would suggest contributing changes back to JUnzip, but this is in no way an active project for me at the moment, so I'll leave this issue "open" for others to see. For same reason, I think endianness remains somewhat x86 centric for the time being, unless someone submits a pull request I can make sense of. 😄
from junzip.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from junzip.