MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / LocalAddressToString

Function LocalAddressToString

src/net/ToString.cxx:30–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28#ifdef HAVE_UN
29
30static std::string
31LocalAddressToString(std::string_view raw) noexcept
32{
33 if (raw.empty())
34 return "local";
35
36 if (raw.front() != '\0' && raw.back() == '\0')
37 /* don't convert the null terminator of a non-abstract socket
38 to a '@' */
39 raw.remove_suffix(1);
40
41 std::string result{raw};
42
43 /* replace all null bytes with '@'; this also handles abstract
44 addresses (Linux specific) */
45 std::replace(result.begin(), result.end(), '\0', '@');
46
47 return result;
48}
49
50#endif
51

Callers 2

ToStringFunction · 0.85
HostToStringFunction · 0.85

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected