mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 21:12:28 +00:00
fix codestyle
This commit is contained in:
parent
53a064b6e3
commit
87cc3546ca
@ -1,7 +1,9 @@
|
||||
#include <IO/LzmaReadBuffer.h>
|
||||
|
||||
namespace DB {
|
||||
namespace ErrorCodes {
|
||||
namespace DB
|
||||
{
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int LZMA_STREAM_DECODER_FAILED;
|
||||
}
|
||||
LzmaReadBuffer::LzmaReadBuffer(std::unique_ptr<ReadBuffer> in_, size_t buf_size, char * existing_memory, size_t alignment)
|
||||
@ -20,8 +22,9 @@ LzmaReadBuffer::LzmaReadBuffer(std::unique_ptr<ReadBuffer> in_, size_t buf_size,
|
||||
lzma_ret ret = lzma_stream_decoder(&lstr, memlimit, LZMA_CONCATENATED);
|
||||
// lzma does not provide api for converting error code to string unlike zlib
|
||||
if (ret != LZMA_OK)
|
||||
throw Exception(std::string("lzma_stream_decoder initialization failed: error code: ") + std::to_string(ret) + "; lzma version: "
|
||||
+ LZMA_VERSION_STRING,
|
||||
throw Exception(
|
||||
std::string("lzma_stream_decoder initialization failed: error code: ") + std::to_string(ret)
|
||||
+ "; lzma version: " + LZMA_VERSION_STRING,
|
||||
ErrorCodes::LZMA_STREAM_DECODER_FAILED);
|
||||
}
|
||||
|
||||
@ -35,7 +38,8 @@ bool LzmaReadBuffer::nextImpl()
|
||||
if (eof)
|
||||
return false;
|
||||
|
||||
if (!lstr.avail_in) {
|
||||
if (!lstr.avail_in)
|
||||
{
|
||||
in->nextIfAtEnd();
|
||||
lstr.next_in = reinterpret_cast<unsigned char *>(in->position());
|
||||
lstr.avail_in = in->buffer().end() - in->position();
|
||||
@ -48,12 +52,17 @@ bool LzmaReadBuffer::nextImpl()
|
||||
in->position() = in->buffer().end() - lstr.avail_in;
|
||||
working_buffer.resize(internal_buffer.size() - lstr.avail_out);
|
||||
|
||||
if (ret == LZMA_STREAM_END) {
|
||||
if (in->eof()) {
|
||||
if (ret == LZMA_STREAM_END)
|
||||
{
|
||||
if (in->eof())
|
||||
{
|
||||
eof = true;
|
||||
return working_buffer.size() != 0;
|
||||
} else {
|
||||
throw Exception(ErrorCodes::LZMA_STREAM_DECODER_FAILED,
|
||||
}
|
||||
else
|
||||
{
|
||||
throw Exception(
|
||||
ErrorCodes::LZMA_STREAM_DECODER_FAILED,
|
||||
"lzma decoder finished, but stream is still alive: error code: {}; lzma version: {}",
|
||||
ret,
|
||||
LZMA_VERSION_STRING);
|
||||
@ -61,7 +70,8 @@ bool LzmaReadBuffer::nextImpl()
|
||||
}
|
||||
|
||||
if (ret != LZMA_OK)
|
||||
throw Exception(ErrorCodes::LZMA_STREAM_DECODER_FAILED,
|
||||
throw Exception(
|
||||
ErrorCodes::LZMA_STREAM_DECODER_FAILED,
|
||||
"lzma_stream_decoder failed: error code: error codeL {}; lzma version: {}",
|
||||
ret,
|
||||
LZMA_VERSION_STRING);
|
||||
|
Loading…
Reference in New Issue
Block a user