MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / readString

Method readString

src/openrct2/network/NetworkPacket.cpp:90–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88 }
89
90 std::string_view Packet::readString()
91 {
92 if (bytesRead >= data.size())
93 return {};
94
95 const char* str = reinterpret_cast<const char*>(data.data() + bytesRead);
96
97 size_t stringLen = 0;
98 while (bytesRead < data.size() && str[stringLen] != '\0')
99 {
100 bytesRead++;
101 stringLen++;
102 }
103
104 if (str[stringLen] != '\0')
105 return {};
106
107 // Skip null terminator.
108 bytesRead++;
109
110 return std::string_view(str, stringLen);
111 }
112} // namespace OpenRCT2::Network
113
114#endif

Callers 12

Client_Handle_AUTHMethod · 0.45
ServerHandleAuthMethod · 0.45
Client_Handle_CHATMethod · 0.45
ServerHandleChatMethod · 0.45
Client_Handle_TICKMethod · 0.45
Client_Handle_EVENTMethod · 0.45
readMethod · 0.45
readMethod · 0.45

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected