MCPcopy Create free account
hub / github.com/cuberite/cuberite / AddIntArray

Method AddIntArray

src/WorldStorage/FastNBT.cpp:505–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503
504
505void cFastNBTWriter::AddIntArray(const AString & a_Name, const int * a_Value, size_t a_NumElements)
506{
507 TagCommon(a_Name, TAG_IntArray);
508 Int32 len = htonl(a_NumElements);
509 size_t cap = m_Result.capacity();
510 size_t size = m_Result.length();
511 if ((cap - size) < (4 + a_NumElements * 4))
512 {
513 m_Result.reserve(size + 4 + (a_NumElements * 4));
514 }
515 m_Result.append((const char *)&len, 4);
516 for (size_t i = 0; i < a_NumElements; i++)
517 {
518 int Element = htonl(a_Value[i]);
519 m_Result.append((const char *)&Element, 4);
520 }
521}
522
523
524

Callers 3

WriteToNBTCompoundMethod · 0.80
SaveChunkToNBTMethod · 0.80
SerializeNBTTagMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected