summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 47d3269)
raw | patch | inline | side by side (parent: 47d3269)
author | mental <mental@users.sourceforge.net> | |
Tue, 9 May 2006 03:00:35 +0000 (03:00 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Tue, 9 May 2006 03:00:35 +0000 (03:00 +0000) |
ChangeLog | patch | blob | history | |
src/streams-jar.cpp | patch | blob | history | |
src/streams-zlib.cpp | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index 6ab6de7baf98dbd475e9facd4d92d428db95ae02..66ccb050850c966fd4632698da7446ec3e57c028 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
* src/streams-zlib.cpp, src/streams-jar.cpp:
- use array new rather than dynamically-sized automatic arrays,
+ use std::vector rather than dynamically-sized automatic arrays,
plus cleanups and minor fixes
2006-05-08 MenTaLguY <mental@rydia.net>
diff --git a/src/streams-jar.cpp b/src/streams-jar.cpp
index 521b1f9a96343726f577af5737a254e7f5ff5180..e597822e9280a426778ec16f0986fa8331d708ff 100644 (file)
--- a/src/streams-jar.cpp
+++ b/src/streams-jar.cpp
+#include <vector>
#include "streams-jar.h"
namespace Inkscape {
int ret=do_consume_and_inflate(nbytes);
if ( ret == EOF && eflen > 0 ) {
- guint8 *efbuf=new guint8[eflen];
- _urihandle->read(efbuf, eflen);
- delete [] efbuf;
+ std::vector<guint8> efbuf(eflen);
+ _urihandle->read(&efbuf[0], eflen);
return 1;
}
int JarBuffer::consume_uncompressed(int nbytes)
{
- guint8 *data=new guint8[nbytes];
- int consumed=consume(data, nbytes);
+ std::vector<guint8> data(nbytes);
+ int consumed=consume(&data[0], nbytes);
if ( consumed != EOF ) {
- copy_to_get(data, consumed);
+ copy_to_get(&data[0], consumed);
compressed_left -= consumed;
}
- delete [] data;
return consumed;
}
diff --git a/src/streams-zlib.cpp b/src/streams-zlib.cpp
index 5784a17cf44683e098a6847c9acc096a3b20b0a3..9e139e3016c31e41272eaa7d1e0e36683da1711e 100644 (file)
--- a/src/streams-zlib.cpp
+++ b/src/streams-zlib.cpp
* Released under GNU LGPL, read the file 'COPYING.LIB' for more information
*/
+#include <vector>
#include "streams-zlib.h"
namespace Inkscape {
int ZlibBuffer::do_consume_and_inflate(int nbytes)
{
- guint8 *buf=new guint8[nbytes];
+ std::vector<guint8> buf(nbytes);
- int ret=consume(buf, nbytes);
+ int ret=consume(&buf[0], nbytes);
if ( ret != EOF ) {
ret = 1;
- GByteArray *gba = inflate(buf, nbytes);
+ GByteArray *gba = inflate(&buf[0], nbytes);
copy_to_get(gba->data, gba->len);
g_byte_array_free(gba, TRUE);
}
- delete [] buf;
return ret;
}