r425 - trunk
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Jan 16 05:12:29 EST 2008
Author: icculus
Date: 2008-01-16 05:12:18 -0500 (Wed, 16 Jan 2008)
New Revision: 425
Modified:
trunk/archive_zip.c
trunk/fileio.c
trunk/fileio.h
Log:
Let archives report the byte offset in a MojoInput where they start, so we
know, for example, exactly where an executable ends and an appended .zip
file starts.
Modified: trunk/archive_zip.c
===================================================================
--- trunk/archive_zip.c 2008-01-16 10:10:34 UTC (rev 424)
+++ trunk/archive_zip.c 2008-01-16 10:12:18 UTC (rev 425)
@@ -252,6 +252,7 @@
#if __MOJOSETUP__
void *io; /* a MojoInput pointer */
int32 enumIndex; /* index of last entry enumerated. */
+ int64 offset; /* byte offset from start of MojoInput where zip starts. */
#endif
PHYSFS_uint16 entryCount; /* Number of files in ZIP. */
ZIPentry *entries; /* info on all files in ZIP. */
@@ -1307,6 +1308,10 @@
if (!zip_parse_end_of_central_dir(in, info, &data_start, ¢_dir_ofs))
goto zip_openarchive_failed;
+#if __MOJOSETUP__
+ info->offset = (int64) data_start;
+#endif
+
if (!zip_load_entries(in, info, data_start, cent_dir_ofs))
goto zip_openarchive_failed;
@@ -1823,6 +1828,7 @@
ar->enumNext = MojoArchive_zip_enumNext;
ar->openCurrentEntry = MojoArchive_zip_openCurrentEntry;
ar->close = MojoArchive_zip_close;
+ ar->offsetOfStart = ((const ZIPinfo *) opaque)->offset;
ar->opaque = opaque;
ar->io = io;
return ar;
Modified: trunk/fileio.c
===================================================================
--- trunk/fileio.c 2008-01-16 10:10:34 UTC (rev 424)
+++ trunk/fileio.c 2008-01-16 10:12:18 UTC (rev 425)
@@ -598,6 +598,7 @@
ar->enumNext = MojoArchive_dir_enumNext;
ar->openCurrentEntry = MojoArchive_dir_openCurrentEntry;
ar->close = MojoArchive_dir_close;
+ ar->offsetOfStart = -1; // doesn't mean anything here.
ar->opaque = inst;
return ar;
} // MojoArchive_newFromDirectory
Modified: trunk/fileio.h
===================================================================
--- trunk/fileio.h 2008-01-16 10:10:34 UTC (rev 424)
+++ trunk/fileio.h 2008-01-16 10:12:18 UTC (rev 425)
@@ -82,6 +82,7 @@
// private
MojoInput *io;
MojoArchiveEntry prevEnum;
+ int64 offsetOfStart; // byte offset in MojoInput where archive starts.
void *opaque;
};
More information about the mojosetup-commits
mailing list