Deal with a couple of warnings from MSVC
authorChristopher Dykes <cdykes@fb.com>
Sat, 4 Jun 2016 00:43:13 +0000 (17:43 -0700)
committerFacebook Github Bot 4 <facebook-github-bot-4-bot@fb.com>
Sat, 4 Jun 2016 00:53:50 +0000 (17:53 -0700)
Summary: MSVC is warning that `client` may be uninitialized, which is possible if the callback doesn't actually set them for some reason. Solve that by explicitly initializing it to `nullptr`. Also deal with the warning about the initialization of `dynamic::array` using braced syntax by not using that syntax.

Reviewed By: yfeldblum

Differential Revision: D3387782

fbshipit-source-id: e4d25ad32e99a73d7d062be9a2f2b5bde5d17396

folly/experimental/bser/Load.cpp
folly/io/async/SSLContext.cpp

index 2bd473b3354ec4cbad6ce1ec49535da47c4c6c92..3f82dabb114035af52fcbca8e973eca18b2dd04c 100644 (file)
@@ -79,7 +79,7 @@ static std::string decodeString(Cursor& curs) {
 }
 
 static dynamic decodeArray(Cursor& curs) {
-  dynamic arr{};
+  dynamic arr = dynamic::array();
   auto size = decodeInt(curs);
   while (size-- > 0) {
     arr.push_back(parseBser(curs));
index f0862263b842176dfe48541878b7e6576fa56204..8854b9be550f103019b7e9342296fb503978e801 100644 (file)
@@ -591,8 +591,8 @@ int SSLContext::selectNextProtocolCallback(SSL* ssl,
             << "client should be deterministic in selecting protocols.";
   }
 
-  unsigned char *client;
-  unsigned int client_len;
+  unsigned char* client = nullptr;
+  unsigned int client_len = 0;
   bool filtered = false;
   auto cpf = ctx->getClientProtocolFilterCallback();
   if (cpf) {