<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[GMan's Mods & Stuff — Bug appending to an empty zip?]]></title>
	<link rel="self" href="https://gprogs.com/extern.php?action=feed&amp;tid=359&amp;type=atom" />
	<updated>2009-02-16T21:27:27Z</updated>
	<generator>PunBB</generator>
	<id>https://gprogs.com/viewtopic.php?id=359</id>
		<entry>
			<title type="html"><![CDATA[Bug appending to an empty zip?]]></title>
			<link rel="alternate" href="https://gprogs.com/viewtopic.php?pid=1361#p1361" />
			<content type="html"><![CDATA[<p>Hello, if you create a new zip file then close it again so you have a blank zip, then later open it again to append to nothing seems to get added to the zip. Here&#039;s an example adapted from the last bug example:</p><div class="codebox"><pre><code>SuperStrict

Framework brl.basic
Import gman.zipengine
Import brl.pixmap
Import brl.pngloader

Local zip:ZipWriter = New ZipWriter
zip.OpenZip(&quot;test.zip&quot;, False)
zip.CloseZip()

&#039;Create 10 pixmaps and save into a stream in the format:
&#039;Int (size of png)
&#039;Png file
&#039;Int (size of png)
&#039;Png file
&#039;Int (size of png)
&#039;Png file
&#039;.. etc

Local iconbank:TBank = CreateBank()
Local tempstream:TStream = WriteStream(iconbank)
For Local c:Int = 1 To 10
    Local pixmap:TPixmap = CreatePixmap(32, 32, PF_RGBA8888)
    pixmap.WritePixel(c, c, $FFFFFFFF)
    Local tempbank:TBank = CreateBank()
    SavePixmapPNG(pixmap, tempbank)
    tempstream.WriteInt(tempbank.Size())
    WriteBank(tempbank, tempstream, 0, tempbank.Size())
Next

SaveBank(iconbank, &quot;testfile&quot;)
zip.OpenZip(&quot;test.zip&quot;, True)
&#039;add the stream and file to the zip
zip.AddStream(tempstream, &quot;teststream&quot;)
zip.AddFile(&quot;testfile&quot;)
zip.CloseZip()
End</code></pre></div><p>This should create a zip with 2 file in it, but the zip is empty... But I&#039;m not sure if this is normal behaviour <img src="https://gprogs.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Thanks!</p>]]></content>
			<author>
				<name><![CDATA[peterigz]]></name>
				<uri>https://gprogs.com/profile.php?id=257</uri>
			</author>
			<updated>2009-02-16T21:27:27Z</updated>
			<id>https://gprogs.com/viewtopic.php?pid=1361#p1361</id>
		</entry>
</feed>
