mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
express: Fix reading zip file with comment at the end
This commit is contained in:
parent
f8039c0bc8
commit
c52ea9a8df
@ -1222,11 +1222,14 @@ read_index() {
|
|||||||
// Seek backwards until we have found the the end-of-directory record.
|
// Seek backwards until we have found the the end-of-directory record.
|
||||||
StreamReader reader(read, false);
|
StreamReader reader(read, false);
|
||||||
while (comment_length <= 0xffff && fpos >= 20) {
|
while (comment_length <= 0xffff && fpos >= 20) {
|
||||||
|
//nassertr(fpos == read->tellg(), false);
|
||||||
|
|
||||||
if (reader.get_uint16() == comment_length) {
|
if (reader.get_uint16() == comment_length) {
|
||||||
// This field references the distance to the end of the .zip file, so it
|
// This field references the distance to the end of the .zip file, so it
|
||||||
// could be the comment length field at the end of the record. Skip to the
|
// could be the comment length field at the end of the record. Skip to the
|
||||||
// beginning of the record to see if the signature matches.
|
// beginning of the record to see if the signature matches.
|
||||||
read->seekg(-22, std::ios::cur);
|
read->seekg(-22, std::ios::cur);
|
||||||
|
|
||||||
if (reader.get_uint32() == 0x06054b50) {
|
if (reader.get_uint32() == 0x06054b50) {
|
||||||
// Yes, got it.
|
// Yes, got it.
|
||||||
eocd_offset = read->tellg() - (std::streamoff)4;
|
eocd_offset = read->tellg() - (std::streamoff)4;
|
||||||
@ -1242,10 +1245,16 @@ read_index() {
|
|||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No, skip back to where we were and continue scanning for comments.
|
||||||
|
comment_length += 2;
|
||||||
|
read->seekg(22 - 4 - 4, std::ios::cur);
|
||||||
|
fpos -= 2;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
comment_length += 2;
|
comment_length += 2;
|
||||||
read->seekg(-2, std::ios::cur);
|
read->seekg(-4, std::ios::cur);
|
||||||
fpos -= 2;
|
fpos -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user