From 5899b4ed30afe2355024ba08ca316545928272d6 Mon Sep 17 00:00:00 2001 From: Sean Cannella Date: Thu, 21 Aug 2014 14:26:49 -0700 Subject: [PATCH] Fix various compiler warnings Summary: This allows projects that use -Wextra (sans -Wunused-parameter) to compile folly. Test Plan: compiled with gcc and clang Reviewed By: meyering@fb.com Subscribers: njormrod, kmdent, fma, benyluo, shikong, ranjeeth, subodh, pgriess FB internal diff: D1509827 --- folly/String-inl.h | 6 +++--- folly/detail/ThreadLocalDetail.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/folly/String-inl.h b/folly/String-inl.h index 65870582..28aead22 100644 --- a/folly/String-inl.h +++ b/folly/String-inl.h @@ -322,7 +322,7 @@ void internalSplit(DelimT delim, StringPiece sp, OutputIterator out, int tokenStartPos = 0; int tokenSize = 0; - for (int i = 0; i <= strSize - dSize; ++i) { + for (size_t i = 0; i <= strSize - dSize; ++i) { if (atDelim(&s[i], delim)) { if (!ignoreEmpty || tokenSize > 0) { *out++ = conv(StringPiece(&s[tokenStartPos], tokenSize)); @@ -617,7 +617,7 @@ bool hexlify(const InputString& input, OutputString& output, static char hexValues[] = "0123456789abcdef"; int j = output.size(); output.resize(2 * input.size() + output.size()); - for (int i = 0; i < input.size(); ++i) { + for (size_t i = 0; i < input.size(); ++i) { int ch = input[i]; output[j++] = hexValues[(ch >> 4) & 0xf]; output[j++] = hexValues[ch & 0xf]; @@ -639,7 +639,7 @@ bool unhexlify(const InputString& input, OutputString& output) { -1; }; - for (int i = 0; i < input.size(); i += 2) { + for (size_t i = 0; i < input.size(); i += 2) { int highBits = unhex(input[i]); int lowBits = unhex(input[i + 1]); if (highBits < 0 || lowBits < 0) { diff --git a/folly/detail/ThreadLocalDetail.h b/folly/detail/ThreadLocalDetail.h index b1a380e7..29dda6ce 100644 --- a/folly/detail/ThreadLocalDetail.h +++ b/folly/detail/ThreadLocalDetail.h @@ -428,7 +428,8 @@ struct StaticMeta { #if !__APPLE__ template -FOLLY_TLS ThreadEntry StaticMeta::threadEntry_ = {0}; +FOLLY_TLS ThreadEntry StaticMeta::threadEntry_{nullptr, 0, + nullptr, nullptr}; #endif template StaticMeta* StaticMeta::inst_ = nullptr; -- 2.34.1