update SocketAddress::setFromPath() to take a StringPiece
authorAdam Simpkins <simpkins@fb.com>
Fri, 1 Apr 2016 18:35:38 +0000 (11:35 -0700)
committerFacebook Github Bot 6 <facebook-github-bot-6-bot@fb.com>
Fri, 1 Apr 2016 18:50:22 +0000 (11:50 -0700)
commit4e995b4d28266a824eec20457a927bc14afb77d1
treee98890de69f7d4c8f79c40c61e7c9070d1a0f864
parent98d33bb572ed225c13b104673ccbc149d7680fcf
update SocketAddress::setFromPath() to take a StringPiece

Summary:Update setFromPath() to accept a StringPiece rather than just std::string
or a plain const char*.

Also fix two other minor issues:
- Leave the old address untouched on failure.  Previously it could leave the
  SocketAddress in a partially updated state.
- Don't assume the input is nul terminated.  Previously the input code read
  one past the specified input length, and copied this into the address,
  assuming it was a nul terminator.  The new code explicitly writes a 0 byte.

Reviewed By: yfeldblum

Differential Revision: D3119882

fb-gh-sync-id: 3e2258f42034b4f470ade0a23ea085e132a3dd0f
fbshipit-source-id: 3e2258f42034b4f470ade0a23ea085e132a3dd0f
folly/SocketAddress.cpp
folly/SocketAddress.h