Code

Corrected the parenting of the browse dialog, so that it cannot fall underneath the...
[inkscape.git] / src / streams-zlib.cpp
index cbe6a75fe0c44d114b68a72307f426f0528a4530..9e139e3016c31e41272eaa7d1e0e36683da1711e 100644 (file)
@@ -9,6 +9,7 @@
  * Released under GNU LGPL, read the file 'COPYING.LIB' for more information
  */
 
+#include <vector>
 #include "streams-zlib.h"
 
 namespace Inkscape {
@@ -104,15 +105,18 @@ int ZlibBuffer::do_consume(guint8 *buf, int nbytes)
 
 int ZlibBuffer::do_consume_and_inflate(int nbytes)
 {
-    guint8 buf[nbytes];
-    if (consume(buf, nbytes) == EOF)
-       return EOF;
+    std::vector<guint8> buf(nbytes);
 
-    GByteArray *gba = inflate(buf, nbytes);
-    copy_to_get(gba->data, gba->len);
+    int ret=consume(&buf[0], nbytes);
+    
+    if ( ret != EOF ) {
+        ret = 1;
+        GByteArray *gba = inflate(&buf[0], nbytes);
+        copy_to_get(gba->data, gba->len);
+        g_byte_array_free(gba, TRUE);
+    }
 
-    g_byte_array_free(gba, TRUE);
-    return 1;
+    return ret;
 }
 
 int ZlibBuffer::consume_and_inflate()