MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / readString

Method readString

switch/source/mtp.cpp:106–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104 }
105
106 std::string DataParser::readString(void)
107 {
108 const uint8_t units = readU8();
109 if (units == 0) {
110 return "";
111 }
112
113 std::u16string utf16;
114 utf16.reserve(units);
115 for (uint8_t i = 0; i < units; i++) {
116 const uint16_t unit = readU16();
117 if (!mOk) {
118 return "";
119 }
120 // The terminator is included in the count; stop at it rather than
121 // carrying an embedded null into the std::string.
122 if (unit == 0) {
123 break;
124 }
125 utf16.push_back((char16_t)unit);
126 }
127 return StringUtils::UTF16toUTF8(utf16);
128 }
129
130 void DataParser::skip(size_t count)
131 {

Callers 2

onSendObjectInfoMethod · 0.80
onSetObjectPropValueMethod · 0.80

Calls 2

readU16Function · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected