From 918d17ffeb6eaf00776fe2726b06d3ed525a9d8b Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Thu, 30 Aug 2018 23:57:00 +0300 Subject: [PATCH] Update FunctionsVisitParam.h --- dbms/src/Functions/FunctionsVisitParam.h | 28 +++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/dbms/src/Functions/FunctionsVisitParam.h b/dbms/src/Functions/FunctionsVisitParam.h index 8567f057a62..761d6236a83 100644 --- a/dbms/src/Functions/FunctionsVisitParam.h +++ b/dbms/src/Functions/FunctionsVisitParam.h @@ -87,12 +87,12 @@ struct ExtractBool struct ExtractRaw { - inline static void skipAfterQuotationIfNeed(const UInt8 ** pos, const UInt8 * end, ColumnString::Chars_t & res_data) + inline static void skipAfterQuotationIfNeed(const UInt8 *& pos, const UInt8 * end, ColumnString::Chars_t & res_data) { - if (*pos + 1 < end && *(*pos + 1) == '"') + if (pos + 1 < end && pos[1] == '"') { - res_data.push_back(**pos); - ++(*pos); + res_data.push_back(*pos); + ++pos; } } @@ -106,13 +106,21 @@ struct ExtractRaw expect_end.pop_back(); else { - switch(*pos) + switch (*pos) { - case '[' : expect_end.push_back(']'); break; - case '{' : expect_end.push_back('}'); break; - case '"' : expect_end.push_back('"'); break; - case '\\' : skipAfterQuotationIfNeed(&pos, end, res_data); break; - default : + case '[': + expect_end.push_back(']'); + break; + case '{': + expect_end.push_back('}'); + break; + case '"': + expect_end.push_back('"'); + break; + case '\\': + skipAfterQuotationIfNeed(pos, end, res_data); + break; + default: if (expect_end.empty() && (*pos == ',' || *pos == '}')) return; }