MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SlCalcStdStringLen

Function SlCalcStdStringLen

src/saveload/saveload.cpp:917–923  ·  view source on GitHub ↗

* Calculate the gross length of the string that it * will occupy in the savegame. This includes the real length, returned * by SlCalcNetStringLen and the length that the index will occupy. * @param ptr Pointer to the \c std::string. * @return The gross length of the string. */

Source from the content-addressed store, hash-verified

915 * @return The gross length of the string.
916 */
917static inline size_t SlCalcStdStringLen(const void *ptr)
918{
919 const std::string *str = reinterpret_cast<const std::string *>(ptr);
920
921 size_t len = str->length();
922 return len + SlGetArrayLength(len); // also include the length of the index
923}
924
925
926/**

Callers 2

SlCalcTableHeaderFunction · 0.85
SlCalcObjMemberLengthFunction · 0.85

Calls 1

SlGetArrayLengthFunction · 0.85

Tested by

no test coverage detected