Start compiling a bit of `-Wshadow`
[folly.git] / folly / SocketAddress.h
index 8f93953ad9a61d41d92d612d1130a0d17a134f6b..12d8cae7ffb7be85232cec0758042b29a4dbc5fb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2016 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
 
 #include <folly/IPAddress.h>
 #include <folly/Portability.h>
+#include <folly/Range.h>
 
 namespace folly {
 
@@ -278,16 +279,12 @@ class SocketAddress {
    *
    * Raises std::invalid_argument on error.
    */
-  void setFromPath(const char* path) {
-    setFromPath(path, strlen(path));
-  }
+  void setFromPath(StringPiece path);
 
-  void setFromPath(const std::string& path) {
-    setFromPath(path.data(), path.length());
+  void setFromPath(const char* path, size_t length) {
+    setFromPath(StringPiece{path, length});
   }
 
-  void setFromPath(const char* path, size_t length);
-
   // a typedef that allow us to compile against both winsock & POSIX sockets:
   using SocketDesc = decltype(socket(0,0,0)); // POSIX: int, winsock: unsigned
 
@@ -306,7 +303,7 @@ class SocketAddress {
   void setFromLocalAddress(SocketDesc socket);
 
   /**
-   * Initialize this TSocketAddress from a struct sockaddr.
+   * Initialize this folly::SocketAddress from a struct sockaddr.
    *
    * Raises std::system_error on error.
    *