summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
committerTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
commitcfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch)
tree18d94153a302445196fc0c18586abf44a1ce4a38 /Swiften/Compress
parent1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff)
downloadswift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip
swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines in the process. Changed CheckTabs.py tool to disallow hard tabs in source files. Test-Information: Manually checked 30 random files that the conversion worked as expected. Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swiften/Compress')
-rw-r--r--Swiften/Compress/UnitTest/ZLibCompressorTest.cpp34
-rw-r--r--Swiften/Compress/UnitTest/ZLibDecompressorTest.cpp112
-rw-r--r--Swiften/Compress/ZLibCodecompressor.cpp48
-rw-r--r--Swiften/Compress/ZLibCodecompressor.h20
-rw-r--r--Swiften/Compress/ZLibCodecompressor_Private.h6
-rw-r--r--Swiften/Compress/ZLibCompressor.cpp10
-rw-r--r--Swiften/Compress/ZLibCompressor.h16
-rw-r--r--Swiften/Compress/ZLibDecompressor.cpp10
-rw-r--r--Swiften/Compress/ZLibDecompressor.h12
-rw-r--r--Swiften/Compress/ZLibException.h8
10 files changed, 138 insertions, 138 deletions
diff --git a/Swiften/Compress/UnitTest/ZLibCompressorTest.cpp b/Swiften/Compress/UnitTest/ZLibCompressorTest.cpp
index 584a4f7..ca99201 100644
--- a/Swiften/Compress/UnitTest/ZLibCompressorTest.cpp
+++ b/Swiften/Compress/UnitTest/ZLibCompressorTest.cpp
@@ -17,28 +17,28 @@ using namespace Swift;
class ZLibCompressorTest : public CppUnit::TestFixture
{
- CPPUNIT_TEST_SUITE(ZLibCompressorTest);
- CPPUNIT_TEST(testProcess);
- CPPUNIT_TEST(testProcess_Twice);
- CPPUNIT_TEST_SUITE_END();
+ CPPUNIT_TEST_SUITE(ZLibCompressorTest);
+ CPPUNIT_TEST(testProcess);
+ CPPUNIT_TEST(testProcess_Twice);
+ CPPUNIT_TEST_SUITE_END();
- public:
- ZLibCompressorTest() {}
+ public:
+ ZLibCompressorTest() {}
- void testProcess() {
- ZLibCompressor testling;
- SafeByteArray result = testling.process(createSafeByteArray("foo"));
+ void testProcess() {
+ ZLibCompressor testling;
+ SafeByteArray result = testling.process(createSafeByteArray("foo"));
- CPPUNIT_ASSERT_EQUAL(createSafeByteArray("\x78\xda\x4a\xcb\xcf\x07\x00\x00\x00\xff\xff", 11), result);
- }
+ CPPUNIT_ASSERT_EQUAL(createSafeByteArray("\x78\xda\x4a\xcb\xcf\x07\x00\x00\x00\xff\xff", 11), result);
+ }
- void testProcess_Twice() {
- ZLibCompressor testling;
- testling.process(createSafeByteArray("foo"));
- SafeByteArray result = testling.process(createSafeByteArray("bar"));
+ void testProcess_Twice() {
+ ZLibCompressor testling;
+ testling.process(createSafeByteArray("foo"));
+ SafeByteArray result = testling.process(createSafeByteArray("bar"));
- CPPUNIT_ASSERT_EQUAL(createSafeByteArray("\x4a\x4a\x2c\x02\x00\x00\x00\xff\xff",9), result);
- }
+ CPPUNIT_ASSERT_EQUAL(createSafeByteArray("\x4a\x4a\x2c\x02\x00\x00\x00\xff\xff",9), result);
+ }
};
CPPUNIT_TEST_SUITE_REGISTRATION(ZLibCompressorTest);
diff --git a/Swiften/Compress/UnitTest/ZLibDecompressorTest.cpp b/Swiften/Compress/UnitTest/ZLibDecompressorTest.cpp
index 7e57676..5873c0e 100644
--- a/Swiften/Compress/UnitTest/ZLibDecompressorTest.cpp
+++ b/Swiften/Compress/UnitTest/ZLibDecompressorTest.cpp
@@ -19,62 +19,62 @@ using namespace Swift;
class ZLibDecompressorTest : public CppUnit::TestFixture
{
- CPPUNIT_TEST_SUITE(ZLibDecompressorTest);
- CPPUNIT_TEST(testProcess);
- CPPUNIT_TEST(testProcess_Twice);
- CPPUNIT_TEST(testProcess_Invalid);
- CPPUNIT_TEST(testProcess_Huge);
- CPPUNIT_TEST(testProcess_ChunkSize);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- ZLibDecompressorTest() {}
-
- void testProcess() {
- ZLibDecompressor testling;
- SafeByteArray result = testling.process(createSafeByteArray("\x78\xda\x4a\xcb\xcf\x07\x00\x00\x00\xff\xff", 11));
-
- CPPUNIT_ASSERT_EQUAL(createSafeByteArray("foo"), result);
- }
-
- void testProcess_Twice() {
- ZLibDecompressor testling;
- testling.process(createSafeByteArray("\x78\xda\x4a\xcb\xcf\x07\x00\x00\x00\xff\xff", 11));
- SafeByteArray result = testling.process(createSafeByteArray("\x4a\x4a\x2c\x02\x00\x00\x00\xff\xff", 9));
-
- CPPUNIT_ASSERT_EQUAL(createSafeByteArray("bar"), result);
- }
-
- void testProcess_Invalid() {
- ZLibDecompressor testling;
- CPPUNIT_ASSERT_THROW(testling.process(createSafeByteArray("invalid")), ZLibException);
- }
-
- void testProcess_Huge() {
- std::vector<char> data;
- data.reserve(2048);
- for (unsigned int i = 0; i < 2048; ++i) {
- data.push_back(static_cast<char>(i));
- }
- SafeByteArray original(createSafeByteArray(&data[0], data.size()));
- SafeByteArray compressed = ZLibCompressor().process(original);
- SafeByteArray decompressed = ZLibDecompressor().process(compressed);
-
- CPPUNIT_ASSERT_EQUAL(original, decompressed);
- }
-
- void testProcess_ChunkSize() {
- std::vector<char> data;
- data.reserve(1024);
- for (unsigned int i = 0; i < 1024; ++i) {
- data.push_back(static_cast<char>(i));
- }
- SafeByteArray original(createSafeByteArray(&data[0], data.size()));
- SafeByteArray compressed = ZLibCompressor().process(original);
- SafeByteArray decompressed = ZLibDecompressor().process(compressed);
-
- CPPUNIT_ASSERT_EQUAL(original, decompressed);
- }
+ CPPUNIT_TEST_SUITE(ZLibDecompressorTest);
+ CPPUNIT_TEST(testProcess);
+ CPPUNIT_TEST(testProcess_Twice);
+ CPPUNIT_TEST(testProcess_Invalid);
+ CPPUNIT_TEST(testProcess_Huge);
+ CPPUNIT_TEST(testProcess_ChunkSize);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ ZLibDecompressorTest() {}
+
+ void testProcess() {
+ ZLibDecompressor testling;
+ SafeByteArray result = testling.process(createSafeByteArray("\x78\xda\x4a\xcb\xcf\x07\x00\x00\x00\xff\xff", 11));
+
+ CPPUNIT_ASSERT_EQUAL(createSafeByteArray("foo"), result);
+ }
+
+ void testProcess_Twice() {
+ ZLibDecompressor testling;
+ testling.process(createSafeByteArray("\x78\xda\x4a\xcb\xcf\x07\x00\x00\x00\xff\xff", 11));
+ SafeByteArray result = testling.process(createSafeByteArray("\x4a\x4a\x2c\x02\x00\x00\x00\xff\xff", 9));
+
+ CPPUNIT_ASSERT_EQUAL(createSafeByteArray("bar"), result);
+ }
+
+ void testProcess_Invalid() {
+ ZLibDecompressor testling;
+ CPPUNIT_ASSERT_THROW(testling.process(createSafeByteArray("invalid")), ZLibException);
+ }
+
+ void testProcess_Huge() {
+ std::vector<char> data;
+ data.reserve(2048);
+ for (unsigned int i = 0; i < 2048; ++i) {
+ data.push_back(static_cast<char>(i));
+ }
+ SafeByteArray original(createSafeByteArray(&data[0], data.size()));
+ SafeByteArray compressed = ZLibCompressor().process(original);
+ SafeByteArray decompressed = ZLibDecompressor().process(compressed);
+
+ CPPUNIT_ASSERT_EQUAL(original, decompressed);
+ }
+
+ void testProcess_ChunkSize() {
+ std::vector<char> data;
+ data.reserve(1024);
+ for (unsigned int i = 0; i < 1024; ++i) {
+ data.push_back(static_cast<char>(i));
+ }
+ SafeByteArray original(createSafeByteArray(&data[0], data.size()));
+ SafeByteArray compressed = ZLibCompressor().process(original);
+ SafeByteArray decompressed = ZLibDecompressor().process(compressed);
+
+ CPPUNIT_ASSERT_EQUAL(original, decompressed);
+ }
};
CPPUNIT_TEST_SUITE_REGISTRATION(ZLibDecompressorTest);
diff --git a/Swiften/Compress/ZLibCodecompressor.cpp b/Swiften/Compress/ZLibCodecompressor.cpp
index 7c413b7..fd6d3b0 100644
--- a/Swiften/Compress/ZLibCodecompressor.cpp
+++ b/Swiften/Compress/ZLibCodecompressor.cpp
@@ -23,36 +23,36 @@ static const size_t CHUNK_SIZE = 1024; // If you change this, also change the un
ZLibCodecompressor::ZLibCodecompressor() : p(boost::make_shared<Private>()) {
- memset(&p->stream, 0, sizeof(z_stream));
- p->stream.zalloc = Z_NULL;
- p->stream.zfree = Z_NULL;
- p->stream.opaque = Z_NULL;
+ memset(&p->stream, 0, sizeof(z_stream));
+ p->stream.zalloc = Z_NULL;
+ p->stream.zfree = Z_NULL;
+ p->stream.opaque = Z_NULL;
}
ZLibCodecompressor::~ZLibCodecompressor() {
}
SafeByteArray ZLibCodecompressor::process(const SafeByteArray& input) {
- SafeByteArray output;
- p->stream.avail_in = static_cast<unsigned int>(input.size());
- p->stream.next_in = reinterpret_cast<Bytef*>(const_cast<unsigned char*>(vecptr(input)));
- size_t outputPosition = 0;
- do {
- output.resize(outputPosition + CHUNK_SIZE);
- p->stream.avail_out = CHUNK_SIZE;
- p->stream.next_out = reinterpret_cast<Bytef*>(vecptr(output) + outputPosition);
- int result = processZStream();
- if (result != Z_OK && result != Z_BUF_ERROR) {
- throw ZLibException(/* p->stream.msg */);
- }
- outputPosition += CHUNK_SIZE;
- }
- while (p->stream.avail_out == 0);
- if (p->stream.avail_in != 0) {
- throw ZLibException();
- }
- output.resize(outputPosition - p->stream.avail_out);
- return output;
+ SafeByteArray output;
+ p->stream.avail_in = static_cast<unsigned int>(input.size());
+ p->stream.next_in = reinterpret_cast<Bytef*>(const_cast<unsigned char*>(vecptr(input)));
+ size_t outputPosition = 0;
+ do {
+ output.resize(outputPosition + CHUNK_SIZE);
+ p->stream.avail_out = CHUNK_SIZE;
+ p->stream.next_out = reinterpret_cast<Bytef*>(vecptr(output) + outputPosition);
+ int result = processZStream();
+ if (result != Z_OK && result != Z_BUF_ERROR) {
+ throw ZLibException(/* p->stream.msg */);
+ }
+ outputPosition += CHUNK_SIZE;
+ }
+ while (p->stream.avail_out == 0);
+ if (p->stream.avail_in != 0) {
+ throw ZLibException();
+ }
+ output.resize(outputPosition - p->stream.avail_out);
+ return output;
}
}
diff --git a/Swiften/Compress/ZLibCodecompressor.h b/Swiften/Compress/ZLibCodecompressor.h
index 3907258..253c34a 100644
--- a/Swiften/Compress/ZLibCodecompressor.h
+++ b/Swiften/Compress/ZLibCodecompressor.h
@@ -10,16 +10,16 @@
#include <Swiften/Base/SafeByteArray.h>
namespace Swift {
- class SWIFTEN_API ZLibCodecompressor {
- public:
- ZLibCodecompressor();
- virtual ~ZLibCodecompressor();
+ class SWIFTEN_API ZLibCodecompressor {
+ public:
+ ZLibCodecompressor();
+ virtual ~ZLibCodecompressor();
- SafeByteArray process(const SafeByteArray& data);
- virtual int processZStream() = 0;
+ SafeByteArray process(const SafeByteArray& data);
+ virtual int processZStream() = 0;
- protected:
- struct Private;
- boost::shared_ptr<Private> p;
- };
+ protected:
+ struct Private;
+ boost::shared_ptr<Private> p;
+ };
}
diff --git a/Swiften/Compress/ZLibCodecompressor_Private.h b/Swiften/Compress/ZLibCodecompressor_Private.h
index db761c3..2adc4b6 100644
--- a/Swiften/Compress/ZLibCodecompressor_Private.h
+++ b/Swiften/Compress/ZLibCodecompressor_Private.h
@@ -11,7 +11,7 @@
#include <Swiften/Compress/ZLibCodecompressor.h>
namespace Swift {
- struct ZLibCodecompressor::Private {
- z_stream stream;
- };
+ struct ZLibCodecompressor::Private {
+ z_stream stream;
+ };
}
diff --git a/Swiften/Compress/ZLibCompressor.cpp b/Swiften/Compress/ZLibCompressor.cpp
index 8887c46..a2fef15 100644
--- a/Swiften/Compress/ZLibCompressor.cpp
+++ b/Swiften/Compress/ZLibCompressor.cpp
@@ -16,17 +16,17 @@
namespace Swift {
ZLibCompressor::ZLibCompressor() {
- int result = deflateInit(&p->stream, COMPRESSION_LEVEL);
- assert(result == Z_OK);
- (void) result;
+ int result = deflateInit(&p->stream, COMPRESSION_LEVEL);
+ assert(result == Z_OK);
+ (void) result;
}
ZLibCompressor::~ZLibCompressor() {
- deflateEnd(&p->stream);
+ deflateEnd(&p->stream);
}
int ZLibCompressor::processZStream() {
- return deflate(&p->stream, Z_SYNC_FLUSH);
+ return deflate(&p->stream, Z_SYNC_FLUSH);
}
}
diff --git a/Swiften/Compress/ZLibCompressor.h b/Swiften/Compress/ZLibCompressor.h
index c92b8c0..59ebbb9 100644
--- a/Swiften/Compress/ZLibCompressor.h
+++ b/Swiften/Compress/ZLibCompressor.h
@@ -10,14 +10,14 @@
#include <Swiften/Compress/ZLibCodecompressor.h>
namespace Swift {
- class SWIFTEN_API ZLibCompressor : public ZLibCodecompressor {
- public:
- ZLibCompressor();
- virtual ~ZLibCompressor();
+ class SWIFTEN_API ZLibCompressor : public ZLibCodecompressor {
+ public:
+ ZLibCompressor();
+ virtual ~ZLibCompressor();
- virtual int processZStream();
+ virtual int processZStream();
- private:
- static const int COMPRESSION_LEVEL = 9;
- };
+ private:
+ static const int COMPRESSION_LEVEL = 9;
+ };
}
diff --git a/Swiften/Compress/ZLibDecompressor.cpp b/Swiften/Compress/ZLibDecompressor.cpp
index 3024150..adc40c5 100644
--- a/Swiften/Compress/ZLibDecompressor.cpp
+++ b/Swiften/Compress/ZLibDecompressor.cpp
@@ -16,17 +16,17 @@
namespace Swift {
ZLibDecompressor::ZLibDecompressor() {
- int result = inflateInit(&p->stream);
- assert(result == Z_OK);
- (void) result;
+ int result = inflateInit(&p->stream);
+ assert(result == Z_OK);
+ (void) result;
}
ZLibDecompressor::~ZLibDecompressor() {
- inflateEnd(&p->stream);
+ inflateEnd(&p->stream);
}
int ZLibDecompressor::processZStream() {
- return inflate(&p->stream, Z_SYNC_FLUSH);
+ return inflate(&p->stream, Z_SYNC_FLUSH);
}
}
diff --git a/Swiften/Compress/ZLibDecompressor.h b/Swiften/Compress/ZLibDecompressor.h
index b758be3..9c2dd4f 100644
--- a/Swiften/Compress/ZLibDecompressor.h
+++ b/Swiften/Compress/ZLibDecompressor.h
@@ -10,11 +10,11 @@
#include <Swiften/Compress/ZLibCodecompressor.h>
namespace Swift {
- class SWIFTEN_API ZLibDecompressor : public ZLibCodecompressor {
- public:
- ZLibDecompressor();
- virtual ~ZLibDecompressor();
+ class SWIFTEN_API ZLibDecompressor : public ZLibCodecompressor {
+ public:
+ ZLibDecompressor();
+ virtual ~ZLibDecompressor();
- virtual int processZStream();
- };
+ virtual int processZStream();
+ };
}
diff --git a/Swiften/Compress/ZLibException.h b/Swiften/Compress/ZLibException.h
index e73bcec..2201e62 100644
--- a/Swiften/Compress/ZLibException.h
+++ b/Swiften/Compress/ZLibException.h
@@ -7,8 +7,8 @@
#pragma once
namespace Swift {
- class ZLibException {
- public:
- ZLibException() {}
- };
+ class ZLibException {
+ public:
+ ZLibException() {}
+ };
}