| 403 | } |
| 404 | |
| 405 | static cc_result Nbt_ReadString(struct Stream* stream, cc_string* str) { |
| 406 | cc_uint8 buffer[NBT_STRING_SIZE * 4]; |
| 407 | int len; |
| 408 | cc_result res; |
| 409 | |
| 410 | if ((res = Stream_Read(stream, buffer, 2))) return res; |
| 411 | len = Stream_GetU16_BE(buffer); |
| 412 | |
| 413 | if (len > Array_Elems(buffer)) return CW_ERR_STRING_LEN; |
| 414 | if ((res = Stream_Read(stream, buffer, len))) return res; |
| 415 | |
| 416 | String_AppendUtf8(str, buffer, len); |
| 417 | return 0; |
| 418 | } |
| 419 | |
| 420 | typedef void (*Nbt_Callback)(struct NbtTag* tag); |
| 421 | static cc_result Nbt_ReadTag(cc_uint8 typeId, cc_bool readTagName, struct Stream* stream, |
no test coverage detected