MCPcopy Create free account
hub / github.com/assimp/assimp / ReadString

Function ReadString

code/AssetLib/FBX/FBXBinaryTokenizer.cpp:153–180  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

151
152// ------------------------------------------------------------------------------------------------
153unsigned int ReadString(const char*& sbegin_out, const char*& send_out, const char* input,
154 const char*& cursor, const char* end, bool long_length = false, bool allow_null = false) {
155 const uint32_t len_len = long_length ? 4 : 1;
156 if(Offset(cursor, end) < len_len) {
157 TokenizeError("cannot ReadString, out of bounds reading length",input, cursor);
158 }
159
160 const uint32_t length = long_length ? ReadWord(input, cursor, end) : ReadByte(input, cursor, end);
161
162 if (Offset(cursor, end) < length) {
163 TokenizeError("cannot ReadString, length is out of bounds",input, cursor);
164 }
165
166 sbegin_out = cursor;
167 cursor += length;
168
169 send_out = cursor;
170
171 if(!allow_null) {
172 for (unsigned int i = 0; i < length; ++i) {
173 if(sbegin_out[i] == '\0') {
174 TokenizeError("failed ReadString, unexpected NUL character in string",input, cursor);
175 }
176 }
177 }
178
179 return length;
180}
181
182// ------------------------------------------------------------------------------------------------
183void ReadData(const char*& sbegin_out, const char*& send_out, const char* input, const char*& cursor, const char* end) {

Callers 2

ReadDataFunction · 0.70
ReadScopeFunction · 0.70

Calls 4

OffsetFunction · 0.85
ReadWordFunction · 0.85
ReadByteFunction · 0.85
TokenizeErrorFunction · 0.70

Tested by

no test coverage detected