aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortejblum <tejblum@yandex-team.ru>2022-02-10 16:48:02 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:02 +0300
commit6ab7e5f5ada0643a48d393717f443bd548706ffc (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13
parent2bf39531b4f50b889e946ac4866018678a4fb281 (diff)
downloadydb-6ab7e5f5ada0643a48d393717f443bd548706ffc.tar.gz
Restoring authorship annotation for <tejblum@yandex-team.ru>. Commit 2 of 2.
-rw-r--r--contrib/libs/libc_compat/strlcpy.c32
-rw-r--r--library/cpp/cgiparam/cgiparam.cpp2
-rw-r--r--library/cpp/cgiparam/cgiparam.h2
-rw-r--r--library/cpp/charset/codepage.h10
-rw-r--r--library/cpp/charset/cp_encrec.cpp2
-rw-r--r--library/cpp/charset/doccodes.h4
-rw-r--r--library/cpp/charset/recyr.hh2
-rw-r--r--library/cpp/containers/str_map/str_map.h6
-rw-r--r--library/cpp/digest/old_crc/crc.h14
-rw-r--r--library/cpp/mime/types/mime.h2
-rw-r--r--library/cpp/packedtypes/longs.h6
-rw-r--r--library/cpp/string_utils/base64/base64.cpp10
-rw-r--r--library/cpp/string_utils/quote/quote.cpp8
-rw-r--r--util/charset/recode_result.h2
-rw-r--r--util/folder/fts.cpp60
-rw-r--r--util/generic/map.h8
-rw-r--r--util/generic/strbase.h2
-rw-r--r--util/generic/string.cpp4
-rw-r--r--util/generic/string.h12
-rw-r--r--util/network/poller.h6
-rw-r--r--util/network/socket.cpp28
-rw-r--r--util/string/printf_ut.cpp2
-rw-r--r--util/string/strip_ut.cpp6
-rw-r--r--util/string/subst_ut.cpp2
-rw-r--r--util/string/type_ut.cpp2
-rw-r--r--util/string/util_ut.cpp8
-rw-r--r--util/system/condvar.cpp26
-rw-r--r--util/system/condvar.h6
-rw-r--r--util/system/defaults.h16
-rw-r--r--util/system/rwlock.cpp20
-rw-r--r--util/system/rwlock.h18
-rw-r--r--util/system/sem.cpp4
-rw-r--r--util/system/tls.cpp2
-rw-r--r--util/thread/pool.h2
34 files changed, 168 insertions, 168 deletions
diff --git a/contrib/libs/libc_compat/strlcpy.c b/contrib/libs/libc_compat/strlcpy.c
index c881f466cf..1797b86bb6 100644
--- a/contrib/libs/libc_compat/strlcpy.c
+++ b/contrib/libs/libc_compat/strlcpy.c
@@ -1,12 +1,12 @@
/* $OpenBSD: strlcpy.c,v 1.16 2019/01/25 00:19:25 millert Exp $ */
-
-/*
+
+/*
* Copyright (c) 1998, 2015 Todd C. Miller <millert@openbsd.org>
- *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@@ -14,22 +14,22 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
+ */
+
+#include <sys/types.h>
+#include <string.h>
+
+/*
* Copy string src to buffer dst of size dsize. At most dsize-1
* chars will be copied. Always NUL terminates (unless dsize == 0).
* Returns strlen(src); if retval >= dsize, truncation occurred.
- */
+ */
size_t
strlcpy(char *dst, const char *src, size_t dsize)
-{
+{
const char *osrc = src;
size_t nleft = dsize;
-
+
/* Copy as many bytes as will fit. */
if (nleft != 0) {
while (--nleft != 0) {
@@ -37,7 +37,7 @@ strlcpy(char *dst, const char *src, size_t dsize)
break;
}
}
-
+
/* Not enough room in dst, add NUL and traverse rest of src. */
if (nleft == 0) {
if (dsize != 0)
@@ -45,7 +45,7 @@ strlcpy(char *dst, const char *src, size_t dsize)
while (*src++)
;
}
-
+
return(src - osrc - 1); /* count does not include NUL */
-}
+}
diff --git a/library/cpp/cgiparam/cgiparam.cpp b/library/cpp/cgiparam/cgiparam.cpp
index f98ef011aa..f3277b8e4b 100644
--- a/library/cpp/cgiparam/cgiparam.cpp
+++ b/library/cpp/cgiparam/cgiparam.cpp
@@ -91,7 +91,7 @@ static inline TString DoUnescape(const TStringBuf s) {
void TCgiParameters::InsertEscaped(const TStringBuf name, const TStringBuf value) {
InsertUnescaped(DoUnescape(name), DoUnescape(value));
-}
+}
template <bool addAll, class F>
static inline void DoScan(const TStringBuf s, F& f) {
diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h
index e6fa76a3ef..87d1ab0ad4 100644
--- a/library/cpp/cgiparam/cgiparam.h
+++ b/library/cpp/cgiparam/cgiparam.h
@@ -39,7 +39,7 @@ public:
TString operator()() const {
return Print();
}
-
+
void Scan(const TStringBuf cgiParStr, bool form = true);
void ScanAdd(const TStringBuf cgiParStr);
void ScanAddUnescaped(const TStringBuf cgiParStr);
diff --git a/library/cpp/charset/codepage.h b/library/cpp/charset/codepage.h
index 9ad4a290f5..30a02a4610 100644
--- a/library/cpp/charset/codepage.h
+++ b/library/cpp/charset/codepage.h
@@ -1,7 +1,7 @@
#pragma once
-
+
#include "doccodes.h"
-
+
#include <util/charset/recode_result.h>
#include <util/charset/unidata.h> // all wchar32 functions
#include <util/charset/utf8.h>
@@ -91,7 +91,7 @@ struct CodePage {
return SingleByteCodepage() || CPEnum == CODES_UTF8;
}
};
-
+
class TCodePageHash;
namespace NCodepagePrivate {
@@ -193,7 +193,7 @@ ECharset EncodingHintByName(const char* name);
struct Encoder {
char* Table[256];
const char* DefaultChar;
-
+
inline char Code(wchar32 ch) const {
if (ch > 0xFFFF)
return 0;
@@ -222,7 +222,7 @@ struct Encoder {
\*****************************************************************/
struct Recoder {
unsigned char Table[257];
-
+
void Create(const CodePage& source, const CodePage& target);
void Create(const CodePage& source, const Encoder* wideTarget);
diff --git a/library/cpp/charset/cp_encrec.cpp b/library/cpp/charset/cp_encrec.cpp
index 036c92058d..e4570cd628 100644
--- a/library/cpp/charset/cp_encrec.cpp
+++ b/library/cpp/charset/cp_encrec.cpp
@@ -3,7 +3,7 @@
#include <util/stream/output.h>
void Encoder::Tr(const wchar32* in, char* out, size_t len) const {
- while (len--)
+ while (len--)
*out++ = Tr(*in++);
}
diff --git a/library/cpp/charset/doccodes.h b/library/cpp/charset/doccodes.h
index 78d7e101ec..75c87adf9e 100644
--- a/library/cpp/charset/doccodes.h
+++ b/library/cpp/charset/doccodes.h
@@ -1,5 +1,5 @@
#pragma once
-
+
enum ECharset {
CODES_UNSUPPORTED = -2, // valid but unsupported encoding
CODES_UNKNOWN = -1, // invalid or unspecified encoding
@@ -126,4 +126,4 @@ enum ECharset {
CODES_SHIFT_JIS,
CODES_MAX
-};
+};
diff --git a/library/cpp/charset/recyr.hh b/library/cpp/charset/recyr.hh
index fdfeabde3b..5ec8734bcf 100644
--- a/library/cpp/charset/recyr.hh
+++ b/library/cpp/charset/recyr.hh
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <cstdlib>
#include <util/charset/recode_result.h>
diff --git a/library/cpp/containers/str_map/str_map.h b/library/cpp/containers/str_map/str_map.h
index 38fd2d7da5..31b00d1b99 100644
--- a/library/cpp/containers/str_map/str_map.h
+++ b/library/cpp/containers/str_map/str_map.h
@@ -60,7 +60,7 @@ public:
}
void clear_hash() {
- yh::clear();
+ yh::clear();
pool.Clear();
}
pool_size_type pool_size() const {
@@ -93,8 +93,8 @@ public:
}
mapped_type& operator[](const char* key) {
- iterator I = yh::find(key);
- if (I == yh::end())
+ iterator I = yh::find(key);
+ if (I == yh::end())
I = insert_copy(key, mapped_type()).first;
return (*I).second;
}
diff --git a/library/cpp/digest/old_crc/crc.h b/library/cpp/digest/old_crc/crc.h
index 9f341d1d90..4a3ce6d05e 100644
--- a/library/cpp/digest/old_crc/crc.h
+++ b/library/cpp/digest/old_crc/crc.h
@@ -23,17 +23,17 @@ struct IdTR {
Y_FORCE_INLINE static ui8 T(ui8 a) {
return a;
}
-};
-
+};
+
// CCITT CRC-32
-template <class TR>
+template <class TR>
inline ui32 crc32(const char* buf, size_t buflen, ui32 crcinit = CRC32INIT) {
ui32 crc = crcinit ^ 0xFFFFFFFF;
const char* end = buf + buflen;
extern const ui32* crctab32;
while (buf < end) {
- crc = (crc >> 8) ^ crctab32[(crc ^ TR::T((ui8)*buf)) & 0xFF];
+ crc = (crc >> 8) ^ crctab32[(crc ^ TR::T((ui8)*buf)) & 0xFF];
++buf;
}
@@ -41,9 +41,9 @@ inline ui32 crc32(const char* buf, size_t buflen, ui32 crcinit = CRC32INIT) {
}
inline ui32 crc32(const char* buf, size_t buflen, ui32 crcinit = CRC32INIT) {
- return crc32<IdTR>(buf, buflen, crcinit);
-}
-
+ return crc32<IdTR>(buf, buflen, crcinit);
+}
+
inline ui32 crc32(const void* buf, size_t buflen, ui32 crcinit = CRC32INIT) {
return crc32((const char*)buf, buflen, crcinit);
}
diff --git a/library/cpp/mime/types/mime.h b/library/cpp/mime/types/mime.h
index 28ea41a34b..05da389ea9 100644
--- a/library/cpp/mime/types/mime.h
+++ b/library/cpp/mime/types/mime.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <util/system/defaults.h>
#include <util/generic/strbuf.h>
diff --git a/library/cpp/packedtypes/longs.h b/library/cpp/packedtypes/longs.h
index 1ae5423903..084098d705 100644
--- a/library/cpp/packedtypes/longs.h
+++ b/library/cpp/packedtypes/longs.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <util/system/defaults.h> // _BIDSCLASS _EXPCLASS
#include <util/system/yassert.h>
#include <util/system/unaligned_mem.h>
@@ -13,8 +13,8 @@
#elif defined(_little_endian_)
#define LO_SHIFT 0
#define HI_SHIFT 1
-#endif
-
+#endif
+
#if !defined(_must_align2_)
#define PUT_16(x, buf, shift) WriteUnaligned<ui16>(buf, (x) >> (shift)), (buf) += 2
#define GET_16_OR(x, buf, type, shift) (x) |= (type)ReadUnaligned<ui16>(buf) << (shift), (buf) += 2
diff --git a/library/cpp/string_utils/base64/base64.cpp b/library/cpp/string_utils/base64/base64.cpp
index 885933dfb7..05c201f0de 100644
--- a/library/cpp/string_utils/base64/base64.cpp
+++ b/library/cpp/string_utils/base64/base64.cpp
@@ -164,15 +164,15 @@ static size_t Base64DecodePlain(void* dst, const char* b, const char* e) {
n += 3;
}
- if (n > 0) {
+ if (n > 0) {
if (b[-1] == ',' || b[-1] == '=') {
- n--;
+ n--;
if (b[-2] == ',' || b[-2] == '=') {
- n--;
+ n--;
}
- }
- }
+ }
+ }
return n;
}
diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp
index 46f757a4b3..e523350b80 100644
--- a/library/cpp/string_utils/quote/quote.cpp
+++ b/library/cpp/string_utils/quote/quote.cpp
@@ -6,14 +6,14 @@
#include <cctype>
-/* note: (x & 0xdf) makes x upper case */
+/* note: (x & 0xdf) makes x upper case */
#define GETXC \
do { \
c *= 16; \
c += (x[0] >= 'A' ? ((x[0] & 0xdf) - 'A') + 10 : (x[0] - '0')); \
++x; \
} while (0)
-
+
#define GETSBXC \
do { \
c *= 16; \
@@ -62,8 +62,8 @@ namespace {
private:
const char* End;
};
-}
-
+}
+
static inline char d2x(unsigned x) {
return (char)((x < 10) ? ('0' + x) : ('A' + x - 10));
}
diff --git a/util/charset/recode_result.h b/util/charset/recode_result.h
index 54df7c02d0..2c7366e7b2 100644
--- a/util/charset/recode_result.h
+++ b/util/charset/recode_result.h
@@ -1,5 +1,5 @@
#pragma once
-
+
enum RECODE_RESULT {
RECODE_OK,
RECODE_EOINPUT,
diff --git a/util/folder/fts.cpp b/util/folder/fts.cpp
index 2acc43b4a8..0e6a6f86eb 100644
--- a/util/folder/fts.cpp
+++ b/util/folder/fts.cpp
@@ -29,8 +29,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $
+ *
+ * $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $
*/
#include <util/memory/tempbuf.h>
@@ -271,7 +271,7 @@ FTS* yfts_open(char* const* argv, int options, int (*compar)(const FTSENT**, con
/* Shush, GCC. */
tmp = nullptr;
-
+
/* Logical walks turn on NOCHDIR; symbolic links are too hard. */
if (ISSET(FTS_LOGICAL)) {
SET(FTS_NOCHDIR);
@@ -450,8 +450,8 @@ int yfts_close(FTS* sp)
}
/*
- * Special case of "/" at the end of the path so that slashes aren't
- * appended which would cause paths to be written as "....//foo".
+ * Special case of "/" at the end of the path so that slashes aren't
+ * appended which would cause paths to be written as "....//foo".
*/
#define NAPPEND(p) \
(p->fts_path[p->fts_pathlen - 1] == LOCSLASH_C \
@@ -803,14 +803,14 @@ fts_build(FTS* sp, int type)
* Open the directory for reading. If this fails, we're done.
* If being called from yfts_read, set the fts_info field.
*/
-#ifdef FTS_WHITEOUT
+#ifdef FTS_WHITEOUT
if (ISSET(FTS_WHITEOUT))
oflag = DTF_NODUP | DTF_REWIND;
else
oflag = DTF_HIDEW | DTF_NODUP | DTF_REWIND;
-#else
+#else
#define __opendir2(path, flag) opendir(path)
-#endif
+#endif
if ((dirp = __opendir2(cur->fts_accpath, oflag)) == nullptr) {
if (type == BREAD) {
cur->fts_info = FTS_DNR;
@@ -976,11 +976,11 @@ fts_build(FTS* sp, int type)
p->fts_parent = sp->fts_cur;
p->fts_pathlen = u_short(len + strlen(dp->d_name));
-#ifdef FTS_WHITEOUT
+#ifdef FTS_WHITEOUT
if (dp->d_type == DT_WHT)
p->fts_flags |= FTS_ISW;
-#endif
-
+#endif
+
#ifdef _DIRENT_HAVE_D_TYPE
if (dp->d_type == DT_DIR) {
p->fts_type = FTS_D;
@@ -1105,7 +1105,7 @@ fts_stat(FTS* sp, FTSENT* p, int follow)
/* If user needs stat info, stat buffer already allocated. */
sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
-#ifdef FTS_WHITEOUT
+#ifdef FTS_WHITEOUT
/* check for whiteout */
if (p->fts_flags & FTS_ISW) {
if (sbp != &sb) {
@@ -1114,8 +1114,8 @@ fts_stat(FTS* sp, FTSENT* p, int follow)
}
return (FTS_W);
}
-#endif
-
+#endif
+
/*
* If doing a logical walk, or application requested FTS_FOLLOW, do
* a stat(2). If that fails, check for a non-existent symlink. If
@@ -1199,7 +1199,7 @@ fts_sort(FTS* sp, FTSENT* head, int nitems)
*/
if (nitems > sp->fts_nitems) {
struct _ftsent** a;
-
+
sp->fts_nitems = nitems + 40;
if ((a = (struct _ftsent**)realloc(sp->fts_array,
sp->fts_nitems * sizeof(FTSENT*))) == nullptr) {
@@ -1289,9 +1289,9 @@ fts_palloc(FTS* sp, size_t more)
return (sp->fts_path == nullptr);
}
-static void
+static void
ADJUST(FTSENT* p, void* addr)
-{
+{
if ((p)->fts_accpath >= (p)->fts_path &&
(p)->fts_accpath < (p)->fts_path + (p)->fts_pathlen) {
if (p->fts_accpath != p->fts_path) {
@@ -1305,8 +1305,8 @@ ADJUST(FTSENT* p, void* addr)
(char*)addr + ((p)->fts_accpath - (p)->fts_path);
}
(p)->fts_path = (char*)addr;
-}
-
+}
+
/*
* When the path is realloc'd, have to fix all of the pointers in structures
* already returned.
@@ -1347,20 +1347,20 @@ fts_maxarglen(char* const* argv)
}
return (max + 1);
}
-
-/*
- * Change to dir specified by fd or p->fts_accpath without getting
- * tricked by someone changing the world out from underneath us.
- * Assumes p->fts_dev and p->fts_ino are filled in.
- */
+
+/*
+ * Change to dir specified by fd or p->fts_accpath without getting
+ * tricked by someone changing the world out from underneath us.
+ * Assumes p->fts_dev and p->fts_ino are filled in.
+ */
#ifndef _win_
-static int
+static int
fts_safe_changedir(FTS* sp, FTSENT* p, int fd, const char* path)
-{
+{
int ret, oerrno, newfd;
stat_struct sb;
-
+
newfd = fd;
if (ISSET(FTS_NOCHDIR)) {
return (0);
@@ -1378,14 +1378,14 @@ fts_safe_changedir(FTS* sp, FTSENT* p, int fd, const char* path)
goto bail;
}
ret = fchdir(newfd);
-bail:
+bail:
oerrno = errno;
if (fd < 0) {
(void)close(newfd);
}
errno = oerrno;
return (ret);
-}
+}
#else
static int
fts_safe_changedir(FTS* sp, FTSENT* p, int /*fd*/, const char* path)
diff --git a/util/generic/map.h b/util/generic/map.h
index cac7358bc8..b5001b56c0 100644
--- a/util/generic/map.h
+++ b/util/generic/map.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include "fwd.h"
#include "mapfindptr.h"
@@ -25,8 +25,8 @@ public:
inline bool contains(const K& key) const {
return this->find(key) != this->end();
}
-};
-
+};
+
template <class K, class V, class Less, class A>
class TMultiMap: public std::multimap<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>> {
using TBase = std::multimap<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>;
@@ -41,4 +41,4 @@ public:
inline bool contains(const K& key) const {
return this->find(key) != this->end();
}
-};
+};
diff --git a/util/generic/strbase.h b/util/generic/strbase.h
index 2db3c246db..ab39fc7537 100644
--- a/util/generic/strbase.h
+++ b/util/generic/strbase.h
@@ -1,5 +1,5 @@
#pragma once
-
+
// Some of these includes are just a legacy from previous implementation.
// We don't need them here, but removing them is tricky because it breaks all
// kinds of builds downstream
diff --git a/util/generic/string.cpp b/util/generic/string.cpp
index 72ffda5ed1..3c655f1f66 100644
--- a/util/generic/string.cpp
+++ b/util/generic/string.cpp
@@ -21,8 +21,8 @@ std::istream& operator>>(std::istream& is, TString& s) {
template <>
bool TBasicString<char, std::char_traits<char>>::to_lower(size_t pos, size_t n) {
return Transform([](size_t, char c) { return AsciiToLower(c); }, pos, n);
-}
-
+}
+
template <>
bool TBasicString<char, std::char_traits<char>>::to_upper(size_t pos, size_t n) {
return Transform([](size_t, char c) { return AsciiToUpper(c); }, pos, n);
diff --git a/util/generic/string.h b/util/generic/string.h
index aacf6788de..8cd8aa6917 100644
--- a/util/generic/string.h
+++ b/util/generic/string.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <cstddef>
#include <cstring>
#include <stlfwd>
@@ -370,7 +370,7 @@ public:
return *this;
}
-
+
// ~~~ Constructor ~~~ : FAMILY0(,TBasicString)
TBasicString() noexcept
#ifndef TSTRING_IS_STD_STRING
@@ -433,7 +433,7 @@ public:
#endif
{
}
-
+
TBasicString(const TCharType* pc)
: TBasicString(pc, TBase::StrLen(pc))
{
@@ -893,7 +893,7 @@ public:
s1 += s2;
return std::move(s1);
}
-
+
friend TBasicString operator+(TBasicString&& s1, TCharType s2) Y_WARN_UNUSED_RESULT {
s1 += s2;
return std::move(s1);
@@ -975,7 +975,7 @@ public:
return *this;
}
-
+
TBasicString& prepend(const TBasicStringBuf<TCharType, TTraits> s, size_t spos = 0, size_t sn = TBase::npos) {
return insert(0, s, spos, sn);
}
@@ -1193,7 +1193,7 @@ public:
std::ostream& operator<<(std::ostream&, const TString&);
std::istream& operator>>(std::istream&, TString&);
-
+
template <typename TCharType, typename TTraits>
TBasicString<TCharType> to_lower(const TBasicString<TCharType, TTraits>& s) {
TBasicString<TCharType> ret(s);
diff --git a/util/network/poller.h b/util/network/poller.h
index 37873e911a..8dccd73140 100644
--- a/util/network/poller.h
+++ b/util/network/poller.h
@@ -1,10 +1,10 @@
#pragma once
-
+
#include "socket.h"
#include <util/generic/ptr.h>
#include <util/datetime/base.h>
-
+
class TSocketPoller {
public:
TSocketPoller();
@@ -55,4 +55,4 @@ public:
private:
class TImpl;
THolder<TImpl> Impl_;
-};
+};
diff --git a/util/network/socket.cpp b/util/network/socket.cpp
index d9266af546..4f6e804346 100644
--- a/util/network/socket.cpp
+++ b/util/network/socket.cpp
@@ -64,16 +64,16 @@ int inet_aton(const char* cp, struct in_addr* inp) {
#if (_WIN32_WINNT < 0x0600)
const char* inet_ntop(int af, const void* src, char* dst, socklen_t size) {
if (af != AF_INET) {
- errno = EINVAL;
- return 0;
- }
- const ui8* ia = (ui8*)src;
- if (snprintf(dst, size, "%u.%u.%u.%u", ia[0], ia[1], ia[2], ia[3]) >= (int)size) {
- errno = ENOSPC;
- return 0;
- }
- return dst;
-}
+ errno = EINVAL;
+ return 0;
+ }
+ const ui8* ia = (ui8*)src;
+ if (snprintf(dst, size, "%u.%u.%u.%u", ia[0], ia[1], ia[2], ia[3]) >= (int)size) {
+ errno = ENOSPC;
+ return 0;
+ }
+ return dst;
+}
struct evpair {
int event;
@@ -242,13 +242,13 @@ int poll(struct pollfd fds[], nfds_t nfds, int timeout) noexcept {
bool GetRemoteAddr(SOCKET Socket, char* str, socklen_t size) {
if (!size) {
- return false;
+ return false;
}
TOpaqueAddr addr;
if (getpeername(Socket, addr.MutableAddr(), addr.LenPtr()) != 0) {
- return false;
+ return false;
}
try {
@@ -263,8 +263,8 @@ bool GetRemoteAddr(SOCKET Socket, char* str, socklen_t size) {
}
return false;
-}
-
+}
+
void SetSocketTimeout(SOCKET s, long timeout) {
SetSocketTimeout(s, timeout, 0);
}
diff --git a/util/string/printf_ut.cpp b/util/string/printf_ut.cpp
index 76eea7023f..2b2f980b70 100644
--- a/util/string/printf_ut.cpp
+++ b/util/string/printf_ut.cpp
@@ -1,7 +1,7 @@
#include "printf.h"
#include <library/cpp/testing/unittest/registar.h>
-
+
Y_UNIT_TEST_SUITE(TStringPrintf) {
Y_UNIT_TEST(TestSprintf) {
TString s;
diff --git a/util/string/strip_ut.cpp b/util/string/strip_ut.cpp
index be8ba0d89c..d1029d1498 100644
--- a/util/string/strip_ut.cpp
+++ b/util/string/strip_ut.cpp
@@ -1,7 +1,7 @@
#include "strip.h"
#include <library/cpp/testing/unittest/registar.h>
-
+
#include <util/charset/wide.h>
Y_UNIT_TEST_SUITE(TStripStringTest) {
@@ -42,7 +42,7 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {
UNIT_ASSERT_EQUAL(StripStringLeft(inputStrBuf), test.StripLeftRes);
UNIT_ASSERT_EQUAL(StripStringRight(inputStrBuf), test.StripRightRes);
};
- }
+ }
Y_UNIT_TEST(TestCustomStrip) {
struct TTest {
@@ -122,7 +122,7 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {
#ifndef TSTRING_IS_STD_STRING
UNIT_ASSERT(s.c_str() == s2.c_str()); // Collapse() does not change the string at all
#endif
- }
+ }
Y_UNIT_TEST(TestCollapseText) {
TString abs1("Very long description string written in unknown language.");
diff --git a/util/string/subst_ut.cpp b/util/string/subst_ut.cpp
index b651dab193..21eccef779 100644
--- a/util/string/subst_ut.cpp
+++ b/util/string/subst_ut.cpp
@@ -3,7 +3,7 @@
#include <string>
#include <library/cpp/testing/unittest/registar.h>
-
+
Y_UNIT_TEST_SUITE(TStringSubst) {
static const size_t MIN_FROM_CTX = 4;
static const TVector<TString> ALL_FROM{TString("F"), TString("FF")};
diff --git a/util/string/type_ut.cpp b/util/string/type_ut.cpp
index 6b310146c9..03e7af62bd 100644
--- a/util/string/type_ut.cpp
+++ b/util/string/type_ut.cpp
@@ -1,7 +1,7 @@
#include "type.h"
#include <library/cpp/testing/unittest/registar.h>
-
+
#include <util/charset/wide.h>
Y_UNIT_TEST_SUITE(TStringClassify) {
diff --git a/util/string/util_ut.cpp b/util/string/util_ut.cpp
index 6a214a2761..18a2d8e195 100644
--- a/util/string/util_ut.cpp
+++ b/util/string/util_ut.cpp
@@ -1,14 +1,14 @@
#include "util.h"
#include <library/cpp/testing/unittest/registar.h>
-
+
class TStrUtilTest: public TTestBase {
UNIT_TEST_SUITE(TStrUtilTest);
UNIT_TEST(TestSpn);
UNIT_TEST(TestRemoveAll);
UNIT_TEST_SUITE_END();
-public:
+public:
void TestSpn() {
str_spn rul("a-z", true);
char s[] = "!@#$ab%^&c+-";
@@ -41,6 +41,6 @@ public:
UNIT_ASSERT_EQUAL(t->Result, str);
}
}
-};
-
+};
+
UNIT_TEST_SUITE_REGISTRATION(TStrUtilTest);
diff --git a/util/system/condvar.cpp b/util/system/condvar.cpp
index 5519bf821a..62f3d22356 100644
--- a/util/system/condvar.cpp
+++ b/util/system/condvar.cpp
@@ -15,8 +15,8 @@
#include <sys/time.h>
#include <pthread.h>
#include <cerrno>
-#endif
-
+#endif
+
namespace {
class TCondVarImpl {
using TLock = TAdaptiveLock;
@@ -85,17 +85,17 @@ public:
ythrow yexception() << "can not create condvar(" << LastSystemErrorText() << ")";
}
}
-
+
inline ~TImpl() {
int ret = pthread_cond_destroy(&Cond_);
Y_VERIFY(ret == 0, "pthread_cond_destroy failed: %s", LastSystemErrorText(ret));
}
-
+
inline void Signal() noexcept {
int ret = pthread_cond_signal(&Cond_);
Y_VERIFY(ret == 0, "pthread_cond_signal failed: %s", LastSystemErrorText(ret));
}
-
+
inline bool WaitD(TMutex& lock, TInstant deadLine) noexcept {
if (deadLine == TInstant::Max()) {
int ret = pthread_cond_wait(&Cond_, (pthread_mutex_t*)lock.Handle());
@@ -116,7 +116,7 @@ public:
return ret == 0;
}
}
-
+
inline void BroadCast() noexcept {
int ret = pthread_cond_broadcast(&Cond_);
Y_VERIFY(ret == 0, "pthread_cond_broadcast failed: %s", LastSystemErrorText(ret));
@@ -126,22 +126,22 @@ private:
pthread_cond_t Cond_;
};
#endif
-
+
TCondVar::TCondVar()
: Impl_(new TImpl)
{
-}
-
+}
+
TCondVar::~TCondVar() = default;
-
+
void TCondVar::BroadCast() noexcept {
Impl_->BroadCast();
}
void TCondVar::Signal() noexcept {
Impl_->Signal();
-}
-
+}
+
bool TCondVar::WaitD(TMutex& mutex, TInstant deadLine) noexcept {
return Impl_->WaitD(mutex, deadLine);
-}
+}
diff --git a/util/system/condvar.h b/util/system/condvar.h
index aae33b2e50..569162717c 100644
--- a/util/system/condvar.h
+++ b/util/system/condvar.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include "mutex.h"
#include <util/generic/ptr.h>
@@ -12,10 +12,10 @@ class TCondVar {
public:
TCondVar();
~TCondVar();
-
+
void BroadCast() noexcept;
void Signal() noexcept;
-
+
/*
* returns false if failed by timeout
*/
diff --git a/util/system/defaults.h b/util/system/defaults.h
index 84c4580b02..dcd7abea38 100644
--- a/util/system/defaults.h
+++ b/util/system/defaults.h
@@ -1,7 +1,7 @@
#pragma once
-
+
#include "platform.h"
-
+
#if defined _unix_
#define LOCSLASH_C '/'
#define LOCSLASH_S "/"
@@ -58,12 +58,12 @@
#if defined(__GNUC__)
#define alias_hack __attribute__((__may_alias__))
-#endif
-
-#ifndef alias_hack
+#endif
+
+#ifndef alias_hack
#define alias_hack
-#endif
-
+#endif
+
#include "types.h"
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
@@ -80,7 +80,7 @@
#elif defined(_sun_)
#include <alloca.h>
#endif
-
+
#ifdef NDEBUG
#define Y_IF_DEBUG(X)
#ifdef __cplusplus
diff --git a/util/system/rwlock.cpp b/util/system/rwlock.cpp
index 66b47e2a7e..bb3dcbf188 100644
--- a/util/system/rwlock.cpp
+++ b/util/system/rwlock.cpp
@@ -1,7 +1,7 @@
-#include "rwlock.h"
+#include "rwlock.h"
#include "mutex.h"
#include "condvar.h"
-
+
#include <util/generic/yexception.h>
#if defined(_unix_)
@@ -39,7 +39,7 @@ TRWMutex::TImpl::TImpl()
, BlockedWriters_(0)
{
}
-
+
TRWMutex::TImpl::~TImpl() {
Y_VERIFY(State_ == 0, "failure, State_ != 0");
Y_VERIFY(BlockedWriters_ == 0, "failure, BlockedWriters_ != 0");
@@ -52,11 +52,11 @@ void TRWMutex::TImpl::AcquireRead() noexcept {
}
++State_;
- }
+ }
ReadCond_.Signal();
}
-
+
bool TRWMutex::TImpl::TryAcquireRead() noexcept {
with_lock (Lock_) {
if (BlockedWriters_ || State_ < 0) {
@@ -128,18 +128,18 @@ void TRWMutex::TImpl::Release() noexcept {
} else if (BlockedWriters_) {
Lock_.Release();
WriteCond_.Signal();
- }
+ }
} else {
State_ = 0;
if (BlockedWriters_) {
Lock_.Release();
WriteCond_.Signal();
- } else {
+ } else {
Lock_.Release();
ReadCond_.Signal();
- }
- }
+ }
+ }
}
#else /* POSIX threads */
@@ -212,7 +212,7 @@ void TRWMutex::TImpl::Release() noexcept {
Y_VERIFY(result == 0, "rwlock unlock failed (%s)", LastSystemErrorText(result));
}
-#endif
+#endif
TRWMutex::TRWMutex()
: Impl_(new TImpl())
diff --git a/util/system/rwlock.h b/util/system/rwlock.h
index c4b28b06a5..0bb9b3fe1c 100644
--- a/util/system/rwlock.h
+++ b/util/system/rwlock.h
@@ -1,25 +1,25 @@
#pragma once
-
+
#include "guard.h"
#include "defaults.h"
-
+
#include <util/generic/ptr.h>
class TRWMutex {
public:
TRWMutex();
~TRWMutex();
-
+
void AcquireRead() noexcept;
bool TryAcquireRead() noexcept;
void ReleaseRead() noexcept;
-
+
void AcquireWrite() noexcept;
bool TryAcquireWrite() noexcept;
void ReleaseWrite() noexcept;
void Release() noexcept;
-
+
private:
class TImpl;
THolder<TImpl> Impl_;
@@ -34,8 +34,8 @@ struct TReadGuardOps {
static inline void Release(T* t) noexcept {
t->ReleaseRead();
}
-};
-
+};
+
template <class T>
struct TTryReadGuardOps: public TReadGuardOps<T> {
static inline bool TryAcquire(T* t) noexcept {
@@ -52,8 +52,8 @@ struct TWriteGuardOps {
static inline void Release(T* t) noexcept {
t->ReleaseWrite();
}
-};
-
+};
+
template <class T>
struct TTryWriteGuardOps: public TWriteGuardOps<T> {
static inline bool TryAcquire(T* t) noexcept {
diff --git a/util/system/sem.cpp b/util/system/sem.cpp
index e291f1423c..4a93b903b5 100644
--- a/util/system/sem.cpp
+++ b/util/system/sem.cpp
@@ -6,8 +6,8 @@
#include <alloca.h>
#endif
-#include <cerrno>
-#include <cstring>
+#include <cerrno>
+#include <cstring>
#ifdef _win_
#include "winint.h"
diff --git a/util/system/tls.cpp b/util/system/tls.cpp
index 5cef5ed235..c2f1a04a14 100644
--- a/util/system/tls.cpp
+++ b/util/system/tls.cpp
@@ -7,7 +7,7 @@
#include <util/generic/intrlist.h>
#include <util/generic/singleton.h>
#include <util/generic/vector.h>
-
+
#if defined(_unix_)
#include <pthread.h>
#endif
diff --git a/util/thread/pool.h b/util/thread/pool.h
index 8a9ad12de6..d1ea3a67cb 100644
--- a/util/thread/pool.h
+++ b/util/thread/pool.h
@@ -381,7 +381,7 @@ inline void Delete(THolder<IThreadPool> q) {
if (q.Get()) {
q->Stop();
}
-}
+}
/**
* Creates and starts TThreadPool if threadsCount > 1, or TFakeThreadPool otherwise