From 725bd4046f18572b8bb2f734ae25afffbfdf43a0 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Mon, 20 Nov 2017 07:37:54 +0300 Subject: [PATCH] Miscellaneous [#CLICKHOUSE-2]. --- dbms/src/IO/ReadHelpers.h | 4 ++-- dbms/src/IO/WriteHelpers.h | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dbms/src/IO/ReadHelpers.h b/dbms/src/IO/ReadHelpers.h index 5c662876e2d..50849c44b4b 100644 --- a/dbms/src/IO/ReadHelpers.h +++ b/dbms/src/IO/ReadHelpers.h @@ -322,7 +322,7 @@ void readIntTextUnsafe(T & x, ReadBuffer & buf) return on_error(); } - if (*buf.position() == '0') /// There are many zeros in real datasets. + if (*buf.position() == '0') /// There are many zeros in real datasets. { ++buf.position(); return; @@ -330,7 +330,7 @@ void readIntTextUnsafe(T & x, ReadBuffer & buf) while (!buf.eof()) { - if ((*buf.position() & 0xF0) == 0x30) /// It makes sense to have this condition inside loop. + if ((*buf.position() & 0xF0) == 0x30) /// It makes sense to have this condition inside loop. { x *= 10; x += *buf.position() & 0x0F; diff --git a/dbms/src/IO/WriteHelpers.h b/dbms/src/IO/WriteHelpers.h index 60963f9b776..ac21ab33a33 100644 --- a/dbms/src/IO/WriteHelpers.h +++ b/dbms/src/IO/WriteHelpers.h @@ -417,7 +417,7 @@ void writeCSVString(const char * begin, const char * end, WriteBuffer & buf) buf.write(pos, end - pos); break; } - else /// Quotation. + else /// Quotation. { ++next_pos; buf.write(pos, next_pos - pos); @@ -658,18 +658,18 @@ template inline typename std::enable_if::value, void>::type writeText(const T & x, WriteBuffer & buf) { writeFloatText(x, buf); } -inline void writeText(const String & x, WriteBuffer & buf) { writeEscapedString(x, buf); } +inline void writeText(const String & x, WriteBuffer & buf) { writeEscapedString(x, buf); } /// Implemented as template specialization (not function overload) to avoid preference over templates on arithmetic types above. template <> inline void writeText(const bool & x, WriteBuffer & buf) { writeBoolText(x, buf); } /// unlike the method for std::string /// assumes here that `x` is a null-terminated string. -inline void writeText(const char * x, WriteBuffer & buf) { writeEscapedString(x, strlen(x), buf); } +inline void writeText(const char * x, WriteBuffer & buf) { writeEscapedString(x, strlen(x), buf); } inline void writeText(const char * x, size_t size, WriteBuffer & buf) { writeEscapedString(x, size, buf); } -inline void writeText(const LocalDate & x, WriteBuffer & buf) { writeDateText(x, buf); } -inline void writeText(const LocalDateTime & x, WriteBuffer & buf) { writeDateTimeText(x, buf); } +inline void writeText(const LocalDate & x, WriteBuffer & buf) { writeDateText(x, buf); } +inline void writeText(const LocalDateTime & x, WriteBuffer & buf) { writeDateTimeText(x, buf); } inline void writeText(const UUID & x, WriteBuffer & buf) { writeUUIDText(x, buf); } inline void writeText(const UInt128 & x, WriteBuffer & buf) { @@ -684,16 +684,16 @@ template inline typename std::enable_if::value, void>::type writeQuoted(const T & x, WriteBuffer & buf) { writeText(x, buf); } -inline void writeQuoted(const String & x, WriteBuffer & buf) { writeQuotedString(x, buf); } +inline void writeQuoted(const String & x, WriteBuffer & buf) { writeQuotedString(x, buf); } -inline void writeQuoted(const LocalDate & x, WriteBuffer & buf) +inline void writeQuoted(const LocalDate & x, WriteBuffer & buf) { writeChar('\'', buf); writeDateText(x, buf); writeChar('\'', buf); } -inline void writeQuoted(const LocalDateTime & x, WriteBuffer & buf) +inline void writeQuoted(const LocalDateTime & x, WriteBuffer & buf) { writeChar('\'', buf); writeDateTimeText(x, buf); @@ -706,16 +706,16 @@ template inline typename std::enable_if::value, void>::type writeDoubleQuoted(const T & x, WriteBuffer & buf) { writeText(x, buf); } -inline void writeDoubleQuoted(const String & x, WriteBuffer & buf) { writeDoubleQuotedString(x, buf); } +inline void writeDoubleQuoted(const String & x, WriteBuffer & buf) { writeDoubleQuotedString(x, buf); } -inline void writeDoubleQuoted(const LocalDate & x, WriteBuffer & buf) +inline void writeDoubleQuoted(const LocalDate & x, WriteBuffer & buf) { writeChar('"', buf); writeDateText(x, buf); writeChar('"', buf); } -inline void writeDoubleQuoted(const LocalDateTime & x, WriteBuffer & buf) +inline void writeDoubleQuoted(const LocalDateTime & x, WriteBuffer & buf) { writeChar('"', buf); writeDateTimeText(x, buf); @@ -735,8 +735,8 @@ template inline typename std::enable_if::value, void>::type writeCSV(const T & x, WriteBuffer & buf) { writeText(x, buf); } -inline void writeCSV(const String & x, WriteBuffer & buf) { writeCSVString<>(x, buf); } -inline void writeCSV(const LocalDate & x, WriteBuffer & buf) { writeDoubleQuoted(x, buf); } +inline void writeCSV(const String & x, WriteBuffer & buf) { writeCSVString<>(x, buf); } +inline void writeCSV(const LocalDate & x, WriteBuffer & buf) { writeDoubleQuoted(x, buf); } inline void writeCSV(const LocalDateTime & x, WriteBuffer & buf) { writeDoubleQuoted(x, buf); } inline void writeCSV(const UUID & x, WriteBuffer & buf) { writeDoubleQuoted(x, buf); } inline void writeCSV(const UInt128, WriteBuffer & buf)