diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-11-27 22:35:13 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-11-27 22:35:13 +0100 |
commit | a6630d32394120a78af56bc612fa3c3449283248 (patch) | |
tree | 2c791266b0f213cd56961299da8d2258b8f85d8e /src/OSSupport | |
parent | Fixed spawn point being generally in an ocean (diff) | |
parent | Voronoi-related biomegens use the new cVoronoiMap class. (diff) | |
download | cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.gz cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.bz2 cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.lz cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.xz cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.zst cuberite-a6630d32394120a78af56bc612fa3c3449283248.zip |
Diffstat (limited to '')
-rw-r--r-- | src/OSSupport/BlockingTCPLink.cpp (renamed from source/OSSupport/BlockingTCPLink.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/BlockingTCPLink.h (renamed from source/OSSupport/BlockingTCPLink.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/CriticalSection.cpp (renamed from source/OSSupport/CriticalSection.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/CriticalSection.h (renamed from source/OSSupport/CriticalSection.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/Event.cpp (renamed from source/OSSupport/Event.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/Event.h (renamed from source/OSSupport/Event.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/File.cpp (renamed from source/OSSupport/File.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/File.h (renamed from source/OSSupport/File.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/GZipFile.cpp (renamed from source/OSSupport/GZipFile.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/GZipFile.h | 52 | ||||
-rw-r--r-- | src/OSSupport/IsThread.cpp (renamed from source/OSSupport/IsThread.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/IsThread.h (renamed from source/OSSupport/IsThread.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/ListenThread.cpp (renamed from source/OSSupport/ListenThread.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/ListenThread.h (renamed from source/OSSupport/ListenThread.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/Semaphore.cpp (renamed from source/OSSupport/Semaphore.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/Semaphore.h (renamed from source/OSSupport/Semaphore.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/Sleep.cpp (renamed from source/OSSupport/Sleep.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/Sleep.h (renamed from source/OSSupport/Sleep.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/Socket.cpp (renamed from source/OSSupport/Socket.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/Socket.h (renamed from source/OSSupport/Socket.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/SocketThreads.cpp (renamed from source/OSSupport/SocketThreads.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/SocketThreads.h (renamed from source/OSSupport/SocketThreads.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/Thread.cpp (renamed from source/OSSupport/Thread.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/Thread.h (renamed from source/OSSupport/Thread.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/Timer.cpp (renamed from source/OSSupport/Timer.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/Timer.h (renamed from source/OSSupport/Timer.h) | 0 |
26 files changed, 52 insertions, 0 deletions
diff --git a/source/OSSupport/BlockingTCPLink.cpp b/src/OSSupport/BlockingTCPLink.cpp index 55454a4b5..55454a4b5 100644 --- a/source/OSSupport/BlockingTCPLink.cpp +++ b/src/OSSupport/BlockingTCPLink.cpp diff --git a/source/OSSupport/BlockingTCPLink.h b/src/OSSupport/BlockingTCPLink.h index cb5f9e3f4..cb5f9e3f4 100644 --- a/source/OSSupport/BlockingTCPLink.h +++ b/src/OSSupport/BlockingTCPLink.h diff --git a/source/OSSupport/CriticalSection.cpp b/src/OSSupport/CriticalSection.cpp index bda97e3a1..bda97e3a1 100644 --- a/source/OSSupport/CriticalSection.cpp +++ b/src/OSSupport/CriticalSection.cpp diff --git a/source/OSSupport/CriticalSection.h b/src/OSSupport/CriticalSection.h index 1bfe81439..1bfe81439 100644 --- a/source/OSSupport/CriticalSection.h +++ b/src/OSSupport/CriticalSection.h diff --git a/source/OSSupport/Event.cpp b/src/OSSupport/Event.cpp index cbacbba17..cbacbba17 100644 --- a/source/OSSupport/Event.cpp +++ b/src/OSSupport/Event.cpp diff --git a/source/OSSupport/Event.h b/src/OSSupport/Event.h index 71f418c0c..71f418c0c 100644 --- a/source/OSSupport/Event.h +++ b/src/OSSupport/Event.h diff --git a/source/OSSupport/File.cpp b/src/OSSupport/File.cpp index 9f7c0d439..9f7c0d439 100644 --- a/source/OSSupport/File.cpp +++ b/src/OSSupport/File.cpp diff --git a/source/OSSupport/File.h b/src/OSSupport/File.h index 01663a229..01663a229 100644 --- a/source/OSSupport/File.h +++ b/src/OSSupport/File.h diff --git a/source/OSSupport/GZipFile.cpp b/src/OSSupport/GZipFile.cpp index cbf6be6c4..cbf6be6c4 100644 --- a/source/OSSupport/GZipFile.cpp +++ b/src/OSSupport/GZipFile.cpp diff --git a/src/OSSupport/GZipFile.h b/src/OSSupport/GZipFile.h new file mode 100644 index 000000000..dfb4e8c31 --- /dev/null +++ b/src/OSSupport/GZipFile.h @@ -0,0 +1,52 @@ + +// GZipFile.h + +// Declares the cGZipFile class representing a RAII wrapper over zlib's GZip file routines + + + + + +#pragma once + +#include "zlib/zlib.h" + + + + + +class cGZipFile +{ +public: + enum eMode + { + fmRead, // Read-only. If the file doesn't exist, object will not be valid + fmWrite, // Write-only. If the file already exists, it will be overwritten + } ; + + cGZipFile(void); + ~cGZipFile(); + + /// Opens the file. Returns true if successful. Fails if a file has already been opened through this object. + bool Open(const AString & a_FileName, eMode a_Mode); + + /// Closes the file, flushing all buffers. This object may be then reused for a different file and / or mode + void Close(void); + + /// Reads the rest of the file and decompresses it into a_Contents. Returns the number of decompressed bytes, <0 for error + int ReadRestOfFile(AString & a_Contents); + + /// Writes a_Contents into file, compressing it along the way. Returns true if successful. Multiple writes are supported. + bool Write(const AString & a_Contents) { return Write(a_Contents.data(), (int)(a_Contents.size())); } + + bool Write(const char * a_Data, int a_Size); + +protected: + gzFile m_File; + eMode m_Mode; +} ; + + + + + diff --git a/source/OSSupport/IsThread.cpp b/src/OSSupport/IsThread.cpp index 4da9f9949..4da9f9949 100644 --- a/source/OSSupport/IsThread.cpp +++ b/src/OSSupport/IsThread.cpp diff --git a/source/OSSupport/IsThread.h b/src/OSSupport/IsThread.h index b8784ea33..b8784ea33 100644 --- a/source/OSSupport/IsThread.h +++ b/src/OSSupport/IsThread.h diff --git a/source/OSSupport/ListenThread.cpp b/src/OSSupport/ListenThread.cpp index ba3198764..ba3198764 100644 --- a/source/OSSupport/ListenThread.cpp +++ b/src/OSSupport/ListenThread.cpp diff --git a/source/OSSupport/ListenThread.h b/src/OSSupport/ListenThread.h index 4e337d814..4e337d814 100644 --- a/source/OSSupport/ListenThread.h +++ b/src/OSSupport/ListenThread.h diff --git a/source/OSSupport/Semaphore.cpp b/src/OSSupport/Semaphore.cpp index 468de6858..468de6858 100644 --- a/source/OSSupport/Semaphore.cpp +++ b/src/OSSupport/Semaphore.cpp diff --git a/source/OSSupport/Semaphore.h b/src/OSSupport/Semaphore.h index fbe8907f1..fbe8907f1 100644 --- a/source/OSSupport/Semaphore.h +++ b/src/OSSupport/Semaphore.h diff --git a/source/OSSupport/Sleep.cpp b/src/OSSupport/Sleep.cpp index 70fb06b40..70fb06b40 100644 --- a/source/OSSupport/Sleep.cpp +++ b/src/OSSupport/Sleep.cpp diff --git a/source/OSSupport/Sleep.h b/src/OSSupport/Sleep.h index 5298c15da..5298c15da 100644 --- a/source/OSSupport/Sleep.h +++ b/src/OSSupport/Sleep.h diff --git a/source/OSSupport/Socket.cpp b/src/OSSupport/Socket.cpp index f25f800c2..f25f800c2 100644 --- a/source/OSSupport/Socket.cpp +++ b/src/OSSupport/Socket.cpp diff --git a/source/OSSupport/Socket.h b/src/OSSupport/Socket.h index 81bfd28fc..81bfd28fc 100644 --- a/source/OSSupport/Socket.h +++ b/src/OSSupport/Socket.h diff --git a/source/OSSupport/SocketThreads.cpp b/src/OSSupport/SocketThreads.cpp index 3e505616c..3e505616c 100644 --- a/source/OSSupport/SocketThreads.cpp +++ b/src/OSSupport/SocketThreads.cpp diff --git a/source/OSSupport/SocketThreads.h b/src/OSSupport/SocketThreads.h index ecbac3aeb..ecbac3aeb 100644 --- a/source/OSSupport/SocketThreads.h +++ b/src/OSSupport/SocketThreads.h diff --git a/source/OSSupport/Thread.cpp b/src/OSSupport/Thread.cpp index 3df75f0e7..3df75f0e7 100644 --- a/source/OSSupport/Thread.cpp +++ b/src/OSSupport/Thread.cpp diff --git a/source/OSSupport/Thread.h b/src/OSSupport/Thread.h index 3c9316424..3c9316424 100644 --- a/source/OSSupport/Thread.h +++ b/src/OSSupport/Thread.h diff --git a/source/OSSupport/Timer.cpp b/src/OSSupport/Timer.cpp index ed16f9e3a..ed16f9e3a 100644 --- a/source/OSSupport/Timer.cpp +++ b/src/OSSupport/Timer.cpp diff --git a/source/OSSupport/Timer.h b/src/OSSupport/Timer.h index a059daa41..a059daa41 100644 --- a/source/OSSupport/Timer.h +++ b/src/OSSupport/Timer.h |