aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/guid.cpp
diff options
context:
space:
mode:
authorrureggaeton <rureggaeton@yandex-team.ru>2022-02-10 16:52:06 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:52:06 +0300
commitc51a16470c0065cef7d3f961d0cbe80cf5e6a0fd (patch)
treeab7fbbf3253d4c0e2793218f09378908beb025fb /util/generic/guid.cpp
parent91bfae66f7b3d41b1f6b7beddec5d2d114ceb597 (diff)
downloadydb-c51a16470c0065cef7d3f961d0cbe80cf5e6a0fd.tar.gz
Restoring authorship annotation for <rureggaeton@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/guid.cpp')
-rw-r--r--util/generic/guid.cpp120
1 files changed, 60 insertions, 60 deletions
diff --git a/util/generic/guid.cpp b/util/generic/guid.cpp
index 69004896bf..8b907457bc 100644
--- a/util/generic/guid.cpp
+++ b/util/generic/guid.cpp
@@ -73,20 +73,20 @@ TString CreateGuidAsString() {
return TGUID::Create().AsGuidString();
}
-static bool GetDigit(const char c, ui32& digit) {
- digit = 0;
- if ('0' <= c && c <= '9') {
- digit = c - '0';
- } else if ('a' <= c && c <= 'f') {
- digit = c - 'a' + 10;
- } else if ('A' <= c && c <= 'F') {
- digit = c - 'A' + 10;
- } else {
- return false; // non-hex character
- }
- return true;
-}
-
+static bool GetDigit(const char c, ui32& digit) {
+ digit = 0;
+ if ('0' <= c && c <= '9') {
+ digit = c - '0';
+ } else if ('a' <= c && c <= 'f') {
+ digit = c - 'a' + 10;
+ } else if ('A' <= c && c <= 'F') {
+ digit = c - 'A' + 10;
+ } else {
+ return false; // non-hex character
+ }
+ return true;
+}
+
bool GetGuid(const TStringBuf s, TGUID& result) {
size_t partId = 0;
ui64 partValue = 0;
@@ -107,8 +107,8 @@ bool GetGuid(const TStringBuf s, TGUID& result) {
}
ui32 digit = 0;
- if (!GetDigit(c, digit)) {
- return false;
+ if (!GetDigit(c, digit)) {
+ return false;
}
partValue = partValue * 16 + digit;
@@ -138,49 +138,49 @@ TGUID GetGuid(const TStringBuf s) {
return TGUID();
}
-
+
bool GetUuid(const TStringBuf s, TGUID& result) {
- if (s.size() != 36) {
- return false;
- }
-
- size_t partId = 0;
- ui64 partValue = 0;
- size_t digitCount = 0;
-
- for (size_t i = 0; i < s.size(); ++i) {
- const char c = s[i];
-
- if (c == '-') {
- if (i != 8 && i != 13 && i != 18 && i != 23) {
- return false;
- }
- continue;
- }
-
- ui32 digit = 0;
- if (!GetDigit(c, digit)) {
- return false;
- }
-
- partValue = partValue * 16 + digit;
-
- if (++digitCount == 8) {
- result.dw[partId++] = partValue;
- digitCount = 0;
- }
- }
- return true;
-}
-
-// Parses GUID from uuid and checks that it's valid.
-// In case of error returns TGUID().
+ if (s.size() != 36) {
+ return false;
+ }
+
+ size_t partId = 0;
+ ui64 partValue = 0;
+ size_t digitCount = 0;
+
+ for (size_t i = 0; i < s.size(); ++i) {
+ const char c = s[i];
+
+ if (c == '-') {
+ if (i != 8 && i != 13 && i != 18 && i != 23) {
+ return false;
+ }
+ continue;
+ }
+
+ ui32 digit = 0;
+ if (!GetDigit(c, digit)) {
+ return false;
+ }
+
+ partValue = partValue * 16 + digit;
+
+ if (++digitCount == 8) {
+ result.dw[partId++] = partValue;
+ digitCount = 0;
+ }
+ }
+ return true;
+}
+
+// Parses GUID from uuid and checks that it's valid.
+// In case of error returns TGUID().
TGUID GetUuid(const TStringBuf s) {
- TGUID result;
-
- if (GetUuid(s, result)) {
- return result;
- }
-
- return TGUID();
-}
+ TGUID result;
+
+ if (GetUuid(s, result)) {
+ return result;
+ }
+
+ return TGUID();
+}