diff options
author | dmasloff <dmasloff@yandex-team.com> | 2024-08-17 23:33:42 +0300 |
---|---|---|
committer | dmasloff <dmasloff@yandex-team.com> | 2024-08-17 23:43:45 +0300 |
commit | 69340f4614e853b9319df4b454ab7497711ee3cd (patch) | |
tree | 9902a3e2f58fe0bd9a157e7b51ad1cc52efa5744 /util | |
parent | a905b53ec410defd5d2c40031ef8b34bb50a29f8 (diff) | |
download | ydb-69340f4614e853b9319df4b454ab7497711ee3cd.tar.gz |
Set SpacesInLineCommentPrefix to 1 in /util
Set SpacesInLineCommentPrefix to 1 in /util
3853f9ec5143722c1bebd8dc0ffc9b61a6c17657
Diffstat (limited to 'util')
100 files changed, 305 insertions, 305 deletions
diff --git a/util/charset/utf8.h b/util/charset/utf8.h index d0c45e9d06..b105d8db9d 100644 --- a/util/charset/utf8.h +++ b/util/charset/utf8.h @@ -16,23 +16,23 @@ inline unsigned char UTF8LeadByteMask(size_t utf8_rune_len) { } inline size_t UTF8RuneLen(const unsigned char lead_byte) { - //b0XXXXXXX + // b0XXXXXXX if ((lead_byte & 0x80) == 0x00) { return 1; } - //b110XXXXX + // b110XXXXX if ((lead_byte & 0xe0) == 0xc0) { return 2; } - //b1110XXXX + // b1110XXXX if ((lead_byte & 0xf0) == 0xe0) { return 3; } - //b11110XXX + // b11110XXX if ((lead_byte & 0xf8) == 0xf0) { return 4; } - //b10XXXXXX + // b10XXXXXX return 0; } @@ -73,7 +73,7 @@ inline RECODE_RESULT GetUTF8CharLen(size_t& n, const unsigned char* p, const uns Y_ASSERT(p < e); // since p < e then we will check RECODE_EOINPUT only for n > 1 (see calls of this functions) switch (UTF8RuneLen(*p)) { case 0: - return RECODE_BROKENSYMBOL; //[BROKENSYMBOL] in first byte + return RECODE_BROKENSYMBOL; // [BROKENSYMBOL] in first byte case 1: n = 1; @@ -194,27 +194,27 @@ inline RECODE_RESULT SafeReadUTF8Char(wchar32& rune, size_t& rune_len, const uns size_t _len = UTF8RuneLen(*s); if (s + _len > end) - return RECODE_EOINPUT; //[EOINPUT] + return RECODE_EOINPUT; // [EOINPUT] if (_len == 0) - return RECODE_BROKENSYMBOL; //[BROKENSYMBOL] in first byte - _rune = *s++; //[00000000 0XXXXXXX] + return RECODE_BROKENSYMBOL; // [BROKENSYMBOL] in first byte + _rune = *s++; // [00000000 0XXXXXXX] if (_len > 1) { _rune &= UTF8LeadByteMask(_len); unsigned char ch = *s++; if (!IsUTF8ContinuationByte(ch)) - return RECODE_BROKENSYMBOL; //[BROKENSYMBOL] in second byte - PutUTF8SixBits(_rune, ch); //[00000XXX XXYYYYYY] + return RECODE_BROKENSYMBOL; // [BROKENSYMBOL] in second byte + PutUTF8SixBits(_rune, ch); // [00000XXX XXYYYYYY] if (_len > 2) { ch = *s++; if (!IsUTF8ContinuationByte(ch)) - return RECODE_BROKENSYMBOL; //[BROKENSYMBOL] in third byte - PutUTF8SixBits(_rune, ch); //[XXXXYYYY YYZZZZZZ] + return RECODE_BROKENSYMBOL; // [BROKENSYMBOL] in third byte + PutUTF8SixBits(_rune, ch); // [XXXXYYYY YYZZZZZZ] if (_len > 3) { ch = *s; if (!IsUTF8ContinuationByte(ch)) - return RECODE_BROKENSYMBOL; //[BROKENSYMBOL] in fourth byte - PutUTF8SixBits(_rune, ch); //[XXXYY YYYYZZZZ ZZQQQQQQ] + return RECODE_BROKENSYMBOL; // [BROKENSYMBOL] in fourth byte + PutUTF8SixBits(_rune, ch); // [XXXYY YYYYZZZZ ZZQQQQQQ] if (!IsValidUTF8Rune<4, strictMode>(_rune)) return RECODE_BROKENSYMBOL; } else { @@ -241,10 +241,10 @@ Y_FORCE_INLINE RECODE_RESULT ReadUTF8CharAndAdvance(wchar32& rune, const unsigne switch (UTF8RuneLen(*p)) { case 0: rune = BROKEN_RUNE; - return RECODE_BROKENSYMBOL; //[BROKENSYMBOL] in first byte + return RECODE_BROKENSYMBOL; // [BROKENSYMBOL] in first byte case 1: - rune = *p; //[00000000 0XXXXXXX] + rune = *p; // [00000000 0XXXXXXX] ++p; return RECODE_OK; @@ -255,8 +255,8 @@ Y_FORCE_INLINE RECODE_RESULT ReadUTF8CharAndAdvance(wchar32& rune, const unsigne rune = BROKEN_RUNE; return RECODE_BROKENSYMBOL; } else { - PutUTF8LeadBits(rune, *p++, 2); //[00000000 000XXXXX] - PutUTF8SixBits(rune, *p++); //[00000XXX XXYYYYYY] + PutUTF8LeadBits(rune, *p++, 2); // [00000000 000XXXXX] + PutUTF8SixBits(rune, *p++); // [00000XXX XXYYYYYY] if (!IsValidUTF8Rune<2, strictMode>(rune)) { p -= 2; rune = BROKEN_RUNE; @@ -271,9 +271,9 @@ Y_FORCE_INLINE RECODE_RESULT ReadUTF8CharAndAdvance(wchar32& rune, const unsigne rune = BROKEN_RUNE; return RECODE_BROKENSYMBOL; } else { - PutUTF8LeadBits(rune, *p++, 3); //[00000000 0000XXXX] - PutUTF8SixBits(rune, *p++); //[000000XX XXYYYYYY] - PutUTF8SixBits(rune, *p++); //[XXXXYYYY YYZZZZZZ] + PutUTF8LeadBits(rune, *p++, 3); // [00000000 0000XXXX] + PutUTF8SixBits(rune, *p++); // [000000XX XXYYYYYY] + PutUTF8SixBits(rune, *p++); // [XXXXYYYY YYZZZZZZ] // check for overlong encoding and surrogates if (!IsValidUTF8Rune<3, strictMode>(rune)) { p -= 3; @@ -289,10 +289,10 @@ Y_FORCE_INLINE RECODE_RESULT ReadUTF8CharAndAdvance(wchar32& rune, const unsigne rune = BROKEN_RUNE; return RECODE_BROKENSYMBOL; } else { - PutUTF8LeadBits(rune, *p++, 4); //[00000000 00000000 00000XXX] - PutUTF8SixBits(rune, *p++); //[00000000 0000000X XXYYYYYY] - PutUTF8SixBits(rune, *p++); //[00000000 0XXXYYYY YYZZZZZZ] - PutUTF8SixBits(rune, *p++); //[000XXXYY YYYYZZZZ ZZQQQQQQ] + PutUTF8LeadBits(rune, *p++, 4); // [00000000 00000000 00000XXX] + PutUTF8SixBits(rune, *p++); // [00000000 0000000X XXYYYYYY] + PutUTF8SixBits(rune, *p++); // [00000000 0XXXYYYY YYZZZZZZ] + PutUTF8SixBits(rune, *p++); // [000XXXYY YYYYZZZZ ZZQQQQQQ] if (!IsValidUTF8Rune<4, strictMode>(rune)) { p -= 4; rune = BROKEN_RUNE; diff --git a/util/charset/utf8_ut.cpp b/util/charset/utf8_ut.cpp index 9e68881cca..00981f8060 100644 --- a/util/charset/utf8_ut.cpp +++ b/util/charset/utf8_ut.cpp @@ -27,17 +27,17 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) { { const char* weird = "\xC8\xBE"; // 'Ⱦ', U+023E. strlen(weird)==2, strlen(tolower_utf8(weird)) is 3 - const char* turkI = "İ"; //strlen("İ") == 2, strlen(tolower_utf8("İ") == 1 + const char* turkI = "İ"; // strlen("İ") == 2, strlen(tolower_utf8("İ") == 1 TStringBuf chars[] = {"f", "F", "Б", "б", weird, turkI}; const int N = Y_ARRAY_SIZE(chars); - //try all combinations of these letters. + // try all combinations of these letters. int numberOfVariants = 1; for (int len = 0; len <= 4; ++len) { for (int i = 0; i < numberOfVariants; ++i) { TString s; int k = i; for (int j = 0; j < len; ++j) { - //Treat 'i' like number in base-N system with digits from 'chars'-array + // Treat 'i' like number in base-N system with digits from 'chars'-array s += chars[k % N]; k /= N; } @@ -67,17 +67,17 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) { { const char* weird = "\xC8\xBE"; // 'Ⱦ', U+023E. strlen(weird)==2, strlen(ToUpper_utf8(weird)) is 3 - const char* turkI = "İ"; //strlen("İ") == 2, strlen(ToUpper_utf8("İ") == 1 + const char* turkI = "İ"; // strlen("İ") == 2, strlen(ToUpper_utf8("İ") == 1 TStringBuf chars[] = {"F", "f", "б", "Б", turkI, weird}; const int N = Y_ARRAY_SIZE(chars); - //try all combinations of these letters. + // try all combinations of these letters. int numberOfVariants = 1; for (int len = 0; len <= 4; ++len) { for (int i = 0; i < numberOfVariants; ++i) { TString s; int k = i; for (int j = 0; j < len; ++j) { - //Treat 'i' like number in base-N system with digits from 'chars'-array + // Treat 'i' like number in base-N system with digits from 'chars'-array s += chars[k % N]; k /= N; } diff --git a/util/charset/wide.h b/util/charset/wide.h index 5a81f8aa47..06f48d60da 100644 --- a/util/charset/wide.h +++ b/util/charset/wide.h @@ -341,7 +341,7 @@ inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size const unsigned char* cur = reinterpret_cast<const unsigned char*>(text); const unsigned char* last = cur + len; TCharType* p = dest; -#ifdef _sse_ //can't check for sse4, as we build most of arcadia without sse4 support even on platforms that support it +#ifdef _sse_ // can't check for sse4, as we build most of arcadia without sse4 support even on platforms that support it if (cur + 16 <= last && NX86::CachedHaveSSE41()) { ::NDetail::UTF8ToWideImplSSE41(cur, last, p); } @@ -606,7 +606,7 @@ namespace NDetail { #ifdef _sse2_ inline bool DoIsStringASCIISSE(const unsigned char* first, const unsigned char* last) { - //scalar version for short strings + // scalar version for short strings if (first + 8 > last) { return ::NDetail::DoIsStringASCIISlow(first, last); } @@ -637,7 +637,7 @@ namespace NDetail { return ::NDetail::DoIsStringASCIISlow(first, last); } -#endif //_sse2_ +#endif // _sse2_ } diff --git a/util/charset/wide_sse41.cpp b/util/charset/wide_sse41.cpp index d1f2a74851..0d86cb95f8 100644 --- a/util/charset/wide_sse41.cpp +++ b/util/charset/wide_sse41.cpp @@ -18,17 +18,17 @@ namespace NDetail { #include <emmintrin.h> #include <smmintrin.h> -//processes to the first error, or until less then 16 bytes left -//most code taken from https://woboq.com/blog/utf-8-processing-using-simd.html +// processes to the first error, or until less then 16 bytes left +// most code taken from https://woboq.com/blog/utf-8-processing-using-simd.html -//return dstAdvance 0 in case of problems +// return dstAdvance 0 in case of problems static Y_FORCE_INLINE ui32 Unpack16BytesIntoUtf16IfNoSurrogats(const unsigned char*& cur, __m128i& utf16Low, __m128i& utf16High) { unsigned char curAligned[16]; memcpy(curAligned, cur, sizeof(__m128i)); __m128i chunk = _mm_load_si128(reinterpret_cast<const __m128i*>(curAligned)); - //only ascii characters - simple copy + // only ascii characters - simple copy if (!_mm_movemask_epi8(chunk)) { utf16Low = _mm_unpacklo_epi8(chunk, _mm_setzero_si128()); utf16High = _mm_unpackhi_epi8(chunk, _mm_setzero_si128()); @@ -50,9 +50,9 @@ static Y_FORCE_INLINE ui32 Unpack16BytesIntoUtf16IfNoSurrogats(const unsigned ch __m128i chunkLow, chunkHigh; if (Y_LIKELY(!_mm_movemask_epi8(cond3))) { - //main case: no bloks of size 3 or 4 + // main case: no bloks of size 3 or 4 - //rune len for start of multi-byte sequences (0 for b0... and b10..., 2 for b110..., etc.) + // rune len for start of multi-byte sequences (0 for b0... and b10..., 2 for b110..., etc.) __m128i count = _mm_and_si128(state, _mm_set1_epi8(0x7)); __m128i countSub1 = _mm_subs_epu8(count, _mm_set1_epi8(0x1)); @@ -68,7 +68,7 @@ static Y_FORCE_INLINE ui32 Unpack16BytesIntoUtf16IfNoSurrogats(const unsigned ch __m128i isBeginMultibyteMask = _mm_cmpgt_epi8(count, _mm_set1_epi8(0)); __m128i needNoContinuationMask = _mm_cmpeq_epi8(continuation1, _mm_set1_epi8(0)); __m128i isBeginMask = _mm_add_epi8(isBeginMultibyteMask, isAsciiMask); - //each symbol should be exactly one of ascii, continuation or begin + // each symbol should be exactly one of ascii, continuation or begin __m128i okMask = _mm_cmpeq_epi8(isBeginMask, needNoContinuationMask); if (_mm_movemask_epi8(okMask) != 0xFFFF) { @@ -114,7 +114,7 @@ static Y_FORCE_INLINE ui32 Unpack16BytesIntoUtf16IfNoSurrogats(const unsigned ch return 0; } - //rune len for start of multi-byte sequences (0 for b0... and b10..., 2 for b110..., etc.) + // rune len for start of multi-byte sequences (0 for b0... and b10..., 2 for b110..., etc.) __m128i count = _mm_and_si128(state, _mm_set1_epi8(0x7)); __m128i countSub1 = _mm_subs_epu8(count, _mm_set1_epi8(0x1)); @@ -132,7 +132,7 @@ static Y_FORCE_INLINE ui32 Unpack16BytesIntoUtf16IfNoSurrogats(const unsigned ch __m128i isBeginMultibyteMask = _mm_cmpgt_epi8(count, _mm_set1_epi8(0)); __m128i needNoContinuationMask = _mm_cmpeq_epi8(continuationsRunelen, _mm_set1_epi8(0)); __m128i isBeginMask = _mm_add_epi8(isBeginMultibyteMask, isAsciiMask); - //each symbol should be exactly one of ascii, continuation or begin + // each symbol should be exactly one of ascii, continuation or begin __m128i okMask = _mm_cmpeq_epi8(isBeginMask, needNoContinuationMask); if (_mm_movemask_epi8(okMask) != 0xFFFF) { @@ -209,7 +209,7 @@ namespace NDetail { memcpy(dest, destAligned, sizeof(__m128i) * 2); dest += dstAdvance; } - //The rest will be handled sequencially. + // The rest will be handled sequencially. // Possible improvement: go back to the vectorized processing after the error or the 4 byte sequence } @@ -225,7 +225,7 @@ namespace NDetail { break; } - //NOTE: we only work in case without surrogat pairs, so we can make simple copying with zeroes in 2 high bytes + // NOTE: we only work in case without surrogat pairs, so we can make simple copying with zeroes in 2 high bytes __m128i utf32_lowlow = _mm_unpacklo_epi16(utf16Low, _mm_set1_epi8(0)); __m128i utf32_lowhigh = _mm_unpackhi_epi16(utf16Low, _mm_set1_epi8(0)); __m128i utf32_highlow = _mm_unpacklo_epi16(utf16High, _mm_set1_epi8(0)); @@ -239,7 +239,7 @@ namespace NDetail { memcpy(dest, destAligned, sizeof(__m128i) * 4); dest += dstAdvance; } - //The rest will be handled sequencially. + // The rest will be handled sequencially. // Possible improvement: go back to the vectorized processing after the error or the 4 byte sequence } } diff --git a/util/charset/wide_ut.cpp b/util/charset/wide_ut.cpp index b33dd0c0de..dec843717e 100644 --- a/util/charset/wide_ut.cpp +++ b/util/charset/wide_ut.cpp @@ -111,16 +111,16 @@ namespace { } //! use this function to dump UTF8 text into a file in case of any changes - // void DumpUTF8Text() { - // TString s = WideToUTF8(UnicodeText); - // std::ofstream f("utf8.txt"); - // f << std::hex; - // for (int i = 0; i < (int)s.size(); ++i) { - // f << "0x" << std::setw(2) << std::setfill('0') << (int)(ui8)s[i] << ", "; - // if ((i + 1) % 16 == 0) - // f << std::endl; - // } - // } + // void DumpUTF8Text() { + // TString s = WideToUTF8(UnicodeText); + // std::ofstream f("utf8.txt"); + // f << std::hex; + // for (int i = 0; i < (int)s.size(); ++i) { + // f << "0x" << std::setw(2) << std::setfill('0') << (int)(ui8)s[i] << ", "; + // if ((i + 1) % 16 == 0) + // f << std::endl; + // } + // } template <StrictUTF8 strictMode = StrictUTF8::No> void CheckRecodeOK(wchar32 expected, unsigned char* first, size_t n) { diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp index 5ada0794b7..3482feafac 100644 --- a/util/datetime/base_ut.cpp +++ b/util/datetime/base_ut.cpp @@ -207,8 +207,8 @@ Y_UNIT_TEST_SUITE(TDateTimeTest) { UNIT_ASSERT(mlsecB + 90 < mlsecA); UNIT_ASSERT((mcrsecB + 90000 < mcrsecA)); - //UNIT_ASSERT(ToMicroSeconds(&tvB) + 90000 < ToMicroSeconds(&tvA)); - //UNIT_ASSERT(TVdiff(tvB, tvA) == long(ToMicroSeconds(&tvA) - ToMicroSeconds(&tvB))); + // UNIT_ASSERT(ToMicroSeconds(&tvB) + 90000 < ToMicroSeconds(&tvA)); + // UNIT_ASSERT(TVdiff(tvB, tvA) == long(ToMicroSeconds(&tvA) - ToMicroSeconds(&tvB))); } Y_UNIT_TEST(TestCompatFuncs) { diff --git a/util/datetime/parser.h b/util/datetime/parser.h index f0c1b4a0c7..43b6df8da2 100644 --- a/util/datetime/parser.h +++ b/util/datetime/parser.h @@ -102,7 +102,7 @@ public: protected: TDateTimeFields DateTimeFields; - int cs; //for ragel + int cs; // for ragel int Sign; int I; int Dc; @@ -256,7 +256,7 @@ public: protected: TDateTimeFieldsDeprecated DateTimeFields; - int cs; //for ragel + int cs; // for ragel int Sign; int I; int Dc; diff --git a/util/draft/datetime.cpp b/util/draft/datetime.cpp index d290021d5e..5d6c743dfe 100644 --- a/util/draft/datetime.cpp +++ b/util/draft/datetime.cpp @@ -12,13 +12,13 @@ namespace NDatetime { const ui32 MonthDays[2][12] = { - {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, //nleap - {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} //leap + {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, // nleap + {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} // leap }; const ui32 MonthDaysNewYear[2][13] = { - {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, //nleap - {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} //leap + {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, // nleap + {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} // leap }; void YDayToMonthAndDay(ui32 yday, bool isleap, ui32* month, ui32* mday) { diff --git a/util/draft/datetime.h b/util/draft/datetime.h index 7301e32e50..c49b686277 100644 --- a/util/draft/datetime.h +++ b/util/draft/datetime.h @@ -15,7 +15,7 @@ namespace NDatetime { extern const ui32 MonthDaysNewYear[2][13]; // !leapYear; !!leapYear inline ui32 YearDaysAD(ui32 year) { - year = Max<ui32>(year, 1) - 1; //1 AD comes straight after 1 BC, no 0 AD + year = Max<ui32>(year, 1) - 1; // 1 AD comes straight after 1 BC, no 0 AD return year * 365 + year / 4 - year / 100 + year / 400; } diff --git a/util/draft/datetime_ut.cpp b/util/draft/datetime_ut.cpp index a5e065ef6e..b60c145335 100644 --- a/util/draft/datetime_ut.cpp +++ b/util/draft/datetime_ut.cpp @@ -84,7 +84,7 @@ Y_UNIT_TEST_SUITE(TSimpleTMTest) { tzset(); - TSimpleTM::New(-1); //should not die here + TSimpleTM::New(-1); // should not die here UNIT_ASSERT_VALUES_EQUAL((ui32)0, (ui32)TSimpleTM::New(0)); UNIT_ASSERT((ui32)TSimpleTM::New(0).IsUTC()); @@ -95,7 +95,7 @@ Y_UNIT_TEST_SUITE(TSimpleTMTest) { Zero(tmt); gmtime_r(&t, &tmt); UNIT_ASSERT_VALUES_EQUAL_C((i64)t, (i64)TSimpleTM::New(t).AsTimeT(), ToString(t)); // time_t -> gmt tm -> time_t - UNIT_ASSERT_VALUES_EQUAL_C((i64)t, (i64)TSimpleTM::New(tmt).AsTimeT(), ToString(t)); // gmt tm -> time_t + UNIT_ASSERT_VALUES_EQUAL_C((i64)t, (i64)TSimpleTM::New(tmt).AsTimeT(), ToString(t)); // gmt tm -> time_t AssertStructTmEqual(PrintMarker("UTC:time_t", __LINE__, t), tmt, TSimpleTM::New(t)); AssertStructTmEqual(PrintMarker("UTC:tm", __LINE__, t), diff --git a/util/folder/dirent_win.c b/util/folder/dirent_win.c index 7e6db74ce5..cabab6bbf9 100644 --- a/util/folder/dirent_win.c +++ b/util/folder/dirent_win.c @@ -30,7 +30,7 @@ struct DIR* opendir(const char* dirname) { dir->readdir_buf = NULL; int len = strlen(dirname); - //Remove trailing slashes + // Remove trailing slashes while (len && (dirname[len - 1] == '\\' || dirname[len - 1] == '/')) { --len; } @@ -122,4 +122,4 @@ void rewinddir(struct DIR* dir) { dir->file_no = 0; } -#endif //_win_ +#endif // _win_ diff --git a/util/folder/dirut.cpp b/util/folder/dirut.cpp index ffc9b09f96..a1a2ace9ca 100644 --- a/util/folder/dirut.cpp +++ b/util/folder/dirut.cpp @@ -404,7 +404,7 @@ int mkpath(char* path, int mode) { // if it does not). Use RealLocation if that behaviour is required. TString RealPath(const TString& path) { TTempBuf result; - Y_ASSERT(result.Size() > MAX_PATH); //TMP_BUF_LEN > MAX_PATH + Y_ASSERT(result.Size() > MAX_PATH); // TMP_BUF_LEN > MAX_PATH #ifdef _win_ if (GetFullPathName(path.data(), result.Size(), result.Data(), nullptr) == 0) #else diff --git a/util/folder/fts.h b/util/folder/fts.h index f3c799e8c8..d7105a4945 100644 --- a/util/folder/fts.h +++ b/util/folder/fts.h @@ -15,7 +15,7 @@ typedef unsigned short u_short; typedef unsigned int nlink_t; typedef struct _stat64 stat_struct; #define STAT_FUNC stat64UTF - //TODO: remove from global scope stat64UTF stat64UTF + // TODO: remove from global scope stat64UTF stat64UTF #ifdef __cplusplus int stat64UTF(const char* path, struct _stat64* _Stat); int stat64UTF(dird path, struct _stat64* _Stat); diff --git a/util/folder/fts_ut.cpp b/util/folder/fts_ut.cpp index c5d59e35f4..3a8cced44e 100644 --- a/util/folder/fts_ut.cpp +++ b/util/folder/fts_ut.cpp @@ -24,7 +24,7 @@ void MakeFile(const char* path) { TFile(path, CreateAlways); } -//There potentially could be problems in listing order on different platforms +// There potentially could be problems in listing order on different platforms int FtsCmp(const FTSENT** ent1, const FTSENT** ent2) { return strcmp((*ent1)->fts_accpath, (*ent2)->fts_accpath); } diff --git a/util/folder/iterator_ut.cpp b/util/folder/iterator_ut.cpp index c54cde55c8..cb3534c70f 100644 --- a/util/folder/iterator_ut.cpp +++ b/util/folder/iterator_ut.cpp @@ -177,7 +177,7 @@ private: TDirHier dh; const TString dir("tmpdir"); - //prepare fs + // prepare fs { TMersenne<ui32> rnd; const TString prefixes[] = { diff --git a/util/folder/pathsplit.h b/util/folder/pathsplit.h index 135457dbd0..d4eedfbbc5 100644 --- a/util/folder/pathsplit.h +++ b/util/folder/pathsplit.h @@ -5,7 +5,7 @@ #include <util/generic/string.h> #include <util/string/ascii.h> -//do not own any data +// do not own any data struct TPathSplitStore: public TVector<TStringBuf> { TStringBuf Drive; bool IsAbsolute = false; diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h index 8286275e79..8958dd225f 100644 --- a/util/generic/algorithm.h +++ b/util/generic/algorithm.h @@ -207,7 +207,7 @@ constexpr size_t FindIndexIf(C&& c, P p) { return it == end(c) ? NPOS : (it - begin(c)); } -//EqualToOneOf(x, "apple", "orange") means (x == "apple" || x == "orange") +// EqualToOneOf(x, "apple", "orange") means (x == "apple" || x == "orange") template <typename T, typename... Other> constexpr bool EqualToOneOf(const T& x, const Other&... values) { return (... || (x == values)); diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp index 09c5824cd9..efaa8ddd5d 100644 --- a/util/generic/algorithm_ut.cpp +++ b/util/generic/algorithm_ut.cpp @@ -111,7 +111,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { UNIT_ASSERT(0 == EqualToOneOf(1, 2)); UNIT_ASSERT(0 == EqualToOneOf(3)); - //test, that EqualToOneOf can compare different types, and don't copy objects: + // test, that EqualToOneOf can compare different types, and don't copy objects: TStrokaNoCopy x("x"); TStrokaNoCopy y("y"); TStrokaNoCopy z("z"); @@ -169,7 +169,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { int array[3] = {1, 2, 3}; const int array_const[3] = {1, 2, 3}; - //test (const, non-const) * (iterator, vector, array) * (found, not found) variants. + // test (const, non-const) * (iterator, vector, array) * (found, not found) variants. // value '3' is in container, value '4' is not for (int j = 3; j <= 4; ++j) { TestFindPtrFoundValue<int*>(j, FindPtr(v, j)); @@ -191,7 +191,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { int array[3] = {1, 2, 3}; const int array_const[3] = {1, 2, 3}; - //test (const, non-const) * (iterator, vector, array) * (found, not found) variants. + // test (const, non-const) * (iterator, vector, array) * (found, not found) variants. // search, that 2*2 == 4, but there is no value 'x' in array that (x*x == 3) for (int j = 3; j <= 4; ++j) { TestFindIfPtrFoundValue<int*>(j, FindIfPtr(v, [j](int i) { return i * i == j; })); diff --git a/util/generic/array_ref_ut.cpp b/util/generic/array_ref_ut.cpp index 4c8eaf7135..c71fb61344 100644 --- a/util/generic/array_ref_ut.cpp +++ b/util/generic/array_ref_ut.cpp @@ -34,7 +34,7 @@ Y_UNIT_TEST_SUITE(TestArrayRef) { ref[0] = 5; UNIT_ASSERT_VALUES_EQUAL(a[0], 5); - //FIXME: size checks are implemented via Y_ASSERT, hence there is no way to test them + // FIXME: size checks are implemented via Y_ASSERT, hence there is no way to test them } Y_UNIT_TEST(TestFrontBack) { @@ -165,7 +165,7 @@ Y_UNIT_TEST_SUITE(TestArrayRef) { TArrayRef<int> bSubRef(b, size - 1); - //Testing if operator== compares values, not pointers + // Testing if operator== compares values, not pointers UNIT_ASSERT_EQUAL(cRef, bSubRef); } @@ -210,7 +210,7 @@ Y_UNIT_TEST_SUITE(TestArrayRef) { UNIT_ASSERT_VALUES_EQUAL(s1.size(), 1); UNIT_ASSERT_VALUES_EQUAL(s1[0], 3); - //FIXME: size checks are implemented via Y_ASSERT, hence there is no way to test them + // FIXME: size checks are implemented via Y_ASSERT, hence there is no way to test them } Y_UNIT_TEST(SubRegion) { @@ -240,8 +240,8 @@ Y_UNIT_TEST_SUITE(TestArrayRef) { bytesRef, MakeArrayRef(std::vector<char>{0x01, 0x00, 0x02, 0x00, 0x03, 0x00})); - //should not compile - //as_writable_bytes(constRef); + // should not compile + // as_writable_bytes(constRef); } Y_UNIT_TEST(TestAsWritableBytes) { diff --git a/util/generic/bitmap.h b/util/generic/bitmap.h index dfac88e4b8..97eb9408c2 100644 --- a/util/generic/bitmap.h +++ b/util/generic/bitmap.h @@ -575,14 +575,14 @@ public: if ((pos & ModMask) == 0) { if (sizeof(TChunk) >= sizeof(TTo)) to = (TTo)Mask.Data[chunkpos]; - else //if (sizeof(TChunk) < sizeof(TTo)) + else // if (sizeof(TChunk) < sizeof(TTo)) NBitMapPrivate::CopyData(&to, 1, Mask.Data + chunkpos, Min(((sizeof(TTo) * 8) >> DivCount), Mask.GetChunkCapacity() - chunkpos)); } else if ((pos & (sizeof(TTo) * 8 - 1)) == 0 && sizeof(TChunk) >= 2 * sizeof(TTo)) to = (TTo)(Mask.Data[chunkpos] >> (pos & ModMask)); else { static constexpr size_t copyToSize = (sizeof(TChunk) >= sizeof(TTo)) ? (sizeof(TChunk) / sizeof(TTo)) + 2 : 3; TTo temp[copyToSize] = {0, 0}; - //or use non defined by now TBitmap<copyToSize, TTo>::CopyData,RShift(pos & ModMask),Export(0,to) + // or use non defined by now TBitmap<copyToSize, TTo>::CopyData,RShift(pos & ModMask),Export(0,to) NBitMapPrivate::CopyData(temp, copyToSize, Mask.Data + chunkpos, Min((sizeof(TTo) / sizeof(TChunk)) + 1, Mask.GetChunkCapacity() - chunkpos)); to = (temp[0] >> (pos & ModMask)) | (temp[1] << (8 * sizeof(TTo) - (pos & ModMask))); } diff --git a/util/generic/buffer.h b/util/generic/buffer.h index a5efe398ce..4f82314a7a 100644 --- a/util/generic/buffer.h +++ b/util/generic/buffer.h @@ -132,7 +132,7 @@ public: } inline void Proceed(size_t pos) { - //Y_ASSERT(pos <= Len_); // see discussion in REVIEW:29021 + // Y_ASSERT(pos <= Len_); // see discussion in REVIEW:29021 Resize(pos); } diff --git a/util/generic/deque_ut.cpp b/util/generic/deque_ut.cpp index 38c421c7c7..3ede8dbc25 100644 --- a/util/generic/deque_ut.cpp +++ b/util/generic/deque_ut.cpp @@ -88,7 +88,7 @@ void TDequeTest::TestDeque1() { UNIT_ASSERT(d[1] == 9); UNIT_ASSERT(d[2] == 25); - //Some compile time tests: + // Some compile time tests: TDeque<int>::iterator dit = d.begin(); TDeque<int>::const_iterator cdit(d.begin()); @@ -109,67 +109,67 @@ void TDequeTest::TestInsert() { TDeque<int>::iterator dit; - //Insertion before begin: + // Insertion before begin: dit = d.insert(d.begin(), 3); UNIT_ASSERT(dit != d.end()); UNIT_ASSERT(*dit == 3); UNIT_ASSERT(d.size() == 4); UNIT_ASSERT(d[0] == 3); - //Insertion after begin: + // Insertion after begin: dit = d.insert(d.begin() + 1, 4); UNIT_ASSERT(dit != d.end()); UNIT_ASSERT(*dit == 4); UNIT_ASSERT(d.size() == 5); UNIT_ASSERT(d[1] == 4); - //Insertion at end: + // Insertion at end: dit = d.insert(d.end(), 5); UNIT_ASSERT(dit != d.end()); UNIT_ASSERT(*dit == 5); UNIT_ASSERT(d.size() == 6); UNIT_ASSERT(d[5] == 5); - //Insertion before last element: + // Insertion before last element: dit = d.insert(d.end() - 1, 6); UNIT_ASSERT(dit != d.end()); UNIT_ASSERT(*dit == 6); UNIT_ASSERT(d.size() == 7); UNIT_ASSERT(d[5] == 6); - //Insertion of several elements before begin + // Insertion of several elements before begin d.insert(d.begin(), 2, 7); UNIT_ASSERT(d.size() == 9); UNIT_ASSERT(d[0] == 7); UNIT_ASSERT(d[1] == 7); - //Insertion of several elements after begin - //There is more elements to insert than elements before insertion position + // Insertion of several elements after begin + // There is more elements to insert than elements before insertion position d.insert(d.begin() + 1, 2, 8); UNIT_ASSERT(d.size() == 11); UNIT_ASSERT(d[1] == 8); UNIT_ASSERT(d[2] == 8); - //There is less elements to insert than elements before insertion position + // There is less elements to insert than elements before insertion position d.insert(d.begin() + 3, 2, 9); UNIT_ASSERT(d.size() == 13); UNIT_ASSERT(d[3] == 9); UNIT_ASSERT(d[4] == 9); - //Insertion of several elements at end: + // Insertion of several elements at end: d.insert(d.end(), 2, 10); UNIT_ASSERT(d.size() == 15); UNIT_ASSERT(d[14] == 10); UNIT_ASSERT(d[13] == 10); - //Insertion of several elements before last: - //There is more elements to insert than elements after insertion position + // Insertion of several elements before last: + // There is more elements to insert than elements after insertion position d.insert(d.end() - 1, 2, 11); UNIT_ASSERT(d.size() == 17); UNIT_ASSERT(d[15] == 11); UNIT_ASSERT(d[14] == 11); - //There is less elements to insert than elements after insertion position + // There is less elements to insert than elements after insertion position d.insert(d.end() - 3, 2, 12); UNIT_ASSERT(d.size() == 19); UNIT_ASSERT(d[15] == 12); diff --git a/util/generic/fwd.h b/util/generic/fwd.h index 5cc2da40e5..16e595fde3 100644 --- a/util/generic/fwd.h +++ b/util/generic/fwd.h @@ -18,10 +18,10 @@ using TStringBuf = TBasicStringBuf<char>; using TWtringBuf = TBasicStringBuf<wchar16>; using TUtf32StringBuf = TBasicStringBuf<wchar32>; -//misc +// misc class TBuffer; -//functors +// functors template <class T = void> struct TLess; @@ -34,7 +34,7 @@ struct TEqualTo; template <class T> struct THash; -//intrusive containers +// intrusive containers struct TIntrusiveListDefaultTag; template <class T, class Tag = TIntrusiveListDefaultTag> class TIntrusiveList; @@ -51,7 +51,7 @@ class TAvlTree; template <class TValue, class TCmp> class TRbTree; -//containers +// containers template <class T, class A = std::allocator<T>> class TVector; @@ -97,7 +97,7 @@ class TStack; template <size_t BitCount, typename TChunkType = ui64> class TBitMap; -//autopointers +// autopointers class TDelete; class TDeleteArray; class TFree; @@ -151,7 +151,7 @@ using TArrayPtr = TAutoPtr<T, TDeleteArray>; template <typename T> using TMallocPtr = TAutoPtr<T, TFree>; -//maybe +// maybe namespace NMaybe { struct TPolicyUndefinedExcept; } diff --git a/util/generic/guid_ut.cpp b/util/generic/guid_ut.cpp index 82347941e6..a48b749e4c 100644 --- a/util/generic/guid_ut.cpp +++ b/util/generic/guid_ut.cpp @@ -3,7 +3,7 @@ #include "guid.h" Y_UNIT_TEST_SUITE(TGuidTest) { - //TODO - make real constructor + // TODO - make real constructor static TGUID Construct(ui32 d1, ui32 d2, ui32 d3, ui32 d4) { TGUID ret; @@ -66,7 +66,7 @@ Y_UNIT_TEST_SUITE(TGuidTest) { } Y_UNIT_TEST(Test3) { - //if this test failed, please, fix buffer size in GetGuidAsString() + // if this test failed, please, fix buffer size in GetGuidAsString() TGUID max = Construct(Max<ui32>(), Max<ui32>(), Max<ui32>(), Max<ui32>()); UNIT_ASSERT_EQUAL(GetGuidAsString(max).length(), 35); diff --git a/util/generic/intrlist.h b/util/generic/intrlist.h index 2982e3a281..0cd668e1ac 100644 --- a/util/generic/intrlist.h +++ b/util/generic/intrlist.h @@ -818,7 +818,7 @@ public: return End(); } - //compat methods + // compat methods inline iterator begin() noexcept { return Begin(); } diff --git a/util/generic/intrlist_ut.cpp b/util/generic/intrlist_ut.cpp index eff7cdf2ee..3a8de4b745 100644 --- a/util/generic/intrlist_ut.cpp +++ b/util/generic/intrlist_ut.cpp @@ -82,10 +82,10 @@ public: } } - //TMyList(const TMyList& rhs) = default; + // TMyList(const TMyList& rhs) = default; TMyList(TMyList&& rhs) noexcept = default; - //operator=(const TMyList& rhs) = default; + // operator=(const TMyList& rhs) = default; TMyList& operator=(TMyList&& rhs) noexcept = default; inline ~TMyList() { diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp index 79e832b024..c5a4037006 100644 --- a/util/generic/map_ut.cpp +++ b/util/generic/map_ut.cpp @@ -161,7 +161,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { { mmap::iterator ite(m.begin()); mmap::const_iterator cite(m.begin()); - //test compare between const_iterator and iterator + // test compare between const_iterator and iterator UNIT_ASSERT(ite == cite); UNIT_ASSERT(!(ite != cite)); UNIT_ASSERT(cite == ite); diff --git a/util/generic/mapfindptr_ut.cpp b/util/generic/mapfindptr_ut.cpp index 4178f3a0cc..e7ff3bb8e7 100644 --- a/util/generic/mapfindptr_ut.cpp +++ b/util/generic/mapfindptr_ut.cpp @@ -18,14 +18,14 @@ Y_UNIT_TEST_SUITE(TMapFindPtrTest) { UNIT_ASSERT_EQUAL(*a.FindPtr(42), "cat"); UNIT_ASSERT_EQUAL(a.FindPtr(0), nullptr); - //test mutation + // test mutation if (TString* p = a.FindPtr(42)) { *p = "dog"; } UNIT_ASSERT(a.FindPtr(42)); UNIT_ASSERT_EQUAL(*a.FindPtr(42), "dog"); - //test const-overloaded functions too + // test const-overloaded functions too const TTestMap& b = a; UNIT_ASSERT(b.FindPtr(42) && *b.FindPtr(42) == "dog"); UNIT_ASSERT_EQUAL(b.FindPtr(0), nullptr); diff --git a/util/generic/mem_copy.h b/util/generic/mem_copy.h index b68c852953..dad969fdc2 100644 --- a/util/generic/mem_copy.h +++ b/util/generic/mem_copy.h @@ -45,7 +45,7 @@ static inline TIfNotPOD<T> MemMove(T* to, const T* from, size_t n) { return MemCopy(to, from, n); } - //copy backwards + // copy backwards while (n) { to[n - 1] = from[n - 1]; --n; diff --git a/util/generic/set_ut.cpp b/util/generic/set_ut.cpp index d2769d327f..91ab2896d2 100644 --- a/util/generic/set_ut.cpp +++ b/util/generic/set_ut.cpp @@ -99,7 +99,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { std::pair<TSet<int>::iterator, TSet<int>::iterator> pit; std::pair<TSet<int>::const_iterator, TSet<int>::const_iterator> pcit; - //Check iterator on mutable set + // Check iterator on mutable set sit = s.lower_bound(2); UNIT_ASSERT(sit != s.end()); UNIT_ASSERT(*sit == 3); @@ -122,7 +122,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { UNIT_ASSERT(pit.second != s.end()); UNIT_ASSERT(*pit.second == 6); - //Check const_iterator on mutable set + // Check const_iterator on mutable set scit = s.lower_bound(2); UNIT_ASSERT(scit != s.end()); UNIT_ASSERT(*scit == 3); @@ -138,7 +138,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { UNIT_ASSERT(pcit.second != s.end()); UNIT_ASSERT(*pcit.second == 7); - //Check const_iterator on const set + // Check const_iterator on const set scit = crs.lower_bound(2); UNIT_ASSERT(scit != crs.end()); UNIT_ASSERT(*scit == 3); diff --git a/util/generic/singleton.cpp b/util/generic/singleton.cpp index df89d0a579..51174616a7 100644 --- a/util/generic/singleton.cpp +++ b/util/generic/singleton.cpp @@ -23,7 +23,7 @@ namespace { return ret; } - //clash almost impossible, ONLY if we have threads with ids 0 and 1! + // clash almost impossible, ONLY if we have threads with ids 0 and 1! return 1; } } diff --git a/util/generic/size_literals_ut.cpp b/util/generic/size_literals_ut.cpp index 410e22c39d..ac53601c66 100644 --- a/util/generic/size_literals_ut.cpp +++ b/util/generic/size_literals_ut.cpp @@ -64,5 +64,5 @@ void CompileTestSigned() { static_assert(8388607_TBs == 8388607_GBs * 1024, "Wrong 8388607TBs value"); // 2**23 - 1 TB // Should cause compilation error if uncommented - //static_assert(8388608_TBs == 8388608_GBs * 1024, "Wrong 8388608TBs value"); + // static_assert(8388608_TBs == 8388608_GBs * 1024, "Wrong 8388608TBs value"); } diff --git a/util/generic/strbuf.h b/util/generic/strbuf.h index 27237b1a32..3f946775dc 100644 --- a/util/generic/strbuf.h +++ b/util/generic/strbuf.h @@ -23,8 +23,8 @@ public: using char_type = TCharType; // TODO: DROP using traits_type = TTraits; - //Resolving some ambiguity between TStringBase and std::basic_string_view - //for typenames + // Resolving some ambiguity between TStringBase and std::basic_string_view + // for typenames using typename TStringView::const_iterator; using typename TStringView::const_reference; using typename TStringView::const_reverse_iterator; @@ -34,10 +34,10 @@ public: using typename TStringView::size_type; using typename TStringView::value_type; - //for constants + // for constants using TStringView::npos; - //for methods and operators + // for methods and operators using TStringView::begin; using TStringView::cbegin; using TStringView::cend; @@ -463,7 +463,7 @@ public: // string subsequences /// Sets the start pointer to a position relative to the end inline TdSelf& RSeek(size_t tailSize) noexcept { if (size() > tailSize) { - //WARN: removing TStringView:: will lead to an infinite recursion + // WARN: removing TStringView:: will lead to an infinite recursion *this = TStringView::substr(size() - tailSize, tailSize); } @@ -476,7 +476,7 @@ public: // string subsequences // exn_spec_violation: An exception of type "std::out_of_range" is thrown but the exception specification "noexcept" doesn't allow it to be thrown. This will result in a call to terminate(). // fun_call_w_exception: Called function TStringView::substr throws an exception of type "std::out_of_range". // Suppress this issue because we pass argument pos=0 and string_view can't throw std::out_of_range. - *this = TStringView::substr(0, targetSize); //WARN: removing TStringView:: will lead to an infinite recursion + *this = TStringView::substr(0, targetSize); // WARN: removing TStringView:: will lead to an infinite recursion return *this; } diff --git a/util/generic/strbuf_ut.cpp b/util/generic/strbuf_ut.cpp index 245b93bc98..092940d305 100644 --- a/util/generic/strbuf_ut.cpp +++ b/util/generic/strbuf_ut.cpp @@ -100,7 +100,7 @@ Y_UNIT_TEST_SUITE(TStrBufTest) { UNIT_ASSERT(str.AfterPrefix("cat_", r)); UNIT_ASSERT_EQUAL(r, "dog"); - //example: + // example: str = "http://ya.ru"; if (str.AfterPrefix("http://", r)) { UNIT_ASSERT_EQUAL(r, "ya.ru"); @@ -127,7 +127,7 @@ Y_UNIT_TEST_SUITE(TStrBufTest) { UNIT_ASSERT(str.BeforeSuffix("_dog", r)); UNIT_ASSERT_EQUAL(r, "cat"); - //example: + // example: str = "maps.yandex.com.ua"; if (str.BeforeSuffix(".ru", r)) { UNIT_ASSERT_EQUAL(r, "maps.yandex"); diff --git a/util/generic/string_ut.cpp b/util/generic/string_ut.cpp index b49e5ddb6b..60dbf82a8b 100644 --- a/util/generic/string_ut.cpp +++ b/util/generic/string_ut.cpp @@ -179,7 +179,7 @@ protected: } { - //This is to test move constructor + // This is to test move constructor TVector<TStringType> str_vect; str_vect.push_back(short_str1); @@ -279,7 +279,7 @@ protected: void null_char_of_empty() { const TStringType s; - //NOTE: https://a.yandex-team.ru/arcadia/junk/grechnik/test_string?rev=r12602052 + // NOTE: https://a.yandex-team.ru/arcadia/junk/grechnik/test_string?rev=r12602052 i64 i = s[s.size()]; UNIT_ASSERT_VALUES_EQUAL(i, 0); } @@ -350,7 +350,7 @@ protected: str.reserve(100); str = strorg; - //test self insertion: + // test self insertion: str.insert(10, str.c_str() + 5, 15); UNIT_ASSERT(str == Data_.This_is_teis_test_string_st_string_for_string_calls()); @@ -727,7 +727,7 @@ public: UNIT_TEST(TestAppendUtf16) UNIT_TEST(TestFillingAssign) UNIT_TEST(TestStdStreamApi) - //UNIT_TEST(TestOperatorsCI); must fail + // UNIT_TEST(TestOperatorsCI); must fail UNIT_TEST_SUITE_END(); void TestAppendUtf16() { diff --git a/util/generic/string_ut.h b/util/generic/string_ut.h index 3a91f61dd1..d72c2bd7ee 100644 --- a/util/generic/string_ut.h +++ b/util/generic/string_ut.h @@ -674,7 +674,7 @@ public: } #endif - // Find family + // Find family void TestFind() { const TStringType s(Data._0123456_12345()); @@ -897,7 +897,7 @@ public: ComputeHash(sS); /*size_t hash_val = sS.hash(); try { - //UNIT_ASSERT(hash_val == Data.HashOf_0123456()); + // UNIT_ASSERT(hash_val == Data.HashOf_0123456()); } catch (...) { Cerr << hash_val << Endl; throw; diff --git a/util/generic/typelist.h b/util/generic/typelist.h index 5ce26ab97c..abac46904f 100644 --- a/util/generic/typelist.h +++ b/util/generic/typelist.h @@ -55,7 +55,7 @@ struct TTypeList<H, R...> { }; }; -//FIXME: temporary to check overall build +// FIXME: temporary to check overall build template <class T> struct TTypeList<T, TNone>: public TTypeList<T> { }; diff --git a/util/generic/typetraits_ut.cpp b/util/generic/typetraits_ut.cpp index 174efdbda3..60da8d8086 100644 --- a/util/generic/typetraits_ut.cpp +++ b/util/generic/typetraits_ut.cpp @@ -384,7 +384,7 @@ namespace { Y_UNIT_TEST_SUITE(TTypeTraitsTestNg) { template <typename T> void TestImpl() { - //UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsPod, TTypeTraits<T>::IsPod); + // UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsPod, TTypeTraits<T>::IsPod); UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsVoid, std::is_void<T>::value); UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsEnum, std::is_enum<T>::value); UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsIntegral, std::is_integral<T>::value); diff --git a/util/generic/vector_ut.cpp b/util/generic/vector_ut.cpp index 63b10edab5..21c5853fd7 100644 --- a/util/generic/vector_ut.cpp +++ b/util/generic/vector_ut.cpp @@ -25,7 +25,7 @@ class TYVectorTest: public TTestBase { UNIT_TEST(TestAutoRef) UNIT_TEST(TestIterators) UNIT_TEST(TestShrink) - //UNIT_TEST(TestEbo) + // UNIT_TEST(TestEbo) UNIT_TEST(TestFillInConstructor) UNIT_TEST(TestYResize) UNIT_TEST(TestCrop) @@ -283,7 +283,7 @@ private: v.clear(); UNIT_ASSERT(v.empty()); - //check that clear save reserved data + // check that clear save reserved data UNIT_ASSERT_EQUAL(curCapacity, v.capacity()); v.insert(v.begin(), 5, 10); @@ -318,7 +318,7 @@ private: } { - //Test that used to generate an assertion when using __debug_alloc. + // Test that used to generate an assertion when using __debug_alloc. TVector<TestStruct> va; va.reserve(1); va.reserve(2); @@ -397,14 +397,14 @@ private: UNIT_ASSERT(vint.rbegin() == vint.rbegin()); // Not Standard: - //UNIT_ASSERT(vint.rbegin() == crvint.rbegin()); - //UNIT_ASSERT(crvint.rbegin() == vint.rbegin()); + // UNIT_ASSERT(vint.rbegin() == crvint.rbegin()); + // UNIT_ASSERT(crvint.rbegin() == vint.rbegin()); UNIT_ASSERT(crvint.rbegin() == crvint.rbegin()); UNIT_ASSERT(vint.rbegin() != vint.rend()); // Not Standard: - //UNIT_ASSERT(vint.rbegin() != crvint.rend()); - //UNIT_ASSERT(crvint.rbegin() != vint.rend()); + // UNIT_ASSERT(vint.rbegin() != crvint.rend()); + // UNIT_ASSERT(crvint.rbegin() != vint.rend()); UNIT_ASSERT(crvint.rbegin() != crvint.rend()); } diff --git a/util/generic/yexception.cpp b/util/generic/yexception.cpp index 6b067e90bb..dd52fe78fa 100644 --- a/util/generic/yexception.cpp +++ b/util/generic/yexception.cpp @@ -103,8 +103,8 @@ std::string CurrentExceptionTypeName() { return TypeName(*currentExceptionTypePtr); } #endif - //There is no abi::__cxa_current_exception_type() on Windows. - //Emulated it with rethrow - catch construction. + // There is no abi::__cxa_current_exception_type() on Windows. + // Emulated it with rethrow - catch construction. std::exception_ptr currentException = std::current_exception(); Y_ASSERT(currentException != nullptr); try { diff --git a/util/generic/yexception_ut.cpp b/util/generic/yexception_ut.cpp index 3c89a487db..b3811ceb48 100644 --- a/util/generic/yexception_ut.cpp +++ b/util/generic/yexception_ut.cpp @@ -377,13 +377,13 @@ private: UNIT_ASSERT(errMoveAssign.AsStrBuf().Contains(testStr)); } inline void TestCurrentExceptionTypeNameMethod() { - //Basic test of getting the correct exception type name. + // Basic test of getting the correct exception type name. try { throw std::runtime_error("Test Runtime Error Exception"); } catch (...) { UNIT_ASSERT_STRING_CONTAINS(CurrentExceptionTypeName(), "std::runtime_error"); } - //Test when exception has an unusual type. Under Linux it should return "int" and under other OSs "unknown type". + // Test when exception has an unusual type. Under Linux it should return "int" and under other OSs "unknown type". try { throw int(1); } catch (...) { @@ -393,7 +393,7 @@ private: UNIT_ASSERT_VALUES_EQUAL(CurrentExceptionTypeName(), "unknown type"); #endif } - //Test when the caught exception is rethrown with std::rethrow_exception. + // Test when the caught exception is rethrown with std::rethrow_exception. try { throw std::logic_error("Test Logic Error Exception"); } catch (...) { @@ -403,8 +403,8 @@ private: UNIT_ASSERT_STRING_CONTAINS(CurrentExceptionTypeName(), "std::logic_error"); } } - //Test when the caught exception is rethrown with throw; . - //This test is different from the previous one because of the interaction with cxxabi specifics. + // Test when the caught exception is rethrown with throw; . + // This test is different from the previous one because of the interaction with cxxabi specifics. try { throw std::bad_alloc(); } catch (...) { @@ -429,7 +429,7 @@ private: #endif } } - //Test when int is rethrown with throw; . + // Test when int is rethrown with throw; . try { throw int(1); } catch (...) { diff --git a/util/memory/addstorage_ut.cpp b/util/memory/addstorage_ut.cpp index 9b0c4989ab..1553015922 100644 --- a/util/memory/addstorage_ut.cpp +++ b/util/memory/addstorage_ut.cpp @@ -16,7 +16,7 @@ private: UNIT_ASSERT_EQUAL(c->AdditionalDataLength(), 100); - //test segfault + // test segfault memset(c->AdditionalData(), 0, c->AdditionalDataLength()); } }; diff --git a/util/memory/segpool_alloc.h b/util/memory/segpool_alloc.h index 0a06a79abe..455d266d41 100644 --- a/util/memory/segpool_alloc.h +++ b/util/memory/segpool_alloc.h @@ -82,10 +82,10 @@ struct segpool_alloc { } } ~segpool_alloc() { - //assert(pool_count == pool_free_count && malloc_count == malloc_free_count); <- uncomment when swap() problem is solved - //printf("in ~segpool_alloc: size = %u, pool_count = %" PRId64 ", malloc_count = %" PRId64 ", pool_free_count = %" PRId64 ", malloc_free_count = %" PRId64 "\n", + // assert(pool_count == pool_free_count && malloc_count == malloc_free_count); <- uncomment when swap() problem is solved + // printf("in ~segpool_alloc: size = %u, pool_count = %" PRId64 ", malloc_count = %" PRId64 ", pool_free_count = %" PRId64 ", malloc_free_count = %" PRId64 "\n", // sizeof(_Tp), pool_count, malloc_count, pool_free_count, malloc_free_count); - //fflush(stdout); + // fflush(stdout); } template <class _Tp1> struct rebind { diff --git a/util/network/address.cpp b/util/network/address.cpp index 47badf504f..e20acddf77 100644 --- a/util/network/address.cpp +++ b/util/network/address.cpp @@ -79,7 +79,7 @@ static inline void PrintAddr(IOutputStream& out, const IRemoteAddr& addr) { out << "(raw " << (int)a->sa_family << " "; while (b != e) { - //just print raw bytes + // just print raw bytes out << (int)*b++; if (b != e) { out << " "; diff --git a/util/network/address.h b/util/network/address.h index fac61ce665..1e02d976b3 100644 --- a/util/network/address.h +++ b/util/network/address.h @@ -31,7 +31,7 @@ namespace NAddr { socklen_t SockAddrLength(const sockaddr* addr); - //for accept, recvfrom - see LenPtr() + // for accept, recvfrom - see LenPtr() class TOpaqueAddr: public IRemoteAddr { public: inline TOpaqueAddr() noexcept @@ -75,7 +75,7 @@ namespace NAddr { socklen_t L_; }; - //for TNetworkAddress + // for TNetworkAddress class TAddrInfo: public IRemoteAddr { public: inline TAddrInfo(const addrinfo* ai) noexcept @@ -95,7 +95,7 @@ namespace NAddr { const addrinfo* const AI_; }; - //compat, for TIpAddress + // compat, for TIpAddress class TIPv4Addr: public IRemoteAddr { public: inline TIPv4Addr(const TIpAddress& addr) noexcept @@ -115,7 +115,7 @@ namespace NAddr { const TIpAddress A_; }; - //same, for ipv6 addresses + // same, for ipv6 addresses class TIPv6Addr: public IRemoteAddr { public: inline TIPv6Addr(const sockaddr_in6& a) noexcept diff --git a/util/network/endpoint.h b/util/network/endpoint.h index a3e59b4925..728f5841d5 100644 --- a/util/network/endpoint.h +++ b/util/network/endpoint.h @@ -4,7 +4,7 @@ #include <util/str_stl.h> -//some equivalent boost::asio::ip::endpoint (easy for using pair ip:port) +// some equivalent boost::asio::ip::endpoint (easy for using pair ip:port) class TEndpoint { public: using TAddrRef = NAddr::IRemoteAddrRef; diff --git a/util/network/nonblock.cpp b/util/network/nonblock.cpp index e515c27cc5..2d061ef54c 100644 --- a/util/network/nonblock.cpp +++ b/util/network/nonblock.cpp @@ -25,7 +25,7 @@ namespace { Accept4 = reinterpret_cast<TAccept4>(dlsym(RTLD_DEFAULT, "accept4")); #if defined(_musl_) - //musl always statically linked + // musl always statically linked if (!Accept4) { Accept4 = accept4; } @@ -60,7 +60,7 @@ namespace { const SOCKET ret = accept(s, addr, addrlen); #if !defined(_freebsd_) - //freebsd inherit O_NONBLOCK flag + // freebsd inherit O_NONBLOCK flag if (ret != INVALID_SOCKET) { SetNonBlock(ret); } diff --git a/util/network/nonblock.h b/util/network/nonblock.h index 54e5e44ae3..5afed8352f 100644 --- a/util/network/nonblock.h +++ b/util/network/nonblock.h @@ -2,7 +2,7 @@ #include "socket.h" -//assume s is non-blocking, return non-blocking socket +// assume s is non-blocking, return non-blocking socket SOCKET Accept4(SOCKET s, struct sockaddr* addr, socklen_t* addrlen); -//create non-blocking socket +// create non-blocking socket SOCKET Socket4(int domain, int type, int protocol); diff --git a/util/network/pollerimpl.h b/util/network/pollerimpl.h index f92a6fb489..36b82da5be 100644 --- a/util/network/pollerimpl.h +++ b/util/network/pollerimpl.h @@ -19,7 +19,7 @@ #define HAVE_EPOLL_POLLER #endif -//now we always have it +// now we always have it #define HAVE_SELECT_POLLER #if defined(HAVE_KQUEUE_POLLER) diff --git a/util/network/socket.cpp b/util/network/socket.cpp index fb9dac7f09..b5d96e9157 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -943,7 +943,7 @@ void TSocketOutput::DoWriteV(const TPart* parts, size_t count) { } namespace { - //https://bugzilla.mozilla.org/attachment.cgi?id=503263&action=diff + // https://bugzilla.mozilla.org/attachment.cgi?id=503263&action=diff struct TLocalNames: public THashSet<TStringBuf> { inline TLocalNames() { diff --git a/util/network/socket.h b/util/network/socket.h index 856e707d8a..f345bdaf54 100644 --- a/util/network/socket.h +++ b/util/network/socket.h @@ -423,5 +423,5 @@ private: TSocket S_; }; -//return -(error code) if error occured, or number of ready fds +// return -(error code) if error occured, or number of ready fds ssize_t PollD(struct pollfd fds[], nfds_t nfds, const TInstant& deadLine) noexcept; diff --git a/util/random/common_ops.h b/util/random/common_ops.h index 209e8dbb48..bdfabce2ab 100644 --- a/util/random/common_ops.h +++ b/util/random/common_ops.h @@ -115,7 +115,7 @@ struct TCommonRNG { return ::NPrivate::ToRandReal4(Engine().GenRand64()); } - //compatibility stuff + // compatibility stuff inline TResult operator()() noexcept { return Engine().GenRand(); } diff --git a/util/random/entropy.cpp b/util/random/entropy.cpp index 3617edb83d..0fec636e75 100644 --- a/util/random/entropy.cpp +++ b/util/random/entropy.cpp @@ -53,7 +53,7 @@ namespace { try { Save(&out, GetExecPath()); } catch (...) { - //workaround - sometimes fails on FreeBSD + // workaround - sometimes fails on FreeBSD } Save(&out, (size_t)Data()); @@ -93,7 +93,7 @@ namespace { { TMemoryOutput out(Data(), Size()); - //replace zlib header with hash + // replace zlib header with hash Save(&out, CityHash64(Data(), Size())); } @@ -101,7 +101,7 @@ namespace { } }; - //not thread-safe + // not thread-safe class TMersenneInput: public IInputStream { using TKey = ui64; using TRnd = TMersenne<TKey>; diff --git a/util/stream/buffered.cpp b/util/stream/buffered.cpp index c7d6647ec1..e206bcfe97 100644 --- a/util/stream/buffered.cpp +++ b/util/stream/buffered.cpp @@ -207,7 +207,7 @@ public: Slave_->Write(parts, end - parts); - //grow buffer only on full flushes + // grow buffer only on full flushes OnBufferExhausted(); Reset(); diff --git a/util/stream/buffered_ut.cpp b/util/stream/buffered_ut.cpp index 41d2fc3030..d101b9d550 100644 --- a/util/stream/buffered_ut.cpp +++ b/util/stream/buffered_ut.cpp @@ -111,21 +111,21 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) { TString s("0123456789abcdefghijklmn"); TBuffered<TStringInput> in(5, s); char c; - UNIT_ASSERT_VALUES_EQUAL(in.Read(&c, 1), 1); //1 + UNIT_ASSERT_VALUES_EQUAL(in.Read(&c, 1), 1); // 1 UNIT_ASSERT_VALUES_EQUAL(c, '0'); - UNIT_ASSERT_VALUES_EQUAL(in.Skip(4), 4); //5 end of buffer - UNIT_ASSERT_VALUES_EQUAL(in.Read(&c, 1), 1); //6 + UNIT_ASSERT_VALUES_EQUAL(in.Skip(4), 4); // 5 end of buffer + UNIT_ASSERT_VALUES_EQUAL(in.Read(&c, 1), 1); // 6 UNIT_ASSERT_VALUES_EQUAL(c, '5'); - UNIT_ASSERT_VALUES_EQUAL(in.Skip(3), 3); //9 - UNIT_ASSERT_VALUES_EQUAL(in.Read(&c, 1), 1); //10 end of buffer + UNIT_ASSERT_VALUES_EQUAL(in.Skip(3), 3); // 9 + UNIT_ASSERT_VALUES_EQUAL(in.Read(&c, 1), 1); // 10 end of buffer UNIT_ASSERT_VALUES_EQUAL(c, '9'); - UNIT_ASSERT_VALUES_EQUAL(in.Skip(3), 3); //13 - UNIT_ASSERT_VALUES_EQUAL(in.Read(&c, 1), 1); //14 start new buffer + UNIT_ASSERT_VALUES_EQUAL(in.Skip(3), 3); // 13 + UNIT_ASSERT_VALUES_EQUAL(in.Read(&c, 1), 1); // 14 start new buffer UNIT_ASSERT_VALUES_EQUAL(c, 'd'); - UNIT_ASSERT_VALUES_EQUAL(in.Skip(6), 6); //20 - UNIT_ASSERT_VALUES_EQUAL(in.Read(&c, 1), 1); //21 start new buffer + UNIT_ASSERT_VALUES_EQUAL(in.Skip(6), 6); // 20 + UNIT_ASSERT_VALUES_EQUAL(in.Read(&c, 1), 1); // 21 start new buffer UNIT_ASSERT_VALUES_EQUAL(c, 'k'); - UNIT_ASSERT_VALUES_EQUAL(in.Skip(6), 3); //24 eof + UNIT_ASSERT_VALUES_EQUAL(in.Skip(6), 3); // 24 eof } Y_UNIT_TEST(TestReadTo) { diff --git a/util/stream/zlib.cpp b/util/stream/zlib.cpp index 06f181ee53..4ec9667443 100644 --- a/util/stream/zlib.cpp +++ b/util/stream/zlib.cpp @@ -10,13 +10,13 @@ namespace { static const int opts[] = { - //Auto + // Auto 15 + 32, - //ZLib + // ZLib 15 + 0, - //GZip + // GZip 15 + 16, - //Raw + // Raw -15}; class TZLibCommon { diff --git a/util/string/hex.cpp b/util/string/hex.cpp index 667397987f..7b1af2c6b7 100644 --- a/util/string/hex.cpp +++ b/util/string/hex.cpp @@ -3,10 +3,10 @@ const char* const Char2DigitTable = ("\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" - "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\xff\xff\xff\xff\xff\xff" //0-9 - "\xff\x0a\x0b\x0c\x0d\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff" //A-Z + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\xff\xff\xff\xff\xff\xff" // 0-9 + "\xff\x0a\x0b\x0c\x0d\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff" // A-Z "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" - "\xff\x0a\x0b\x0c\x0d\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff" //a-z + "\xff\x0a\x0b\x0c\x0d\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff" // a-z "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" diff --git a/util/string/split.h b/util/string/split.h index e351ecbebd..27fdf9793d 100644 --- a/util/string/split.h +++ b/util/string/split.h @@ -782,7 +782,7 @@ namespace NStringSplitPrivate { size_t successfullyFilled = 0; auto it = this->begin(); - //FIXME: actually, some kind of TryApplyToMany is needed in order to stop iteration upon first failure + // FIXME: actually, some kind of TryApplyToMany is needed in order to stop iteration upon first failure ApplyToMany([&](auto&& arg) { if (it != this->end()) { if (TryDoFromString(it->Token(), arg)) { @@ -1007,7 +1007,7 @@ namespace NStringSplitPrivate { { } - //does not own TDelim + // does not own TDelim template <class TDelim> inline TIt<TPtrPolicy<const TDelim>> Split(const TDelim& d) const noexcept { return {String_, &d}; diff --git a/util/string/split_ut.cpp b/util/string/split_ut.cpp index ce3054bce1..b3dbdc33b8 100644 --- a/util/string/split_ut.cpp +++ b/util/string/split_ut.cpp @@ -579,15 +579,15 @@ Y_UNIT_TEST_SUITE(StringSplitter) { UNIT_ASSERT_VALUES_EQUAL(b, 500); UNIT_ASSERT_VALUES_EQUAL(c, 3); - //not enough tokens + // not enough tokens parsingSucceeded = StringSplitter("3,14").Split(',').TryCollectInto(&a, &b, &c); UNIT_ASSERT(!parsingSucceeded); - //too many tokens + // too many tokens parsingSucceeded = StringSplitter("3,14,15,92,6").Split(',').TryCollectInto(&a, &b, &c); UNIT_ASSERT(!parsingSucceeded); - //where single TryFromString fails + // where single TryFromString fails parsingSucceeded = StringSplitter("ot topota kopyt pyl po polu letit").Split(' ').TryCollectInto(&a, &b, &c); UNIT_ASSERT(!parsingSucceeded); } @@ -713,7 +713,7 @@ Y_UNIT_TEST_SUITE(StringSplitter) { Y_UNIT_TEST(TestStdSplitAfterSplit) { std::string_view input = "a*b+a*b"; for (std::string_view summand : StringSplitter(input).Split('+')) { - //FIXME: std::string is used to workaround MSVC ICE + // FIXME: std::string is used to workaround MSVC ICE UNIT_ASSERT_VALUES_EQUAL(std::string(summand), "a*b"); std::string_view multiplier1, multiplier2; bool splitResult = StringSplitter(summand).Split('*').TryCollectInto(&multiplier1, &multiplier2); diff --git a/util/string/type.cpp b/util/string/type.cpp index 49671c02c2..a1a34f6db5 100644 --- a/util/string/type.cpp +++ b/util/string/type.cpp @@ -59,7 +59,7 @@ namespace { } return false; } -} //anonymous namespace +} // anonymous namespace bool IsTrue(const TStringBuf v) noexcept { static constexpr std::array<TStringBuf, 7> trueOptions{ diff --git a/util/string/util.h b/util/string/util.h index 0d77a5042b..47651adb71 100644 --- a/util/string/util.h +++ b/util/string/util.h @@ -1,6 +1,6 @@ #pragma once -//THIS FILE A COMPAT STUB HEADER +// THIS FILE A COMPAT STUB HEADER #include <cstring> #include <cstdarg> @@ -36,7 +36,7 @@ inline void addIfNotLast(TString& s, int lastCh) { inline void addIfAbsent(TString& s, char lastCh1, char lastCh2) { size_t pos = s.find(lastCh2); if (pos == TString::npos) { - //s.append((char)lastCh1); + // s.append((char)lastCh1); addIfNotLast(s, lastCh1); } else if (pos < s.length() - 1) { addIfNotLast(s, lastCh2); diff --git a/util/system/backtrace.cpp b/util/system/backtrace.cpp index f8d37e8443..8cc93cd3ce 100644 --- a/util/system/backtrace.cpp +++ b/util/system/backtrace.cpp @@ -17,7 +17,7 @@ #endif #if defined(_bionic_) -//TODO +// TODO #else #if !defined(HAVE_BACKTRACE) && defined(_cygwin_) #define CaptureStackBackTrace RtlCaptureStackBackTrace diff --git a/util/system/backtrace_ut.cpp b/util/system/backtrace_ut.cpp index 9b5ead71bc..b2de5e3957 100644 --- a/util/system/backtrace_ut.cpp +++ b/util/system/backtrace_ut.cpp @@ -56,7 +56,7 @@ class TBackTraceTest: public TTestBase { } void TestBackTrace() { - //PrintBackTrace(); + // PrintBackTrace(); void* buf1[100]; size_t ret1; diff --git a/util/system/byteorder.h b/util/system/byteorder.h index 94b9fea515..d408b2a1a4 100644 --- a/util/system/byteorder.h +++ b/util/system/byteorder.h @@ -2,7 +2,7 @@ #include "defaults.h" -//#define USE_GENERIC_ENDIAN_CVT +// #define USE_GENERIC_ENDIAN_CVT #if defined(_linux_) && !defined(USE_GENERIC_ENDIAN_CVT) #include <byteswap.h> @@ -66,7 +66,7 @@ inline ui64 SwapBytes64(ui64 val) noexcept { } #endif -//for convenience +// for convenience static inline ui8 SwapBytes8(ui8 v) noexcept { return v; } diff --git a/util/system/compat.h b/util/system/compat.h index 437e287497..119b3a2d5f 100644 --- a/util/system/compat.h +++ b/util/system/compat.h @@ -24,8 +24,8 @@ extern "C" { #define SIGQUIT SIGBREAK // instead of 3 #define SIGKILL SIGTERM // instead of 9 - #define SIGPIPE 13 //will not receive under win? - #define SIGALRM 14 //will not receive under win? + #define SIGPIPE 13 // will not receive under win? + #define SIGALRM 14 // will not receive under win? #endif #if defined(__FreeBSD__) || defined(_darwin_) diff --git a/util/system/compiler.h b/util/system/compiler.h index a076c0308c..0c730eae4d 100644 --- a/util/system/compiler.h +++ b/util/system/compiler.h @@ -132,7 +132,7 @@ #endif #endif -//to cheat compiler about strict aliasing or similar problems +// to cheat compiler about strict aliasing or similar problems #if defined(__GNUC__) #define Y_FAKE_READ(X) \ do { \ diff --git a/util/system/condvar.cpp b/util/system/condvar.cpp index b4d748e4e9..9bc8fdd060 100644 --- a/util/system/condvar.cpp +++ b/util/system/condvar.cpp @@ -39,7 +39,7 @@ namespace { inline void BroadCast() noexcept { with_lock (Lock_) { - //TODO + // TODO while (!Events_.Empty()) { Events_.PopFront()->Signal(); } diff --git a/util/system/condvar.h b/util/system/condvar.h index 569162717c..a030528353 100644 --- a/util/system/condvar.h +++ b/util/system/condvar.h @@ -55,7 +55,7 @@ public: WaitD(m, TInstant::Max(), std::move(pred)); } - //deprecated + // deprecated inline void Wait(TMutex& m) noexcept { WaitI(m); } diff --git a/util/system/cpu_id_ut.cpp b/util/system/cpu_id_ut.cpp index 68f1f8aac7..6faed95aba 100644 --- a/util/system/cpu_id_ut.cpp +++ b/util/system/cpu_id_ut.cpp @@ -78,7 +78,7 @@ Y_UNIT_TEST_SUITE(TestCpuId) { Y_UNIT_TEST(TestCpuBrand) { ui32 store[12]; - //Cout << CpuBrand(store) << Endl;; + // Cout << CpuBrand(store) << Endl;; UNIT_ASSERT(strlen(CpuBrand(store)) > 0); } diff --git a/util/system/datetime.h b/util/system/datetime.h index f2c2c9f8c8..724ffff394 100644 --- a/util/system/datetime.h +++ b/util/system/datetime.h @@ -27,7 +27,7 @@ inline ui64 millisec() { } /// Current time in seconds since epoch ui32 Seconds() noexcept; -///Current thread time in microseconds +/// Current thread time in microseconds ui64 ThreadCPUUserTime() noexcept; ui64 ThreadCPUSystemTime() noexcept; ui64 ThreadCPUTime() noexcept; diff --git a/util/system/defaults.c b/util/system/defaults.c index 75710009ac..90a367c781 100644 --- a/util/system/defaults.c +++ b/util/system/defaults.c @@ -1,2 +1,2 @@ -//test for C-compiler compileability +// test for C-compiler compileability #include "defaults.h" diff --git a/util/system/demangle_impl.h b/util/system/demangle_impl.h index 081004f976..9184e1f560 100644 --- a/util/system/demangle_impl.h +++ b/util/system/demangle_impl.h @@ -18,4 +18,4 @@ namespace NPrivate { THolder<char, TFree> TmpBuf_; }; -} //namespace NPrivate +} // namespace NPrivate diff --git a/util/system/event.cpp b/util/system/event.cpp index 42311d4835..9bb27aed2c 100644 --- a/util/system/event.cpp +++ b/util/system/event.cpp @@ -37,7 +37,7 @@ public: const TInstant now = Now(); if (now < deadLine) { - //TODO + // TODO return WaitForSingleObject(cond, (deadLine - now).MilliSeconds()) == WAIT_OBJECT_0; } diff --git a/util/system/event.h b/util/system/event.h index cab2fc478a..e4dc699672 100644 --- a/util/system/event.h +++ b/util/system/event.h @@ -46,7 +46,7 @@ public: WaitD(TInstant::Max()); } - //return true if signaled, false if timed out. + // return true if signaled, false if timed out. inline bool Wait(ui32 timer) noexcept { return WaitT(TDuration::MilliSeconds(timer)); } diff --git a/util/system/file.cpp b/util/system/file.cpp index 30bba71a03..1f029a71f9 100644 --- a/util/system/file.cpp +++ b/util/system/file.cpp @@ -297,7 +297,7 @@ TFileHandle::TFileHandle(const std::filesystem::path& path, EOpenMode oMode) noe } #endif - //temp file + // temp file if (Fd_ >= 0 && (oMode & Transient)) { std::filesystem::remove(path); } @@ -670,7 +670,7 @@ bool TFileHandle::LinkTo(const TFileHandle& fh) const noexcept { return false; } - //not thread-safe + // not thread-safe nh.Swap(*const_cast<TFileHandle*>(this)); return true; @@ -1336,7 +1336,7 @@ void TFile::LinkTo(const TFile& f) const { } TFile TFile::Temporary(const TString& prefix) { - //TODO - handle impossible case of name collision + // TODO - handle impossible case of name collision return TFile(prefix + ToString(MicroSeconds()) + "-" + ToString(RandomNumber<ui64>()), CreateNew | RdWr | Seq | Temp | Transient); } diff --git a/util/system/file.h b/util/system/file.h index 57531fd8c9..ae73bb79c6 100644 --- a/util/system/file.h +++ b/util/system/file.h @@ -120,7 +120,7 @@ public: bool FallocateNoResize(i64 length) noexcept; bool ShrinkToFit() noexcept; bool Flush() noexcept; - //flush data only, without file metadata + // flush data only, without file metadata bool FlushData() noexcept; i32 Read(void* buffer, ui32 byteCount) noexcept; i32 Write(const void* buffer, ui32 byteCount) noexcept; @@ -131,22 +131,22 @@ public: FHANDLE Duplicate() const noexcept; int Duplicate2Posix(int dstHandle) const noexcept; - //dup2 - like semantics, return true on success + // dup2 - like semantics, return true on success bool LinkTo(const TFileHandle& fh) const noexcept; - //very low-level methods + // very low-level methods bool SetDirect(); void ResetDirect(); /* Manual file cache management, length = 0 means "as much as possible" */ - //measure amount of cached data in bytes, returns -1 if failed + // measure amount of cached data in bytes, returns -1 if failed i64 CountCache(i64 offset = 0, i64 length = 0) const noexcept; - //read data into cache and optionally wait for completion + // read data into cache and optionally wait for completion void PrefetchCache(i64 offset = 0, i64 length = 0, bool wait = true) const noexcept; - //remove clean and unused data from cache + // remove clean and unused data from cache void EvictCache(i64 offset = 0, i64 length = 0) const noexcept; - //flush unwritten data in this range and optionally wait for completion + // flush unwritten data in this range and optionally wait for completion bool FlushCache(i64 offset = 0, i64 length = 0, bool wait = true) noexcept; private: @@ -207,19 +207,19 @@ public: void Flock(int op); - //do not use, their meaning very platform-dependant + // do not use, their meaning very platform-dependant void SetDirect(); void ResetDirect(); /* Manual file cache management, length = 0 means "as much as possible" */ - //measure amount of cached data in bytes, returns -1 if failed + // measure amount of cached data in bytes, returns -1 if failed i64 CountCache(i64 offset = 0, i64 length = 0) const noexcept; - //read data into cache and optionally wait for completion + // read data into cache and optionally wait for completion void PrefetchCache(i64 offset = 0, i64 length = 0, bool wait = true) const noexcept; - //remove clean and unused data from cache, incomplete pages could stay + // remove clean and unused data from cache, incomplete pages could stay void EvictCache(i64 offset = 0, i64 length = 0) const noexcept; - //flush unwritten data in this range and optionally wait for completion + // flush unwritten data in this range and optionally wait for completion void FlushCache(i64 offset = 0, i64 length = 0, bool wait = true); static TFile Temporary(const TString& prefix); diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp index 8e25d84928..92b6e9902a 100644 --- a/util/system/filemap.cpp +++ b/util/system/filemap.cpp @@ -300,7 +300,7 @@ public: void Evict() { #if defined(_unix_) -// Evict(PtrStart_, Length_); +// Evict(PtrStart_, Length_); #endif } diff --git a/util/system/filemap_ut.cpp b/util/system/filemap_ut.cpp index 1305e34995..cfa13b8b4f 100644 --- a/util/system/filemap_ut.cpp +++ b/util/system/filemap_ut.cpp @@ -127,9 +127,9 @@ Y_UNIT_TEST_SUITE(TFileMapTest) { } #if defined(_asan_enabled_) || defined(_msan_enabled_) -//setrlimit incompatible with asan runtime +// setrlimit incompatible with asan runtime #elif defined(_cygwin_) -//cygwin is not real unix :( +// cygwin is not real unix :( #else Y_UNIT_TEST(TestNotGreedy) { unsigned page[4096 / sizeof(unsigned)]; diff --git a/util/system/fs.cpp b/util/system/fs.cpp index 808bc0b7b6..0e5ffe4e41 100644 --- a/util/system/fs.cpp +++ b/util/system/fs.cpp @@ -88,7 +88,7 @@ bool NFs::MakeDirectoryRecursive(const TString& path, EFilePermissions mode, boo } return true; } else { - //NOTE: recursion is finite due to existence of "." and "/" + // NOTE: recursion is finite due to existence of "." and "/" if (!NFs::MakeDirectoryRecursive(TFsPath(path).Parent(), mode, false)) { return false; } diff --git a/util/system/fs_ut.cpp b/util/system/fs_ut.cpp index ddee6670a8..2df9a3b2a4 100644 --- a/util/system/fs_ut.cpp +++ b/util/system/fs_ut.cpp @@ -6,7 +6,7 @@ #include "fstat.h" #include <util/folder/path.h> -//WARNING: on windows the test must be run with administative rules +// WARNING: on windows the test must be run with administative rules class TFsTest: public TTestBase { UNIT_TEST_SUITE(TFsTest); @@ -45,7 +45,7 @@ void TFsTest::TestCreateRemove() { UNIT_ASSERT(NFs::Exists(dir1)); TFsPath subdir1 = dir1 / "a" / "b"; - //TFsPath link = dir1 / "link"; + // TFsPath link = dir1 / "link"; UNIT_ASSERT(NFs::MakeDirectoryRecursive(subdir1, NFs::FP_COMMON_FILE, true)); UNIT_ASSERT(NFs::Exists(subdir1)); @@ -59,7 +59,7 @@ void TFsTest::TestCreateRemove() { Touch(file1); Touch(file2); Touch(file3); - //UNIT_ASSERT(NFs::SymLink(file3.RealPath(), link)); + // UNIT_ASSERT(NFs::SymLink(file3.RealPath(), link)); UNIT_ASSERT(NFs::MakeDirectoryRecursive(dir1 / "subdir1" / "subdir2" / "subdir3" / "subdir4", NFs::FP_COMMON_FILE, false)); UNIT_ASSERT(NFs::MakeDirectoryRecursive(dir1 / "subdir1" / "subdir2", NFs::FP_COMMON_FILE, false)); @@ -80,7 +80,7 @@ void TFsTest::TestCreateRemove() { UNIT_ASSERT(NFs::Exists(file1)); UNIT_ASSERT(NFs::Exists(file2)); UNIT_ASSERT(NFs::Exists(file3)); - //UNIT_ASSERT(NFs::Exists(link)); + // UNIT_ASSERT(NFs::Exists(link)); UNIT_ASSERT(!NFs::Remove(dir1)); NFs::RemoveRecursive(dir1); @@ -88,7 +88,7 @@ void TFsTest::TestCreateRemove() { UNIT_ASSERT(!NFs::Exists(file1)); UNIT_ASSERT(!NFs::Exists(file2)); UNIT_ASSERT(!NFs::Exists(file3)); - //UNIT_ASSERT(!NFs::Exists(link)); + // UNIT_ASSERT(!NFs::Exists(link)); UNIT_ASSERT(!NFs::Exists(subdir1)); UNIT_ASSERT(!NFs::Exists(longfile)); UNIT_ASSERT(!NFs::Exists(dir1)); @@ -186,7 +186,7 @@ static void RunHardlinkTest(const TFsPath& src, const TFsPath& dst) { void TFsTest::TestHardlink() { RunHardlinkTest("tempfile", "hardlinkfile"); - RunHardlinkTest("tempfile_абвг", "hardlinkfile_абвг"); //utf-8 names + RunHardlinkTest("tempfile_абвг", "hardlinkfile_абвг"); // utf-8 names } static void RunSymLinkTest(TString fileLocalName, TString symLinkName) { @@ -240,7 +240,7 @@ static void RunSymLinkTest(TString fileLocalName, TString symLinkName) { { TFileStat fs(linkD1, true); UNIT_ASSERT(!fs.IsFile()); - //UNIT_ASSERT(fs.IsDir()); // failed on unix + // UNIT_ASSERT(fs.IsDir()); // failed on unix UNIT_ASSERT(fs.IsSymlink()); } { @@ -253,7 +253,7 @@ static void RunSymLinkTest(TString fileLocalName, TString symLinkName) { { TFileStat fs(symLinkName, true); - //UNIT_ASSERT(fs.IsFile()); // no evidence that symlink has to be a file as well + // UNIT_ASSERT(fs.IsFile()); // no evidence that symlink has to be a file as well UNIT_ASSERT(!fs.IsDir()); UNIT_ASSERT(fs.IsSymlink()); } @@ -277,7 +277,7 @@ static void RunSymLinkTest(TString fileLocalName, TString symLinkName) { void TFsTest::TestSymlink() { // if previous running was failed RunSymLinkTest("f.txt", "fl.txt"); - RunSymLinkTest("f_абвг.txt", "fl_абвг.txt"); //utf-8 names + RunSymLinkTest("f_абвг.txt", "fl_абвг.txt"); // utf-8 names } void TFsTest::TestCwdOpts() { diff --git a/util/system/fs_win.cpp b/util/system/fs_win.cpp index 16a87ff385..7f75d1e8b2 100644 --- a/util/system/fs_win.cpp +++ b/util/system/fs_win.cpp @@ -225,7 +225,7 @@ namespace NFsPrivate { size_t len = rdb->MountPointReparseBuffer.SubstituteNameLength / sizeof(wchar16); return WideToUTF8(str, len); } - //this reparse point is unsupported in arcadia + // this reparse point is unsupported in arcadia return TString(); } @@ -236,7 +236,7 @@ namespace NFsPrivate { } // we can't use this function to get an analog of unix inode due to a lot of NTFS folders do not have this GUID - //(it will be 'create' case really) + // (it will be 'create' case really) /* bool GetObjectId(const char* path, GUID* id) { TFileHandle h = CreateFileWithUtf8Name(path, 0, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, diff --git a/util/system/fstat_ut.cpp b/util/system/fstat_ut.cpp index 300f76d7e6..0438063179 100644 --- a/util/system/fstat_ut.cpp +++ b/util/system/fstat_ut.cpp @@ -52,7 +52,7 @@ Y_UNIT_TEST_SUITE(TestFileStat) { UNIT_ASSERT(!fs.IsFile()); UNIT_ASSERT(fs.IsDir()); UNIT_ASSERT(!fs.IsSymlink()); - //UNIT_ASSERT(fs.Size == 0); // it fails under unix + // UNIT_ASSERT(fs.Size == 0); // it fails under unix UNIT_ASSERT(NFs::Remove("tmpd")); fs = TFileStat("tmpd"); UNIT_ASSERT(!fs.IsFile()); diff --git a/util/system/guard.h b/util/system/guard.h index b6ca45fff6..2b4192c01a 100644 --- a/util/system/guard.h +++ b/util/system/guard.h @@ -21,7 +21,7 @@ struct TTryLockOps: public TCommonLockOps<T> { } }; -//must be used with great care +// must be used with great care template <class TOps> struct TInverseLockOps: public TOps { template <class T> diff --git a/util/system/info.cpp b/util/system/info.cpp index 59a8ab0e0b..9a4997f549 100644 --- a/util/system/info.cpp +++ b/util/system/info.cpp @@ -19,7 +19,7 @@ #endif #if defined(_bionic_) -//TODO +// TODO #elif defined(_cygwin_) static int getloadavg(double* loadavg, int nelem) { for (int i = 0; i < nelem; ++i) { diff --git a/util/system/mem_info.cpp b/util/system/mem_info.cpp index 90ed353a59..75f2c1c493 100644 --- a/util/system/mem_info.cpp +++ b/util/system/mem_info.cpp @@ -119,7 +119,7 @@ namespace NMemInfo { result.RSS = FromString<ui64>(statsiter.NextTok(' ')) * pagesize; #if defined(_cygwin_) - //cygwin not very accurate + // cygwin not very accurate result.VMS = Max(result.VMS, result.RSS); #endif #elif defined(_freebsd_) diff --git a/util/system/mlock.h b/util/system/mlock.h index 41a9e4457e..7fe36095f9 100644 --- a/util/system/mlock.h +++ b/util/system/mlock.h @@ -4,11 +4,11 @@ #include <util/generic/flags.h> -//on some systems (not win, freebd, linux, but darwin (Mac OS X) -//multiple mlock calls on the same address range -//require the corresponding number of munlock calls to actually unlock the pages +// on some systems (not win, freebd, linux, but darwin (Mac OS X) +// multiple mlock calls on the same address range +// require the corresponding number of munlock calls to actually unlock the pages -//on some systems you must have privilege and resource limit +// on some systems you must have privilege and resource limit void LockMemory(const void* addr, size_t len); void UnlockMemory(const void* addr, size_t len); diff --git a/util/system/mutex.h b/util/system/mutex.h index 2899ed9a50..39d245b09c 100644 --- a/util/system/mutex.h +++ b/util/system/mutex.h @@ -55,7 +55,7 @@ public: Release(); } - //return opaque pointer to real handler + // return opaque pointer to real handler void* Handle() const noexcept; private: diff --git a/util/system/pipe.h b/util/system/pipe.h index 75d0360049..1bf8f9082a 100644 --- a/util/system/pipe.h +++ b/util/system/pipe.h @@ -2,7 +2,7 @@ #ifdef __GNUC__ #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Warray-bounds" //need because of bug in gcc4.9.2 + #pragma GCC diagnostic ignored "-Warray-bounds" // need because of bug in gcc4.9.2 #endif #include "defaults.h" diff --git a/util/system/rwlock.cpp b/util/system/rwlock.cpp index d4664d72d6..9faff9df5f 100644 --- a/util/system/rwlock.cpp +++ b/util/system/rwlock.cpp @@ -11,7 +11,7 @@ #include "mutex.h" #include "condvar.h" -//darwin rwlocks not recursive +// darwin rwlocks not recursive class TRWMutex::TImpl { public: TImpl(); diff --git a/util/system/sem.cpp b/util/system/sem.cpp index 1825ac3093..96affec792 100644 --- a/util/system/sem.cpp +++ b/util/system/sem.cpp @@ -16,7 +16,7 @@ #if defined(_bionic_) || defined(_darwin_) && defined(_arm_) #include <fcntl.h> #else - #define USE_SYSV_SEMAPHORES //unixoids declared the standard but not implemented it... + #define USE_SYSV_SEMAPHORES // unixoids declared the standard but not implemented it... #endif #endif @@ -83,7 +83,7 @@ namespace { Handle = ::CreateSemaphore(0, max_free_count, max_free_count, key); #else #ifdef USE_SYSV_SEMAPHORES - key_t key = TPCGMixer::Mix(CityHash64(name, strlen(name))); //32 bit hash + key_t key = TPCGMixer::Mix(CityHash64(name, strlen(name))); // 32 bit hash Handle = semget(key, 0, 0); // try to open exist semaphore if (Handle == -1) { // create new semaphore Handle = semget(key, 1, 0666 | IPC_CREAT); @@ -110,8 +110,8 @@ namespace { #else #ifdef USE_SYSV_SEMAPHORES // we DO NOT want 'semctl(Handle, 0, IPC_RMID)' for multiprocess tasks; - //struct sembuf ops[] = {{0, 0, IPC_NOWAIT}}; - //if (semop(Handle, ops, 1) != 0) // close only if semaphore's value is zero + // struct sembuf ops[] = {{0, 0, IPC_NOWAIT}}; + // if (semop(Handle, ops, 1) != 0) // close only if semaphore's value is zero // semctl(Handle, 0, IPC_RMID); #else sem_close(Handle); // we DO NOT want sem_unlink(...) @@ -133,8 +133,8 @@ namespace { #endif } - //The UNIX semaphore object does not support a timed "wait", and - //hence to maintain consistancy, for win32 case we use INFINITE or 0 timeout. + // The UNIX semaphore object does not support a timed "wait", and + // hence to maintain consistancy, for win32 case we use INFINITE or 0 timeout. inline void Acquire() noexcept { #ifdef _win_ Y_ABORT_UNLESS(::WaitForSingleObject(Handle, INFINITE) == WAIT_OBJECT_0, "can not acquire semaphore"); diff --git a/util/system/sem.h b/util/system/sem.h index 0c964ad6b6..e37799d148 100644 --- a/util/system/sem.h +++ b/util/system/sem.h @@ -4,20 +4,20 @@ #include <util/generic/ptr.h> -//named sempahore +// named sempahore class TSemaphore { public: TSemaphore(const char* name, ui32 maxFreeCount); ~TSemaphore(); - //Increase the semaphore counter. + // Increase the semaphore counter. void Release() noexcept; - //Keep a thread held while the semaphore counter is equal 0. + // Keep a thread held while the semaphore counter is equal 0. void Acquire() noexcept; - //Try to enter the semaphore gate. A non-blocking variant of Acquire. - //Returns 'true' if the semaphore counter decreased + // Try to enter the semaphore gate. A non-blocking variant of Acquire. + // Returns 'true' if the semaphore counter decreased bool TryAcquire() noexcept; private: @@ -25,7 +25,7 @@ private: THolder<TImpl> Impl_; }; -//unnamed semaphore, faster, than previous +// unnamed semaphore, faster, than previous class TFastSemaphore { public: TFastSemaphore(ui32 maxFreeCount); diff --git a/util/system/shmat.cpp b/util/system/shmat.cpp index f10a1268e7..13fd4c236c 100644 --- a/util/system/shmat.cpp +++ b/util/system/shmat.cpp @@ -102,7 +102,7 @@ static void FormatName(char* buf, const TGUID& id) { } bool TSharedMemory::Open(const TGUID& id, int size) { - //Y_ASSERT(Data == 0); + // Y_ASSERT(Data == 0); Id = id; Size = size; @@ -117,7 +117,7 @@ bool TSharedMemory::Open(const TGUID& id, int size) { Data = MapViewOfFile(Handle, FILE_MAP_ALL_ACCESS, 0, 0, size); if (Data == 0) { - //Y_ASSERT(0); + // Y_ASSERT(0); CloseHandle(Handle); Handle = INVALID_OS_HANDLE; @@ -128,7 +128,7 @@ bool TSharedMemory::Open(const TGUID& id, int size) { } bool TSharedMemory::Create(int size) { - //Y_ASSERT(Data == 0); + // Y_ASSERT(Data == 0); Size = size; CreateGuid(&Id); @@ -138,14 +138,14 @@ bool TSharedMemory::Create(int size) { Handle = CreateFileMappingA(INVALID_OS_HANDLE, nullptr, PAGE_READWRITE, 0, size, name); if (Handle == 0) { - //Y_ASSERT(0); + // Y_ASSERT(0); return false; } Data = MapViewOfFile(Handle, FILE_MAP_ALL_ACCESS, 0, 0, size); if (Data == 0) { - //Y_ASSERT(0); + // Y_ASSERT(0); CloseHandle(Handle); Handle = INVALID_OS_HANDLE; @@ -172,7 +172,7 @@ static key_t GetKey(const TGUID& id) { bool TSharedMemory::Open(const TGUID& id, int size) { Y_ABORT_UNLESS(id, "invalid shared memory guid: %s", GetGuidAsString(id).data()); - //Y_ASSERT(Data == 0); + // Y_ASSERT(Data == 0); Size = size; key_t k = GetKey(id); @@ -185,7 +185,7 @@ bool TSharedMemory::Open(const TGUID& id, int size) { Data = shmat(shmId, nullptr, 0); if (Data == nullptr) { - //Y_ASSERT(0); + // Y_ASSERT(0); return false; } @@ -193,7 +193,7 @@ bool TSharedMemory::Open(const TGUID& id, int size) { } bool TSharedMemory::Create(int size) { - //Y_ASSERT(Data == 0); + // Y_ASSERT(Data == 0); Size = size; CreateGuid(&Id); @@ -202,14 +202,14 @@ bool TSharedMemory::Create(int size) { Handle = shmget(k, Size, IPC_CREAT | IPC_EXCL | 0777); if (Handle < 0) { - //Y_ASSERT(0); + // Y_ASSERT(0); return false; } Data = shmat(Handle, nullptr, 0); if (Data == (void*)-1) { - //Y_ASSERT(0); + // Y_ASSERT(0); shmctl(Handle, IPC_RMID, nullptr); Handle = -1; diff --git a/util/system/spin_wait.cpp b/util/system/spin_wait.cpp index ba12529111..fed173f307 100644 --- a/util/system/spin_wait.cpp +++ b/util/system/spin_wait.cpp @@ -16,7 +16,7 @@ namespace { return (t * 4 + (rndNum % t) * 2) / 5; } - //arbitrary values + // arbitrary values constexpr unsigned MIN_SLEEP_TIME = 500; constexpr unsigned MAX_SPIN_COUNT = 0x7FF; } diff --git a/util/system/thread.cpp b/util/system/thread.cpp index 8b0d988d23..a845fd4236 100644 --- a/util/system/thread.cpp +++ b/util/system/thread.cpp @@ -135,7 +135,7 @@ namespace { { TParamsRef p((TMyParams*)(ptr)); - //drop counter, gotten in Start() + // drop counter, gotten in Start() p->UnRef(); SetThrName(*p); @@ -146,7 +146,7 @@ namespace { } inline void Start() { - //do not do this, kids, at home + // do not do this, kids, at home P_->Ref(); #if _WIN32_WINNT < 0x0502 Handle = reinterpret_cast<HANDLE>(::_beginthreadex(nullptr, (unsigned)StackSize(*P_), Proxy, (void*)P_.Get(), 0, &ThreadId)); @@ -170,7 +170,7 @@ namespace { using TThreadBase = TWinThread; #else - //unix + // unix #define PCHECK(x, y) \ { \ diff --git a/util/system/tls.cpp b/util/system/tls.cpp index 40d748274e..5979576a4a 100644 --- a/util/system/tls.cpp +++ b/util/system/tls.cpp @@ -126,7 +126,7 @@ namespace { } inline ~TMasterTls() override { - //explicitly call dtor for main thread + // explicitly call dtor for main thread Dtor(pthread_getspecific(Key_)); Y_ABORT_UNLESS(!pthread_key_delete(Key_), "pthread_key_delete failed"); diff --git a/util/system/tls.h b/util/system/tls.h index 3c4f56dbeb..1771663e88 100644 --- a/util/system/tls.h +++ b/util/system/tls.h @@ -45,9 +45,9 @@ Example: @code - //the field declaration in header + // the field declaration in header Y_THREAD(TBuffer) TmpBuffer; - //...later somewhere in cpp... + // ...later somewhere in cpp... TmpBuffer.Clear(); for (size_t i = 0; i < sz && TrieCursor[i].second.IsFork(); ++i) { TmpBuffer.Append(TrieCursor[i].second.Char); @@ -56,9 +56,9 @@ Example: @code - //the field decalrataion in header + // the field decalrataion in header Y_THREAD(TMyWriter*) ThreadLocalWriter; - //...later somewhere in cpp... + // ...later somewhere in cpp... TMyWriter*& writerRef = ThreadLocalWriter.Get(); if (writerRef == nullptr) { THolder<TMyWriter> threadLocalWriter( new TMyWriter( @@ -74,11 +74,11 @@ Example: @code - //in header + // in header namespace TMorph { Y_THREAD(ELanguage) ThreadLocalMainLanguage; } - //in cpp + // in cpp Y_THREAD(ELanguage) TMorph::ThreadLocalMainLanguage(LANG_RUS); @endcode @@ -192,7 +192,7 @@ namespace NTls { ~TDefaultConstructor() override = default; T* Construct(void* ptr) const override { - //memset(ptr, 0, sizeof(T)); + // memset(ptr, 0, sizeof(T)); return ::new (ptr) T(); } }; diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp index a0d11e49fd..77bb7b72cb 100644 --- a/util/thread/pool.cpp +++ b/util/thread/pool.cpp @@ -310,7 +310,7 @@ private: public: inline TAtforkQueueRestarter() { #if defined(_bionic_) -//no pthread_atfork on android libc +// no pthread_atfork on android libc #elif defined(_unix_) pthread_atfork(nullptr, nullptr, ProcessChildAction); #endif diff --git a/util/ysafeptr.h b/util/ysafeptr.h index c33f66db84..22395ea3e3 100644 --- a/util/ysafeptr.h +++ b/util/ysafeptr.h @@ -7,18 +7,18 @@ #include <util/system/tls.h> //////////////////////////////////////////////////////////////////////////////////////////////////// -// There are different templates of pointers: -// 1. Simple pointers. -// 2. TPtr with refereces. -// 3. TObj/TMObj with ownership. After destruction of a TObj the object it referenced to is -// cleaned up and marked as non valid. Similarly does TMobj organizing the parallel ownership -// of an object. +// There are different templates of pointers: +// 1. Simple pointers. +// 2. TPtr with refereces. +// 3. TObj/TMObj with ownership. After destruction of a TObj the object it referenced to is +// cleaned up and marked as non valid. Similarly does TMobj organizing the parallel ownership +// of an object. // -// Limitations: -// 1. It may be necessary to use BASIC_REGISTER_CLASS() in .cpp files to be able to use a -// pointer to a forward declared class. -// 2. It's prohibited to override the 'new' operator, since the standard 'delete' will be used -// for destruction of objects (because of 'delete this'). +// Limitations: +// 1. It may be necessary to use BASIC_REGISTER_CLASS() in .cpp files to be able to use a +// pointer to a forward declared class. +// 2. It's prohibited to override the 'new' operator, since the standard 'delete' will be used +// for destruction of objects (because of 'delete this'). //////////////////////////////////////////////////////////////////////////////////////////////////// #if defined(_MSC_VER) && defined(_DEBUG) diff --git a/util/ysaveload.h b/util/ysaveload.h index 155720bdf5..6035390346 100644 --- a/util/ysaveload.h +++ b/util/ysaveload.h @@ -140,7 +140,7 @@ struct TSerializerMethodSelector; template <class T> struct TSerializerMethodSelector<T, std::enable_if_t<NHasSaveLoad::THasSaveLoad<T>::value>> { static inline void Save(IOutputStream* out, const T& t) { - //assume Save clause do not change t + // assume Save clause do not change t (const_cast<T&>(t)).SaveLoad(out); } diff --git a/util/ysaveload_ut.cpp b/util/ysaveload_ut.cpp index 38f1e3bde5..078478ee41 100644 --- a/util/ysaveload_ut.cpp +++ b/util/ysaveload_ut.cpp @@ -114,7 +114,7 @@ private: inline void TestSaveLoad() { TBufferStream S_; - //save part + // save part { Save(&S_, (ui8)1); Save(&S_, (ui16)2); @@ -224,7 +224,7 @@ private: Save(&S_, mm); } - //load part + // load part { ui8 val; @@ -463,7 +463,7 @@ private: TestOptionalImpl(std::optional<ui64>(std::nullopt)); } - // tests serialization of class with three public string members + // tests serialization of class with three public string members template <class TDerived, class TInterface = TDerived> void TestInheritClassImpl() { TBufferStream s; |