diff options
author | madmaxoft <github@xoft.cz> | 2014-02-13 16:54:29 +0100 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-02-13 16:54:39 +0100 |
commit | 41ab8260f7b50bedbf06ea0effcb6147cb648685 (patch) | |
tree | e2d21ba6ff34d06ff89b996203fa8b7a9d21a3af /Tools/MCADefrag/MCADefrag.h | |
parent | MCADefrag: Fixed bugs, now produces valid MCA files. (diff) | |
download | cuberite-41ab8260f7b50bedbf06ea0effcb6147cb648685.tar cuberite-41ab8260f7b50bedbf06ea0effcb6147cb648685.tar.gz cuberite-41ab8260f7b50bedbf06ea0effcb6147cb648685.tar.bz2 cuberite-41ab8260f7b50bedbf06ea0effcb6147cb648685.tar.lz cuberite-41ab8260f7b50bedbf06ea0effcb6147cb648685.tar.xz cuberite-41ab8260f7b50bedbf06ea0effcb6147cb648685.tar.zst cuberite-41ab8260f7b50bedbf06ea0effcb6147cb648685.zip |
Diffstat (limited to '')
-rw-r--r-- | Tools/MCADefrag/MCADefrag.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Tools/MCADefrag/MCADefrag.h b/Tools/MCADefrag/MCADefrag.h index ef527863d..d7fa1fc6e 100644 --- a/Tools/MCADefrag/MCADefrag.h +++ b/Tools/MCADefrag/MCADefrag.h @@ -43,6 +43,14 @@ protected: cThread(cMCADefrag & a_Parent); protected: + /** The compression methods, as specified by the MCA compression method byte. */ + enum + { + COMPRESSION_GZIP = 1, + COMPRESSION_ZLIB = 2, + } ; + + cMCADefrag & m_Parent; /** The current compressed chunk data. Valid after a successful ReadChunk(). @@ -63,6 +71,10 @@ protected: /** Number of the sector where the next chunk will be written by WriteChunk(). */ int m_CurrentSectorOut; + /** Set to true when the chunk has been successfully uncompressed. Only used if recompression is active. + WriteChunk() tests this flag to decide whether to call Compress(). */ + bool m_IsChunkUncompressed; + /** Processes the specified file. */ void ProcessFile(const AString & a_FileName); @@ -80,6 +92,22 @@ protected: Returns true if successful. */ bool WriteChunk(cFile & a_File, Byte * a_LocationRaw); + /** Uncompresses the chunk data from m_CompressedChunkData into m_RawChunkData. + Returns true if successful, false on failure. */ + bool UncompressChunk(void); + + /** Uncompresses the chunk data from m_CompressedChunkData into m_RawChunkData, using Gzip. + Returns true if successful, false on failure. */ + bool UncompressChunkGzip(void); + + /** Uncompresses the chunk data from m_CompressedChunkData into m_RawChunkData, using Zlib. + Returns true if successful, false on failure. */ + bool UncompressChunkZlib(void); + + /** Compresses the chunk data from m_RawChunkData into m_CompressedChunkData. + Returns true if successful, false on failure. */ + bool CompressChunk(void); + // cIsThread overrides: virtual void Execute(void) override; } ; @@ -99,6 +127,9 @@ protected: /** The number of threads that should be started. Configurable on the command line. */ int m_NumThreads; + /** If set to true, the chunk data is recompressed while saving each MCA file. */ + bool m_ShouldRecompress; + /** Starts a new processing thread and adds it to cThreads. */ void StartThread(void); |