From 655ecf950a21e627dffcb567547d99338502e148 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 24 Mar 2024 21:20:44 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- src/chunkedstorage.cc | 14 ++++---------- src/chunkedstorage.hh | 4 ++-- src/dict/mdx.cc | 10 +++++----- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/chunkedstorage.cc b/src/chunkedstorage.cc index 1087a90677..459963d432 100644 --- a/src/chunkedstorage.cc +++ b/src/chunkedstorage.cc @@ -70,11 +70,8 @@ void Writer::saveCurrentChunk() bufferCompressed.resize( maxCompressedSize ); - const size_t size_or_err = ZSTD_compress2( zstd_cctx.get(), - bufferCompressed.data(), - bufferCompressed.size(), - buffer.data(), - bufferUsed ); + const size_t size_or_err = + ZSTD_compress2( zstd_cctx.get(), bufferCompressed.data(), bufferCompressed.size(), buffer.data(), bufferUsed ); if ( ZSTD_isError( size_or_err ) ) { throw exFailedToCompressChunk(); } @@ -172,11 +169,8 @@ char * Reader::getBlock( uint32_t address, vector< char > & chunk ) unsigned long decompressedLength = chunk.size(); - size_t const size_or_err = ZSTD_decompressDCtx( zstd_dctx.get(), - chunk.data(), - decompressedLength, - chunkDataBytes, - compressedSize ); + size_t const size_or_err = + ZSTD_decompressDCtx( zstd_dctx.get(), chunk.data(), decompressedLength, chunkDataBytes, compressedSize ); if ( ZSTD_isError( size_or_err ) || size_or_err != chunk.size() ) { throw exFailedToDecompressChunk(); diff --git a/src/chunkedstorage.hh b/src/chunkedstorage.hh index 8d2a773a71..5bf06415e6 100644 --- a/src/chunkedstorage.hh +++ b/src/chunkedstorage.hh @@ -80,7 +80,7 @@ private: void saveCurrentChunk(); - std::unique_ptr zstd_cctx; + std::unique_ptr< ZSTD_CCtx, zstd_deleter > zstd_cctx; }; /// This class reads data blocks previously written by Writer. @@ -100,7 +100,7 @@ public: char * getBlock( uint32_t address, vector< char > & ); private: - std::unique_ptr zstd_dctx; + std::unique_ptr< ZSTD_DCtx, zstd_deleter > zstd_dctx; }; } // namespace ChunkedStorage diff --git a/src/dict/mdx.cc b/src/dict/mdx.cc index a4834cf166..8b07eb392b 100644 --- a/src/dict/mdx.cc +++ b/src/dict/mdx.cc @@ -1270,12 +1270,12 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f string dictId = Dictionary::makeDictionaryId( dictFiles ); string indexFile = indicesDir + dictId; - int t = 20; -mdxbench: + int t = 20; + mdxbench: if ( true ) { // Building the index - // gdDebug( "MDict: Building the index for dictionary: %s\n", fileName.c_str() ); + // gdDebug( "MDict: Building the index for dictionary: %s\n", fileName.c_str() ); auto index_begin = std::chrono::high_resolution_clock::now(); MdictParser parser; @@ -1435,8 +1435,8 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f idx.rewind(); idx.write( &idxHeader, sizeof( idxHeader ) ); - auto index_finish = std::chrono::high_resolution_clock::now(); - std::chrono::duration c = index_finish - index_begin; + auto index_finish = std::chrono::high_resolution_clock::now(); + std::chrono::duration< double, std::milli > c = index_finish - index_begin; qDebug() << c; t = t - 1;