summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Compress/ZLibCodecompressor.cpp')
-rw-r--r--Swiften/Compress/ZLibCodecompressor.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/Swiften/Compress/ZLibCodecompressor.cpp b/Swiften/Compress/ZLibCodecompressor.cpp
index c093fb3..0869d6b 100644
--- a/Swiften/Compress/ZLibCodecompressor.cpp
+++ b/Swiften/Compress/ZLibCodecompressor.cpp
@@ -4,11 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Compress/ZLibCodecompressor.h"
+#include <Swiften/Compress/ZLibCodecompressor.h>
#include <cassert>
+#include <string.h>
-#include "Swiften/Compress/ZLibException.h"
+#include <Swiften/Compress/ZLibException.h>
namespace Swift {
@@ -24,15 +25,15 @@ ZLibCodecompressor::ZLibCodecompressor() {
ZLibCodecompressor::~ZLibCodecompressor() {
}
-ByteArray ZLibCodecompressor::process(const ByteArray& input) {
- ByteArray output;
- stream_.avail_in = input.getSize();
- stream_.next_in = reinterpret_cast<Bytef*>(const_cast<unsigned char*>(input.getData()));
+SafeByteArray ZLibCodecompressor::process(const SafeByteArray& input) {
+ SafeByteArray output;
+ stream_.avail_in = input.size();
+ stream_.next_in = reinterpret_cast<Bytef*>(const_cast<unsigned char*>(vecptr(input)));
int outputPosition = 0;
do {
output.resize(outputPosition + CHUNK_SIZE);
stream_.avail_out = CHUNK_SIZE;
- stream_.next_out = reinterpret_cast<Bytef*>(output.getData() + outputPosition);
+ stream_.next_out = reinterpret_cast<Bytef*>(vecptr(output) + outputPosition);
int result = processZStream();
if (result != Z_OK && result != Z_BUF_ERROR) {
throw ZLibException(/* stream_.msg */);