diff --git a/coding/blob_indexer.cpp b/coding/blob_indexer.cpp index 05912e6ab4..ad7d35f584 100644 --- a/coding/blob_indexer.cpp +++ b/coding/blob_indexer.cpp @@ -13,7 +13,7 @@ BlobIndexer::BlobIndexer(Writer & writer, size_t maxUncompressedChunkSize, - function const & compressor) : + CompressorType const & compressor) : m_writer(writer), m_maxUncompressedChunkSize(min(int(maxUncompressedChunkSize), (1 << BITS_IN_CHUNK_SIZE) - 1)), m_compressor(compressor), diff --git a/coding/blob_indexer.hpp b/coding/blob_indexer.hpp index 4aaa247028..3f23c1e3cc 100644 --- a/coding/blob_indexer.hpp +++ b/coding/blob_indexer.hpp @@ -9,9 +9,11 @@ class Writer; class BlobIndexer { public: + typedef function CompressorType; + BlobIndexer(Writer & writer, size_t maxUncompressedChunkSize, - function const & compressor); + CompressorType const & compressor); ~BlobIndexer(); // Add blob and return its id. @@ -24,7 +26,7 @@ private: Writer & m_writer; size_t const m_maxUncompressedChunkSize; - function const m_compressor; + CompressorType m_compressor; static uint32_t const BITS_IN_CHUNK_SIZE = 20; diff --git a/coding/blob_storage.cpp b/coding/blob_storage.cpp index 0838838e98..d35f7e13ba 100644 --- a/coding/blob_storage.cpp +++ b/coding/blob_storage.cpp @@ -6,7 +6,8 @@ // nb - number of blobs // nc - number of chunks // -// [4| Header = "Blb1"] +// [3| Header = "Blb"] +// [1| logMaxChunkSize] // [*| Chunk 0 ] [*| Chunk 1 ] ... [*| Chunk nc-1] // [4| Chunk 1 pos] [4| Chunk 2 pos] ... [4| Pos after the last chunk] // [4| Blob info 0] [4| Blob info 1] ... [4| Blob info nb-1] @@ -23,7 +24,7 @@ BlobStorage::BlobStorage(Reader const * pReader, - function decompressor) : + DecompressorType const & decompressor) : m_pReader(pReader), m_decompressor(decompressor) { Init(); diff --git a/coding/blob_storage.hpp b/coding/blob_storage.hpp index e1aa0ba194..e909f74e34 100644 --- a/coding/blob_storage.hpp +++ b/coding/blob_storage.hpp @@ -14,9 +14,11 @@ class BlobStorage public: DECLARE_EXCEPTION(OpenException, RootException); + typedef function DecompressorType; + // Takes ownership of pReader and deletes it, even if exception is thrown. BlobStorage(Reader const * pReader, - function decompressor); + DecompressorType const & decompressor); ~BlobStorage(); // Get blob by its number, starting from 0. @@ -35,7 +37,7 @@ private: static uint32_t const START_OFFSET = 4; scoped_ptr m_pReader; - function m_decompressor; + DecompressorType m_decompressor; DDVector m_blobInfo; DDVector m_chunkOffset;