aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoragalakhov <agalakhov@yandex-team.ru>2022-02-10 16:49:51 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:51 +0300
commit8e39421d5f7b28ca12255c9a4fd8a6c593592588 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8
parent61a83e458f803c69f5d9d74e5d716cb95b3f2225 (diff)
downloadydb-8e39421d5f7b28ca12255c9a4fd8a6c593592588.tar.gz
Restoring authorship annotation for <agalakhov@yandex-team.ru>. Commit 2 of 2.
-rw-r--r--library/cpp/coroutine/engine/condvar.h6
-rw-r--r--library/cpp/coroutine/engine/events.h2
-rw-r--r--library/cpp/http/fetch/httpheader.h30
-rw-r--r--util/datetime/base.h8
-rw-r--r--util/datetime/parser.h36
-rw-r--r--util/datetime/parser.rl612
-rw-r--r--util/datetime/parser_ut.cpp44
-rw-r--r--util/generic/strfcpy.h22
-rw-r--r--util/network/pollerimpl.h12
9 files changed, 86 insertions, 86 deletions
diff --git a/library/cpp/coroutine/engine/condvar.h b/library/cpp/coroutine/engine/condvar.h
index 76293923995..ffceede6faa 100644
--- a/library/cpp/coroutine/engine/condvar.h
+++ b/library/cpp/coroutine/engine/condvar.h
@@ -11,9 +11,9 @@ public:
const int ret = WaitQueue_.WaitD(current, deadline);
if (ret != EWAKEDUP) {
- return ret;
- }
-
+ return ret;
+ }
+
return mutex->LockD(current, deadline);
}
diff --git a/library/cpp/coroutine/engine/events.h b/library/cpp/coroutine/engine/events.h
index 39d2a8025cc..07cc4d25e87 100644
--- a/library/cpp/coroutine/engine/events.h
+++ b/library/cpp/coroutine/engine/events.h
@@ -93,7 +93,7 @@ public:
Waiters_.PopFront()->Wake();
}
}
-
+
void BroadCast() noexcept {
while (!Waiters_.Empty()) {
Waiters_.PopFront()->Wake();
diff --git a/library/cpp/http/fetch/httpheader.h b/library/cpp/http/fetch/httpheader.h
index 697adb681dd..b2810bbd413 100644
--- a/library/cpp/http/fetch/httpheader.h
+++ b/library/cpp/http/fetch/httpheader.h
@@ -98,18 +98,18 @@ public:
void Print() const {
printf("content_length: %" PRIi64 "\n", content_length);
- printf("http_time: %" PRIi64 "\n", http_time);
- printf("http_minor: %" PRIi8 "\n", http_minor);
- printf("mime_type: %" PRIi8 "\n", mime_type);
- printf("charset: %" PRIi8 "\n", charset);
- printf("compression_method: %" PRIi8 "\n", compression_method);
- printf("transfer_chunked: %" PRIi8 "\n", transfer_chunked);
- printf("connection_closed: %" PRIi8 "\n", connection_closed);
+ printf("http_time: %" PRIi64 "\n", http_time);
+ printf("http_minor: %" PRIi8 "\n", http_minor);
+ printf("mime_type: %" PRIi8 "\n", mime_type);
+ printf("charset: %" PRIi8 "\n", charset);
+ printf("compression_method: %" PRIi8 "\n", compression_method);
+ printf("transfer_chunked: %" PRIi8 "\n", transfer_chunked);
+ printf("connection_closed: %" PRIi8 "\n", connection_closed);
printf("content_range_start: %" PRIi64 "\n", content_range_start);
printf("content_range_end: %" PRIi64 "\n", content_range_end);
printf("content_range_entity_length: %" PRIi64 "\n", content_range_entity_length);
printf("base: \"%s\"\n", base.c_str());
- printf("error: %" PRIi16 "\n", error);
+ printf("error: %" PRIi16 "\n", error);
}
int SetBase(const char* path,
@@ -156,9 +156,9 @@ public:
void Print() const {
THttpBaseHeader::Print();
- printf("http_status: %" PRIi16 "\n", http_status);
- printf("squid_error: %" PRIi8 "\n", squid_error);
- printf("accept_ranges: %" PRIi8 "\n", accept_ranges);
+ printf("http_status: %" PRIi16 "\n", http_status);
+ printf("squid_error: %" PRIi8 "\n", squid_error);
+ printf("accept_ranges: %" PRIi8 "\n", accept_ranges);
printf("location: \"%s\"\n", location.c_str());
printf("retry_after: %" PRIi64 "\n", retry_after);
}
@@ -208,10 +208,10 @@ public:
printf("host: \"%s\"\n", host);
printf("from: \"%s\"\n", from);
printf("user_agent: \"%s\"\n", user_agent);
- printf("http_method: %" PRIi8 "\n", http_method);
- printf("response_timeout: %" PRIi32 "\n", x_yandex_response_timeout);
- printf("max_age: %" PRIi32 "\n", max_age);
- printf("if_modified_since: %" PRIi64 "\n", if_modified_since);
+ printf("http_method: %" PRIi8 "\n", http_method);
+ printf("response_timeout: %" PRIi32 "\n", x_yandex_response_timeout);
+ printf("max_age: %" PRIi32 "\n", max_age);
+ printf("if_modified_since: %" PRIi64 "\n", if_modified_since);
}
/// It doesn't care about errors in request or headers, where
diff --git a/util/datetime/base.h b/util/datetime/base.h
index 5f66e6bc7f2..5e902b8f633 100644
--- a/util/datetime/base.h
+++ b/util/datetime/base.h
@@ -69,10 +69,10 @@ bool ParseHTTPDateTimeDeprecated(const char* date, size_t dateLen, time_t& utcTi
bool ParseX509ValidityDateTimeDeprecated(const char* date, time_t& utcTime);
bool ParseX509ValidityDateTimeDeprecated(const char* date, size_t dateLen, time_t& utcTime);
-bool ParseISO8601DateTime(const char* date, time_t& utcTime);
-bool ParseISO8601DateTime(const char* date, size_t dateLen, time_t& utcTime);
-bool ParseRFC822DateTime(const char* date, time_t& utcTime);
-bool ParseRFC822DateTime(const char* date, size_t dateLen, time_t& utcTime);
+bool ParseISO8601DateTime(const char* date, time_t& utcTime);
+bool ParseISO8601DateTime(const char* date, size_t dateLen, time_t& utcTime);
+bool ParseRFC822DateTime(const char* date, time_t& utcTime);
+bool ParseRFC822DateTime(const char* date, size_t dateLen, time_t& utcTime);
bool ParseHTTPDateTime(const char* date, time_t& utcTime);
bool ParseHTTPDateTime(const char* date, size_t dateLen, time_t& utcTime);
bool ParseX509ValidityDateTime(const char* date, time_t& utcTime);
diff --git a/util/datetime/parser.h b/util/datetime/parser.h
index 3a8290084e7..f0c1b4a0c78 100644
--- a/util/datetime/parser.h
+++ b/util/datetime/parser.h
@@ -61,22 +61,22 @@ struct TDateTimeFields {
if (MicroSecond > 999999)
return false;
- if (Year == 1970 && Month == 1 && Day == 1) {
- if ((i64)(3600 * Hour + 60 * Minute + Second) < (60 * ZoneOffsetMinutes))
- return false;
- }
-
+ if (Year == 1970 && Month == 1 && Day == 1) {
+ if ((i64)(3600 * Hour + 60 * Minute + Second) < (60 * ZoneOffsetMinutes))
+ return false;
+ }
+
return true;
}
- TInstant ToInstant(TInstant defaultValue) const {
+ TInstant ToInstant(TInstant defaultValue) const {
time_t tt = ToTimeT(-1);
if (tt == -1)
return defaultValue;
return TInstant::Seconds(tt) + TDuration::MicroSeconds(MicroSecond);
}
- time_t ToTimeT(time_t defaultValue) const {
+ time_t ToTimeT(time_t defaultValue) const {
if (!IsOk())
return defaultValue;
struct tm tm;
@@ -107,28 +107,28 @@ protected:
int I;
int Dc;
-protected:
+protected:
TDateTimeParserBase()
- : DateTimeFields()
- , cs(0)
+ : DateTimeFields()
+ , cs(0)
, Sign(0)
, I(0xDEADBEEF) // to guarantee unittest break if ragel code is incorrect
- , Dc(0xDEADBEEF)
+ , Dc(0xDEADBEEF)
{
}
-
- inline TInstant GetResult(int firstFinalState, TInstant defaultValue) const {
- if (cs < firstFinalState)
- return defaultValue;
- return DateTimeFields.ToInstant(defaultValue);
- }
+
+ inline TInstant GetResult(int firstFinalState, TInstant defaultValue) const {
+ if (cs < firstFinalState)
+ return defaultValue;
+ return DateTimeFields.ToInstant(defaultValue);
+ }
};
#define DECLARE_PARSER(CLASS) \
struct CLASS: public TDateTimeParserBase { \
CLASS(); \
bool ParsePart(const char* input, size_t len); \
- TInstant GetResult(TInstant defaultValue) const; \
+ TInstant GetResult(TInstant defaultValue) const; \
};
DECLARE_PARSER(TIso8601DateTimeParser)
diff --git a/util/datetime/parser.rl6 b/util/datetime/parser.rl6
index 7bb1f69cb5b..931f09eae11 100644
--- a/util/datetime/parser.rl6
+++ b/util/datetime/parser.rl6
@@ -659,10 +659,10 @@ bool ParseX509ValidityDateTimeDeprecated(const char* input, size_t inputLen, tim
return true;
}
-bool ParseRFC822DateTime(const char* input, time_t& utcTime) {
- return ParseRFC822DateTime(input, strlen(input), utcTime);
-}
-
+bool ParseRFC822DateTime(const char* input, time_t& utcTime) {
+ return ParseRFC822DateTime(input, strlen(input), utcTime);
+}
+
bool ParseISO8601DateTime(const char* input, time_t& utcTime) {
return ParseISO8601DateTime(input, strlen(input), utcTime);
}
@@ -675,7 +675,7 @@ bool ParseX509ValidityDateTime(const char* input, time_t& utcTime) {
return ParseX509ValidityDateTime(input, strlen(input), utcTime);
}
-bool ParseRFC822DateTime(const char* input, size_t inputLen, time_t& utcTime) {
+bool ParseRFC822DateTime(const char* input, size_t inputLen, time_t& utcTime) {
try {
utcTime = ParseUnsafe<TRfc822DateTimeParser, TInstant>(input, inputLen).TimeT();
return true;
@@ -684,7 +684,7 @@ bool ParseRFC822DateTime(const char* input, size_t inputLen, time_t& utcTime) {
}
}
-bool ParseISO8601DateTime(const char* input, size_t inputLen, time_t& utcTime) {
+bool ParseISO8601DateTime(const char* input, size_t inputLen, time_t& utcTime) {
try {
utcTime = ParseUnsafe<TIso8601DateTimeParser, TInstant>(input, inputLen).TimeT();
return true;
diff --git a/util/datetime/parser_ut.cpp b/util/datetime/parser_ut.cpp
index 6e8193d9d0b..61364af997f 100644
--- a/util/datetime/parser_ut.cpp
+++ b/util/datetime/parser_ut.cpp
@@ -170,20 +170,20 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) {
bool r = true;
time_t t = 0;
- t = 12345;
+ t = 12345;
r = ParseRFC822DateTime("", t);
- UNIT_ASSERT(!r);
- UNIT_ASSERT_EQUAL(t, (time_t)12345);
-
- t = 223344;
+ UNIT_ASSERT(!r);
+ UNIT_ASSERT_EQUAL(t, (time_t)12345);
+
+ t = 223344;
r = ParseRFC822DateTime("Fri, some junk", t);
- UNIT_ASSERT(!r);
- UNIT_ASSERT_EQUAL(t, (time_t)223344);
-
- t = 54321;
+ UNIT_ASSERT(!r);
+ UNIT_ASSERT_EQUAL(t, (time_t)223344);
+
+ t = 54321;
r = ParseRFC822DateTime("Fri, 4 Mar 2005 19:34:45 UTC", t);
UNIT_ASSERT(!r);
- UNIT_ASSERT_EQUAL(t, (time_t)54321);
+ UNIT_ASSERT_EQUAL(t, (time_t)54321);
// TODO: check semantic validity of parsed date (30 Feb, 88:90 etc.).
// The following tests MUST fail (they don't now)
@@ -263,8 +263,8 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) {
UNIT_ASSERT(p.ParsePart(part2, strlen(part2)));
UNIT_ASSERT_VALUES_EQUAL(TInstant::Seconds(1109954085), p.GetResult(TInstant::Max()));
p = TRfc822DateTimeParser();
- const char* part3 = "Fri, 4 Mar 05 19:34:46 +0300";
- UNIT_ASSERT(p.ParsePart(part3, strlen(part3)));
+ const char* part3 = "Fri, 4 Mar 05 19:34:46 +0300";
+ UNIT_ASSERT(p.ParsePart(part3, strlen(part3)));
UNIT_ASSERT_VALUES_EQUAL(TInstant::Seconds(1109954086), p.GetResult(TInstant::Zero()));
}
@@ -276,8 +276,8 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) {
UNIT_ASSERT(p.ParsePart(part2, strlen(part2)));
UNIT_ASSERT_VALUES_EQUAL(TInstant::Seconds(637487057), p.GetResult(TInstant::Max()));
p = TIso8601DateTimeParser();
- const char* part3 = "1990-03-15T15:16:18+0732";
- UNIT_ASSERT(p.ParsePart(part3, strlen(part3)));
+ const char* part3 = "1990-03-15T15:16:18+0732";
+ UNIT_ASSERT(p.ParsePart(part3, strlen(part3)));
UNIT_ASSERT_VALUES_EQUAL(TInstant::Seconds(637487058), p.GetResult(TInstant::Zero()));
}
@@ -376,20 +376,20 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) {
bool ret;
time_t t;
- t = 12345;
+ t = 12345;
ret = ParseISO8601DateTime("", t);
- UNIT_ASSERT(!ret);
- UNIT_ASSERT_EQUAL(t, (time_t)12345);
-
+ UNIT_ASSERT(!ret);
+ UNIT_ASSERT_EQUAL(t, (time_t)12345);
+
// some bad dates
- t = 54321;
+ t = 54321;
ret = ParseISO8601DateTime("a990-01-15", t);
UNIT_ASSERT(!ret);
- UNIT_ASSERT_EQUAL(t, (time_t)54321);
+ UNIT_ASSERT_EQUAL(t, (time_t)54321);
ret = ParseISO8601DateTime("1970-01-01T03:00:00+04:00", t); // this is 1969 GMT
- UNIT_ASSERT(!ret);
-
+ UNIT_ASSERT(!ret);
+
ret = ParseISO8601DateTime("1987-13-16", t);
UNIT_ASSERT(!ret);
diff --git a/util/generic/strfcpy.h b/util/generic/strfcpy.h
index c71ea10898d..8a95bc3df2f 100644
--- a/util/generic/strfcpy.h
+++ b/util/generic/strfcpy.h
@@ -1,17 +1,17 @@
#pragma once
-
-/*
+
+/*
* strfcpy is a faster version of strlcpy().
* It returns void thus does not wastes time computing
* (most likely, unneeded) strlen(str)
- *
+ *
* Comparison with other copying functions:
- * strcpy() - buffer overflow ready
- * strncpy() - wastes time filling exactly n bytes with 0
- * strlcpy() - wastes time searching for the length of src
- * memcpy() - wastes time copying exactly n bytes even if the string is shorter
- */
-
-#include <stddef.h>
-
+ * strcpy() - buffer overflow ready
+ * strncpy() - wastes time filling exactly n bytes with 0
+ * strlcpy() - wastes time searching for the length of src
+ * memcpy() - wastes time copying exactly n bytes even if the string is shorter
+ */
+
+#include <stddef.h>
+
void strfcpy(char* dst, const char* src, size_t n);
diff --git a/util/network/pollerimpl.h b/util/network/pollerimpl.h
index b4d44fcc7b4..e8c7e40fbaf 100644
--- a/util/network/pollerimpl.h
+++ b/util/network/pollerimpl.h
@@ -190,15 +190,15 @@ private:
#if defined(HAVE_EPOLL_POLLER)
static inline int ContEpollWait(int epfd, struct epoll_event* events, int maxevents, int timeout) noexcept {
- int ret;
+ int ret;
- do {
+ do {
ret = epoll_wait(epfd, events, maxevents, Min<int>(timeout, 35 * 60 * 1000));
- } while (ret == -1 && errno == EINTR);
+ } while (ret == -1 && errno == EINTR);
+
+ return ret;
+}
- return ret;
-}
-
template <class TLockPolicy>
class TEpollPoller {
public: