Browse Source

Restoring authorship annotation for <xpahos@yandex-team.ru>. Commit 2 of 2.

xpahos 3 years ago
parent
commit
da8fe75e5a

+ 11 - 11
build/rules/go/vendor.policy

@@ -163,9 +163,9 @@ ALLOW .* -> vendor/go.etcd.io/etcd/pkg/types
 # logging to systemd
 ALLOW .* -> vendor/github.com/coreos/go-systemd/journal
 
-# CONTRIB-2336 logging to systemd v22 
-ALLOW .* -> vendor/github.com/coreos/go-systemd/v22/journal 
- 
+# CONTRIB-2336 logging to systemd v22
+ALLOW .* -> vendor/github.com/coreos/go-systemd/v22/journal
+
 # systemd dbus
 ALLOW .* -> vendor/github.com/coreos/go-systemd/v22/dbus
 
@@ -719,10 +719,10 @@ ALLOW .* -> vendor/github.com/insomniacslk/dhcp
 ALLOW .* -> vendor/github.com/osrg/gobgp
 
 #
-# CONTRIB-2097 QUIC(HTTP/3) implementation library 
-# 
-ALLOW .* -> vendor/github.com/lucas-clemente/quic-go 
- 
+# CONTRIB-2097 QUIC(HTTP/3) implementation library
+#
+ALLOW .* -> vendor/github.com/lucas-clemente/quic-go
+
 # CONTRIB-2111 distributed lock on redis
 ALLOW .* -> vendor/github.com/go-redsync/redsync/v4
 
@@ -860,7 +860,7 @@ ALLOW .* -> vendor/github.com/pkg/xattr
 # CONTRIB-2452
 ALLOW .* -> vendor/github.com/scim2/filter-parser/v2
 
-# 
+#
 # Tools
 #
 
@@ -1021,9 +1021,9 @@ ALLOW transfer_manager/go/pkg/source/eventhub -> vendor/github.com/Azure/azure-a
 ALLOW trust/psp/core/go -> vendor/github.com/gorilla/mux
 ALLOW trust/psp/core/handler -> vendor/github.com/gorilla/mux
 
-# CONTRIB-2337 Cloud GPU migration: validator for structs and fields 
-ALLOW cloud/compute/go-common/pkg/validation -> vendor/github.com/go-playground/validator/v10 
- 
+# CONTRIB-2337 Cloud GPU migration: validator for structs and fields
+ALLOW cloud/compute/go-common/pkg/validation -> vendor/github.com/go-playground/validator/v10
+
 # CONTRIB-2412
 ALLOW infra/infractl/.* -> vendor/github.com/google/gnostic/openapiv3
 ALLOW infra/infractl/.* -> vendor/github.com/google/gnostic/compiler

+ 6 - 6
contrib/libs/rapidjson/include/rapidjson/reader.h

@@ -153,7 +153,7 @@ enum ParseFlag {
     kParseNumbersAsStringsFlag = 64,    //!< Parse all numbers (ints/doubles) as strings.
     kParseTrailingCommasFlag = 128, //!< Allow trailing commas at the end of objects and arrays.
     kParseNanAndInfFlag = 256,      //!< Allow parsing NaN, Inf, Infinity, -Inf and -Infinity as doubles.
-    kParseEscapedApostropheFlag = 512,  //!< Allow escaped apostrophe in strings. 
+    kParseEscapedApostropheFlag = 512,  //!< Allow escaped apostrophe in strings.
     kParseDefaultFlags = RAPIDJSON_PARSE_DEFAULT_FLAGS  //!< Default parse flags. Can be customized by defining RAPIDJSON_PARSE_DEFAULT_FLAGS
 };
 
@@ -905,7 +905,7 @@ private:
 //!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN
 #define Z16 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
         static const char escape[256] = {
-            Z16, Z16, 0, 0,'\"', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '/', 
+            Z16, Z16, 0, 0,'\"', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '/',
             Z16, Z16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,'\\', 0, 0, 0,
             0, 0,'\b', 0, 0, 0,'\f', 0, 0, 0, 0, 0, 0, 0,'\n', 0,
             0, 0,'\r', 0,'\t', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -928,10 +928,10 @@ private:
                     is.Take();
                     os.Put(static_cast<typename TEncoding::Ch>(escape[static_cast<unsigned char>(e)]));
                 }
-                else if ((parseFlags & kParseEscapedApostropheFlag) && RAPIDJSON_LIKELY(e == '\'')) { // Allow escaped apostrophe 
-                    is.Take(); 
-                    os.Put('\''); 
-                } 
+                else if ((parseFlags & kParseEscapedApostropheFlag) && RAPIDJSON_LIKELY(e == '\'')) { // Allow escaped apostrophe
+                    is.Take();
+                    os.Put('\'');
+                }
                 else if (RAPIDJSON_LIKELY(e == 'u')) {    // Unicode
                     is.Take();
                     unsigned codepoint = ParseHex4(is, escapeOffset);

+ 1 - 1
contrib/tools/bison/gnulib/src/vasnprintf.c

@@ -4870,7 +4870,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #endif
                   *fbp = dp->conversion;
 #if USE_SNPRINTF
-# if !defined(__APPLE__) && !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) 
+# if !defined(__APPLE__) && !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
                 fbp[1] = '%';
                 fbp[2] = 'n';
                 fbp[3] = '\0';

+ 35 - 35
library/cpp/json/json_reader.cpp

@@ -312,37 +312,37 @@ namespace NJson {
                   rapidjson::Reader& reader,
                   TRapidJsonCompliantInputStream& is,
                   THandler& handler) {
- 
-            ui8 flags = ReaderConfigToRapidJsonFlags::NOCOMMENTS_VALID_NOESCAPE; 
- 
+
+            ui8 flags = ReaderConfigToRapidJsonFlags::NOCOMMENTS_VALID_NOESCAPE;
+
             if (config.AllowComments) {
-                flags |= ReaderConfigFlags::COMMENTS; 
-            } 
- 
-            if (config.DontValidateUtf8) { 
-                flags &= ~(ReaderConfigFlags::VALIDATE); 
-            } 
- 
-            if (config.AllowEscapedApostrophe) { 
-                flags |= ReaderConfigFlags::ESCAPE; 
-            } 
- 
-            switch (flags) { 
-                case ReaderConfigToRapidJsonFlags::COMMENTS_NOVALID_NOESCAPE: 
+                flags |= ReaderConfigFlags::COMMENTS;
+            }
+
+            if (config.DontValidateUtf8) {
+                flags &= ~(ReaderConfigFlags::VALIDATE);
+            }
+
+            if (config.AllowEscapedApostrophe) {
+                flags |= ReaderConfigFlags::ESCAPE;
+            }
+
+            switch (flags) {
+                case ReaderConfigToRapidJsonFlags::COMMENTS_NOVALID_NOESCAPE:
                     return reader.Parse<rapidjson::kParseCommentsFlag>(is, handler);
-                case ReaderConfigToRapidJsonFlags::COMMENTS_VALID_NOESCAPE: 
+                case ReaderConfigToRapidJsonFlags::COMMENTS_VALID_NOESCAPE:
                     return reader.Parse<rapidjson::kParseCommentsFlag | rapidjson::kParseValidateEncodingFlag>(is, handler);
-                case ReaderConfigToRapidJsonFlags::COMMENTS_VALID_ESCAPE: 
-                    return reader.Parse<rapidjson::kParseCommentsFlag | rapidjson::kParseValidateEncodingFlag | rapidjson::kParseEscapedApostropheFlag>(is, handler); 
-                case ReaderConfigToRapidJsonFlags::COMMENTS_NOVALID_ESCAPE: 
-                    return reader.Parse<rapidjson::kParseCommentsFlag | rapidjson::kParseEscapedApostropheFlag>(is, handler); 
-                case ReaderConfigToRapidJsonFlags::NOCOMMENTS_VALID_NOESCAPE: 
-                    return reader.Parse<rapidjson::kParseValidateEncodingFlag>(is, handler); 
-                case ReaderConfigToRapidJsonFlags::NOCOMMENTS_VALID_ESCAPE: 
-                    return reader.Parse<rapidjson::kParseValidateEncodingFlag | rapidjson::kParseEscapedApostropheFlag>(is, handler); 
-                case  ReaderConfigToRapidJsonFlags::NOCOMMENTS_NOVALID_ESCAPE: 
-                    return reader.Parse<rapidjson::kParseEscapedApostropheFlag>(is, handler); 
-                default: 
+                case ReaderConfigToRapidJsonFlags::COMMENTS_VALID_ESCAPE:
+                    return reader.Parse<rapidjson::kParseCommentsFlag | rapidjson::kParseValidateEncodingFlag | rapidjson::kParseEscapedApostropheFlag>(is, handler);
+                case ReaderConfigToRapidJsonFlags::COMMENTS_NOVALID_ESCAPE:
+                    return reader.Parse<rapidjson::kParseCommentsFlag | rapidjson::kParseEscapedApostropheFlag>(is, handler);
+                case ReaderConfigToRapidJsonFlags::NOCOMMENTS_VALID_NOESCAPE:
+                    return reader.Parse<rapidjson::kParseValidateEncodingFlag>(is, handler);
+                case ReaderConfigToRapidJsonFlags::NOCOMMENTS_VALID_ESCAPE:
+                    return reader.Parse<rapidjson::kParseValidateEncodingFlag | rapidjson::kParseEscapedApostropheFlag>(is, handler);
+                case  ReaderConfigToRapidJsonFlags::NOCOMMENTS_NOVALID_ESCAPE:
+                    return reader.Parse<rapidjson::kParseEscapedApostropheFlag>(is, handler);
+                default:
                     return reader.Parse<rapidjson::kParseNoFlags>(is, handler);
             }
         }
@@ -523,13 +523,13 @@ namespace NJson {
         return ReadJson(in, &config, cbs);
     }
 
-    bool ReadJson(IInputStream* in, bool allowComments, bool allowEscapedApostrophe, TJsonCallbacks* cbs) { 
-        TJsonReaderConfig config; 
-        config.AllowComments = allowComments; 
-        config.AllowEscapedApostrophe = allowEscapedApostrophe; 
-        return ReadJson(in, &config, cbs); 
-    } 
- 
+    bool ReadJson(IInputStream* in, bool allowComments, bool allowEscapedApostrophe, TJsonCallbacks* cbs) {
+        TJsonReaderConfig config;
+        config.AllowComments = allowComments;
+        config.AllowEscapedApostrophe = allowEscapedApostrophe;
+        return ReadJson(in, &config, cbs);
+    }
+
     bool ReadJson(IInputStream* in, const TJsonReaderConfig* config, TJsonCallbacks* cbs) {
         TJsonCallbacksWrapper wrapper(*cbs);
         TInputStreamWrapper is(*in);

+ 18 - 18
library/cpp/json/json_reader.h

@@ -18,7 +18,7 @@ namespace NJson {
         // js-style comments (both // and /**/)
         bool AllowComments = false;
         bool DontValidateUtf8 = false;
-        bool AllowEscapedApostrophe = false; 
+        bool AllowEscapedApostrophe = false;
 
         void SetBufferSize(size_t bufferSize);
         size_t GetBufferSize() const;
@@ -41,25 +41,25 @@ namespace NJson {
 
     bool ReadJson(IInputStream* in, TJsonCallbacks* callbacks);
     bool ReadJson(IInputStream* in, bool allowComments, TJsonCallbacks* callbacks);
-    bool ReadJson(IInputStream* in, bool allowComments, bool allowEscapedApostrophe, TJsonCallbacks* callbacks); 
+    bool ReadJson(IInputStream* in, bool allowComments, bool allowEscapedApostrophe, TJsonCallbacks* callbacks);
     bool ReadJson(IInputStream* in, const TJsonReaderConfig* config, TJsonCallbacks* callbacks);
 
-    enum ReaderConfigFlags { 
-        COMMENTS = 0b100, 
-        VALIDATE = 0b010, 
-        ESCAPE = 0b001, 
-    }; 
- 
-    enum ReaderConfigToRapidJsonFlags { 
-        COMMENTS_NOVALID_NOESCAPE = 0b100, 
-        COMMENTS_VALID_NOESCAPE = 0b110, 
-        COMMENTS_VALID_ESCAPE = 0b111, 
-        COMMENTS_NOVALID_ESCAPE = 0b101, 
-        NOCOMMENTS_VALID_NOESCAPE = 0b010, 
-        NOCOMMENTS_VALID_ESCAPE = 0b011, 
-        NOCOMMENTS_NOVALID_ESCAPE = 0b001, 
-    }; 
- 
+    enum ReaderConfigFlags {
+        COMMENTS = 0b100,
+        VALIDATE = 0b010,
+        ESCAPE = 0b001,
+    };
+
+    enum ReaderConfigToRapidJsonFlags {
+        COMMENTS_NOVALID_NOESCAPE = 0b100,
+        COMMENTS_VALID_NOESCAPE = 0b110,
+        COMMENTS_VALID_ESCAPE = 0b111,
+        COMMENTS_NOVALID_ESCAPE = 0b101,
+        NOCOMMENTS_VALID_NOESCAPE = 0b010,
+        NOCOMMENTS_VALID_ESCAPE = 0b011,
+        NOCOMMENTS_NOVALID_ESCAPE = 0b001,
+    };
+
     inline bool ValidateJson(IInputStream* in, const TJsonReaderConfig* config, bool throwOnError = false) {
         TJsonCallbacks c(throwOnError);
         return ReadJson(in, config, &c);

+ 23 - 23
library/cpp/json/ut/json_reader_ut.cpp

@@ -96,29 +96,29 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {
         UNIT_ASSERT_VALUES_EQUAL(result1, result2);
     }
 
-    Y_UNIT_TEST(TJsonEscapedApostrophe) { 
-        TString jsonString = "{ \"foo\" : \"bar\\'buzz\" }"; 
-        { 
-            TStringStream in; 
-            in << jsonString; 
-            TStringStream out; 
-            TJsonWriter writer(&out, false); 
-            TReformatCallbacks cb(writer); 
-            UNIT_ASSERT(!ReadJson(&in, &cb)); 
-        } 
- 
-        { 
-            TStringStream in; 
-            in << jsonString; 
-            TStringStream out; 
-            TJsonWriter writer(&out, false); 
-            TReformatCallbacks cb(writer); 
-            UNIT_ASSERT(ReadJson(&in, false, true, &cb)); 
-            writer.Flush(); 
-            UNIT_ASSERT_EQUAL(out.Str(), "[\"foo\",\"bar'buzz\"]"); 
-        } 
-    } 
- 
+    Y_UNIT_TEST(TJsonEscapedApostrophe) {
+        TString jsonString = "{ \"foo\" : \"bar\\'buzz\" }";
+        {
+            TStringStream in;
+            in << jsonString;
+            TStringStream out;
+            TJsonWriter writer(&out, false);
+            TReformatCallbacks cb(writer);
+            UNIT_ASSERT(!ReadJson(&in, &cb));
+        }
+
+        {
+            TStringStream in;
+            in << jsonString;
+            TStringStream out;
+            TJsonWriter writer(&out, false);
+            TReformatCallbacks cb(writer);
+            UNIT_ASSERT(ReadJson(&in, false, true, &cb));
+            writer.Flush();
+            UNIT_ASSERT_EQUAL(out.Str(), "[\"foo\",\"bar'buzz\"]");
+        }
+    }
+
     Y_UNIT_TEST(TJsonTreeTest) {
         TString data = "{\"intkey\": 10, \"double key\": 11.11, \"null value\":null, \"string key\": \"string\", \"array\": [1,2,3,\"TString\"], \"bool key\": true}";
         TStringStream in;

+ 8 - 8
util/datetime/base.cpp

@@ -181,10 +181,10 @@ TString TInstant::ToString() const {
     return ::ToString(*this);
 }
 
-TString TInstant::ToRfc822String() const { 
-    return FormatGmTime("%a, %d %b %Y %H:%M:%S GMT"); 
-} 
- 
+TString TInstant::ToRfc822String() const {
+    return FormatGmTime("%a, %d %b %Y %H:%M:%S GMT");
+}
+
 TString TInstant::ToStringUpToSeconds() const {
     char buf[64];
     auto len = FormatDate8601(buf, sizeof(buf), TimeT());
@@ -202,10 +202,10 @@ TString TInstant::ToStringLocal() const {
     return ::ToString(FormatLocal(*this));
 }
 
-TString TInstant::ToRfc822StringLocal() const { 
-    return FormatLocalTime("%a, %d %b %Y %H:%M:%S %Z"); 
-} 
- 
+TString TInstant::ToRfc822StringLocal() const {
+    return FormatLocalTime("%a, %d %b %Y %H:%M:%S %Z");
+}
+
 TString TInstant::ToIsoStringLocalUpToSeconds() const {
     return ::ToString(FormatIsoLocalUpToSeconds(*this));
 }

+ 14 - 14
util/datetime/base.h

@@ -452,13 +452,13 @@ public:
     TString ToString() const;
 
     /**
-     * Formats the instant using the UTC time zone. 
-     * 
-     * @returns An RFC822 formatted string, e.g. 'Sun, 06 Nov 1994 08:49:37 GMT'. 
-     */ 
-    TString ToRfc822String() const; 
- 
-    /** 
+     * Formats the instant using the UTC time zone.
+     *
+     * @returns An RFC822 formatted string, e.g. 'Sun, 06 Nov 1994 08:49:37 GMT'.
+     */
+    TString ToRfc822String() const;
+
+    /**
      * Formats the instant using the UTC time zone, with second precision.
      *
      * @returns An ISO 8601 formatted string, e.g. '2015-11-21T23:30:27Z'.
@@ -482,13 +482,13 @@ public:
     TString ToStringLocal() const;
 
     /**
-     * Formats the instant using the system time zone. 
-     * 
-     * @returns An RFC822 formatted string, e.g. 'Sun, 06 Nov 1994 08:49:37 MSK'. 
-     */ 
-    TString ToRfc822StringLocal() const; 
- 
-    /** 
+     * Formats the instant using the system time zone.
+     *
+     * @returns An RFC822 formatted string, e.g. 'Sun, 06 Nov 1994 08:49:37 MSK'.
+     */
+    TString ToRfc822StringLocal() const;
+
+    /**
      * Formats the instant using the system time zone, with second precision.
      *
      * @returns An ISO 8601 / RFC 3339 formatted string,

+ 4 - 4
util/datetime/base_ut.cpp

@@ -416,10 +416,10 @@ Y_UNIT_TEST_SUITE(DateTimeTest) {
         UNIT_ASSERT_VALUES_EQUAL(TString("2009-08-06T15:19:06Z"), (TInstant::Seconds(1249571946) + TDuration::MicroSeconds(23455)).ToStringUpToSeconds());
     }
 
-    Y_UNIT_TEST(TestInstantToRfc822String) { 
-        UNIT_ASSERT_VALUES_EQUAL(TString("Thu, 06 Aug 2009 15:19:06 GMT"), (TInstant::Seconds(1249571946) + TDuration::MicroSeconds(23455)).ToRfc822String()); 
-    } 
- 
+    Y_UNIT_TEST(TestInstantToRfc822String) {
+        UNIT_ASSERT_VALUES_EQUAL(TString("Thu, 06 Aug 2009 15:19:06 GMT"), (TInstant::Seconds(1249571946) + TDuration::MicroSeconds(23455)).ToRfc822String());
+    }
+
     Y_UNIT_TEST(TestInstantMath) {
         UNIT_ASSERT_VALUES_EQUAL(TInstant::Seconds(1719), TInstant::Seconds(1700) + TDuration::Seconds(19));
         // overflow

+ 7 - 7
util/network/socket.cpp

@@ -5,7 +5,7 @@
 #include "iovec.h"
 
 #include <util/system/defaults.h>
-#include <util/system/byteorder.h> 
+#include <util/system/byteorder.h>
 
 #if defined(_unix_)
     #include <netdb.h>
@@ -957,13 +957,13 @@ namespace {
         }
 
         inline bool IsLocalName(const char* name) const noexcept {
-            struct sockaddr_in sa; 
-            memset(&sa, 0, sizeof(sa)); 
- 
+            struct sockaddr_in sa;
+            memset(&sa, 0, sizeof(sa));
+
             if (inet_pton(AF_INET, name, &(sa.sin_addr)) == 1) {
-                return (InetToHost(sa.sin_addr.s_addr) >> 24) == 127; 
-            } 
- 
+                return (InetToHost(sa.sin_addr.s_addr) >> 24) == 127;
+            }
+
             return contains(name);
         }
     };

Some files were not shown because too many files changed in this diff