diff options
| author | MenTaLguY <mental@rydia.net> | 2006-05-09 02:51:10 +0000 |
|---|---|---|
| committer | mental <mental@users.sourceforge.net> | 2006-05-09 02:51:10 +0000 |
| commit | 3f6885decb1c0b3e4248b5f44cd16471ae989972 (patch) | |
| tree | 5960ce108069d2c4bcf34e8bdef490d04e06b3b9 /src/streams-zlib.cpp | |
| parent | patch from Niko Kiirala for bug 1482973 (diff) | |
| download | inkscape-3f6885decb1c0b3e4248b5f44cd16471ae989972.tar.gz inkscape-3f6885decb1c0b3e4248b5f44cd16471ae989972.zip | |
use array new rather than dynamically-sized automatic arrays, plus cleanups and minor fixes
(bzr r782)
Diffstat (limited to 'src/streams-zlib.cpp')
| -rw-r--r-- | src/streams-zlib.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/streams-zlib.cpp b/src/streams-zlib.cpp index cbe6a75fe..5784a17cf 100644 --- a/src/streams-zlib.cpp +++ b/src/streams-zlib.cpp @@ -104,15 +104,19 @@ 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; - - GByteArray *gba = inflate(buf, nbytes); - copy_to_get(gba->data, gba->len); + guint8 *buf=new guint8[nbytes]; + + int ret=consume(buf, nbytes); + + if ( ret != EOF ) { + ret = 1; + GByteArray *gba = inflate(buf, nbytes); + copy_to_get(gba->data, gba->len); + g_byte_array_free(gba, TRUE); + } - g_byte_array_free(gba, TRUE); - return 1; + delete [] buf; + return ret; } int ZlibBuffer::consume_and_inflate() |
