vectorchar to int

Started by
13 comments, last by jflanglois 19 years, 4 months ago
Damn struct padding... looks like I may have to read the values individually afterall...

Common zip files can have CD compression? I haven't run into one that does so far. I just assumed it was one of those unused features, like Zip64, that I wouldn't have to worry about in a game environment. I was actually reading the individual file headers to begin with, then read that they might not always be accurate or complete, and to use the CD instead... [rolleyes]
Advertisement
About struct padding, you might want to look at this (at the end).

I read that the CD can be compressed on the pkzip site spec. Those headers contain a bit more data, but nothing that seems to be essential. It would sort of defeat the purpose if the local headers could be inaccurate (corruption aside).
Quote:With the introduction of the Central Directory Encryption feature in version 6.2 of this specification, the Central Directory Structure may be stored both compressed and encrypted. Although not required, it is assumed when encrypting the Central Directory Structure, that it will be compressed for greater storage efficiency. Information on the Central Directory Encryption feature can be found in the section describing the Strong Encryption Specification. The Digital Signature record will be neither compressed nor encrypted.
Quote:Original post by jflanglois
About struct padding, you might want to look at this (at the end).


Thanks for the link, though my main problem is that I need it to be portable. From what I've read here in the forums, there doesn't appear to be one portable method of packing structs.

Quote:Original post by jflanglois
I read that the CD can be compressed on the pkzip site spec. Those headers contain a bit more data, but nothing that seems to be essential. It would sort of defeat the purpose if the local headers could be inaccurate (corruption aside).


I think it was the "compressed size" and "uncompressed size" fields I was thinking of, which may or may not be present in the local headers, but which are always present in the CD. I need those values to stream files out of the zip as needed. Hmm... I guess I'll look into it more. I still don't know if CD compression is something I need to worry much about, I can always just require all my zips to have uncompressed CDs (which seems to be default, I haven't seen one compressed so far).
Quote:Original post by jflanglois
Quote:Original post by Zahlman
Quote:Original post by Nairou
Reading individual values might be the best idea, I was just trying to minimize disk access.


Don't try (not in this way, anyway); the stream object does this for you (by reading a "page" of the file at a time and maintaining an internal buffer).


I don't understand what you mean by this. The ifstream will keep a cursor on the file. How does that mean that it is not a good idea to read individual values from the file instead of the whole file to a buffer, and then trying to parse that?


LOL! No, I didn't mean "Don't try to read individual values", I meant "Don't try to minimize disk access like this". The ifstream does the buffering already, so any buffering you implement yourself is redundant - just read a variable at a time.
Oh, ok. Heh, sorry.

This topic is closed to new replies.

Advertisement