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

Method GetDataString

src/engine/shared/datafile.cpp:730–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

728}
729
730const char *CDataFileReader::GetDataString(int Index)
731{
732 dbg_assert(m_pDataFile != nullptr, "File not open");
733
734 if(Index == -1)
735 {
736 return "";
737 }
738
739 const int DataSize = GetDataSize(Index);
740 if(!DataSize)
741 {
742 return nullptr;
743 }
744
745 const char *pData = static_cast<const char *>(GetData(Index));
746 if(pData == nullptr || mem_has_null(pData, DataSize - 1) || pData[DataSize - 1] != '\0' || !str_utf8_check(pData))
747 {
748 return nullptr;
749 }
750 return pData;
751}
752
753void CDataFileReader::ReplaceData(int Index, char *pData, size_t Size)
754{

Callers

nothing calls this directly

Calls 2

mem_has_nullFunction · 0.85
str_utf8_checkFunction · 0.85

Tested by

no test coverage detected