summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/FastNBT.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-08-28 22:42:18 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-28 22:42:18 +0200
commitc1ffed60eccc8748a21acfdce133eae5119d5371 (patch)
tree2dd1fbab63a77f6bf9c8a59bb250b601473a69b7 /src/WorldStorage/FastNBT.cpp
parentBroadcaster: don't loop over all entities to broadcast one's position (diff)
downloadcuberite-c1ffed60eccc8748a21acfdce133eae5119d5371.tar
cuberite-c1ffed60eccc8748a21acfdce133eae5119d5371.tar.gz
cuberite-c1ffed60eccc8748a21acfdce133eae5119d5371.tar.bz2
cuberite-c1ffed60eccc8748a21acfdce133eae5119d5371.tar.lz
cuberite-c1ffed60eccc8748a21acfdce133eae5119d5371.tar.xz
cuberite-c1ffed60eccc8748a21acfdce133eae5119d5371.tar.zst
cuberite-c1ffed60eccc8748a21acfdce133eae5119d5371.zip
Diffstat (limited to 'src/WorldStorage/FastNBT.cpp')
-rw-r--r--src/WorldStorage/FastNBT.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp
index 5f979120b..ec43d2f12 100644
--- a/src/WorldStorage/FastNBT.cpp
+++ b/src/WorldStorage/FastNBT.cpp
@@ -614,12 +614,12 @@ void cFastNBTWriter::AddDouble(const AString & a_Name, double a_Value)
-void cFastNBTWriter::AddString(const AString & a_Name, const AString & a_Value)
+void cFastNBTWriter::AddString(const AString & a_Name, const std::string_view a_Value)
{
TagCommon(a_Name, TAG_String);
- UInt16 len = htons(static_cast<UInt16>(a_Value.size()));
- m_Result.append(reinterpret_cast<const char *>(&len), 2);
- m_Result.append(a_Value.c_str(), a_Value.size());
+ const UInt16 Length = htons(static_cast<UInt16>(a_Value.size()));
+ m_Result.append(reinterpret_cast<const char *>(&Length), sizeof(Length));
+ m_Result.append(a_Value);
}