neko.zip.Writer bug

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

neko.zip.Writer bug

Ian Martins
zip archives created with neko.zip.Writer.writeZip() couldn't be read by
winzip on windows or unzip on linux. it looks like both programs were
using the "relative offset of local header" field from the archive's
central directory header, which wasn't being set.  this small change
fixed it.

-Ian

Index: std/neko/zip/Writer.hx
===================================================================
RCS file: /cvsroot/haxe/std/neko/zip/Writer.hx,v
retrieving revision 1.2
diff -u -p -r1.2 Writer.hx
--- std/neko/zip/Writer.hx 16 May 2008 17:31:27 -0000 1.2
+++ std/neko/zip/Writer.hx 29 Apr 2009 19:20:14 -0000
@@ -107,7 +107,7 @@ class Writer {
  o.writeUInt16(0); //disk number start
  o.writeUInt16(0); //internal file attributes
  o.writeUInt30(0); //external file attributes
- o.writeUInt30(0); //relative offset of local header
+ o.writeUInt30(cdr_offset); //relative offset of local header
  o.writeString(f.fileName);
  cdr_size += CENTRAL_DIRECTORY_RECORD_FIELDS_SIZE + namelen;
  cdr_offset += LOCAL_FILE_HEADER_FIELDS_SIZE + namelen + f.clen;

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: neko.zip.Writer bug

Nicolas Cannasse
Ian Martins a écrit :
> zip archives created with neko.zip.Writer.writeZip() couldn't be read by
> winzip on windows or unzip on linux. it looks like both programs were
> using the "relative offset of local header" field from the archive's
> central directory header, which wasn't being set.  this small change
> fixed it.

Thanks, the issue was already fixed in the format.zip library but didn't
get reported on the neko.zip package.

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org