diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/json/fast_sax | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/json/fast_sax')
-rw-r--r-- | library/cpp/json/fast_sax/parser.h | 22 | ||||
-rw-r--r-- | library/cpp/json/fast_sax/parser.rl6 | 14 | ||||
-rw-r--r-- | library/cpp/json/fast_sax/unescape.cpp | 12 | ||||
-rw-r--r-- | library/cpp/json/fast_sax/unescape.h | 10 | ||||
-rw-r--r-- | library/cpp/json/fast_sax/ya.make | 24 |
5 files changed, 41 insertions, 41 deletions
diff --git a/library/cpp/json/fast_sax/parser.h b/library/cpp/json/fast_sax/parser.h index b5f031dd9e..31f5348da9 100644 --- a/library/cpp/json/fast_sax/parser.h +++ b/library/cpp/json/fast_sax/parser.h @@ -1,13 +1,13 @@ -#pragma once - +#pragma once + #include <library/cpp/json/common/defs.h> - -namespace NJson { - bool ReadJsonFast(TStringBuf in, TJsonCallbacks* callbacks); - - inline bool ValidateJsonFast(TStringBuf in, bool throwOnError = false) { + +namespace NJson { + bool ReadJsonFast(TStringBuf in, TJsonCallbacks* callbacks); + + inline bool ValidateJsonFast(TStringBuf in, bool throwOnError = false) { Y_ASSERT(false); // this method is broken, see details in IGNIETFERRO-1243. Use NJson::ValidateJson instead, or fix this one before using - TJsonCallbacks c(throwOnError); - return ReadJsonFast(in, &c); - } -} + TJsonCallbacks c(throwOnError); + return ReadJsonFast(in, &c); + } +} diff --git a/library/cpp/json/fast_sax/parser.rl6 b/library/cpp/json/fast_sax/parser.rl6 index edb4e9ee1b..0f1ad3b3b1 100644 --- a/library/cpp/json/fast_sax/parser.rl6 +++ b/library/cpp/json/fast_sax/parser.rl6 @@ -2,7 +2,7 @@ #include <library/cpp/json/fast_sax/parser.h> #include <util/string/cast.h> -#include <util/generic/buffer.h> +#include <util/generic/buffer.h> #include <util/generic/strbuf.h> #include <util/generic/ymath.h> @@ -15,7 +15,7 @@ enum EStoredStr { struct TParserCtx { TJsonCallbacks& Hndl; - TBuffer Buffer; + TBuffer Buffer; TStringBuf String; EStoredStr Stored = SS_NONE; bool ExpectValue = true; @@ -142,9 +142,9 @@ struct TParserCtx { } bool OnStrE() { - Buffer.Clear(); - Buffer.Reserve(2 * (te - ts)); - + Buffer.Clear(); + Buffer.Reserve(2 * (te - ts)); + return OnString(UnescapeJsonUnicode(TStringBuf(ts + 1, te - ts - 2), Buffer.data()), SS_MUSTCOPY); } @@ -170,8 +170,8 @@ struct TParserCtx { Stored = SS_NONE; switch (stored) { - default: - return false; + default: + return false; case SS_NOCOPY: return Hndl.OnMapKeyNoCopy(String); case SS_MUSTCOPY: diff --git a/library/cpp/json/fast_sax/unescape.cpp b/library/cpp/json/fast_sax/unescape.cpp index 72109b0b5e..772fe92a0d 100644 --- a/library/cpp/json/fast_sax/unescape.cpp +++ b/library/cpp/json/fast_sax/unescape.cpp @@ -1,7 +1,7 @@ -#include "unescape.h" - -#include <util/string/escape.h> - -TStringBuf UnescapeJsonUnicode(TStringBuf data, char* scratch) { +#include "unescape.h" + +#include <util/string/escape.h> + +TStringBuf UnescapeJsonUnicode(TStringBuf data, char* scratch) { return TStringBuf(scratch, UnescapeC(data.data(), data.size(), scratch)); -} +} diff --git a/library/cpp/json/fast_sax/unescape.h b/library/cpp/json/fast_sax/unescape.h index 5e40e1e866..55315548bc 100644 --- a/library/cpp/json/fast_sax/unescape.h +++ b/library/cpp/json/fast_sax/unescape.h @@ -1,5 +1,5 @@ -#pragma once - -#include <util/generic/strbuf.h> - -TStringBuf UnescapeJsonUnicode(TStringBuf data, char* scratch); +#pragma once + +#include <util/generic/strbuf.h> + +TStringBuf UnescapeJsonUnicode(TStringBuf data, char* scratch); diff --git a/library/cpp/json/fast_sax/ya.make b/library/cpp/json/fast_sax/ya.make index c6447ab6ac..46e5c7c5d9 100644 --- a/library/cpp/json/fast_sax/ya.make +++ b/library/cpp/json/fast_sax/ya.make @@ -1,17 +1,17 @@ -LIBRARY() - +LIBRARY() + OWNER( pg velavokr ) - -PEERDIR( + +PEERDIR( library/cpp/json/common -) - -SRCS( - parser.rl6 - unescape.cpp -) - -END() +) + +SRCS( + parser.rl6 + unescape.cpp +) + +END() |