MCPcopy Create free account
hub / github.com/ddnet/ddnet / GetString

Method GetString

src/engine/shared/packer.cpp:168–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168const char *CUnpacker::GetString(int SanitizeType)
169{
170 if(m_Error)
171 return "";
172
173 if(m_pCurrent >= m_pEnd)
174 {
175 m_Error = true;
176 return "";
177 }
178
179 char *pPtr = (char *)m_pCurrent;
180 while(*m_pCurrent) // skip the string
181 {
182 m_pCurrent++;
183 if(m_pCurrent == m_pEnd)
184 {
185 m_Error = true;
186 return "";
187 }
188 }
189 m_pCurrent++;
190
191 if(!str_utf8_check(pPtr))
192 {
193 m_Error = true;
194 return "";
195 }
196
197 // sanitize all strings
198 if(SanitizeType & SANITIZE)
199 str_sanitize(pPtr);
200 else if(SanitizeType & SANITIZE_CC)
201 str_sanitize_cc(pPtr);
202 return SanitizeType & SKIP_START_WHITESPACES ? str_utf8_skip_whitespaces(pPtr) : pPtr;
203}
204
205const unsigned char *CUnpacker::GetRaw(int Size)
206{

Callers 15

ProcessServerInfoMethod · 0.45
ProcessServerPacketMethod · 0.45
Con_ConnectMethod · 0.45
Con_StartVideoMethod · 0.45
Con_RconMethod · 0.45
Con_RconAuthMethod · 0.45
Con_RconLoginMethod · 0.45
Con_AddFavoriteMethod · 0.45
Con_RemoveFavoriteMethod · 0.45
Con_SaveReplayMethod · 0.45
Con_PlayMethod · 0.45
Con_RecordMethod · 0.45

Calls 4

str_utf8_checkFunction · 0.85
str_sanitizeFunction · 0.85
str_sanitize_ccFunction · 0.85

Tested by

no test coverage detected