1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Return the length of the written string.

Since they can be dynamically generated through a formatted string.
This commit is contained in:
Sandu Liviu Catalin 2020-04-20 03:48:49 +03:00
parent 1f2f580a67
commit 8a927419c2
2 changed files with 8 additions and 4 deletions

View File

@ -40,7 +40,7 @@ void SqBuffer::WriteUint64(const ULongInt & val)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void SqBuffer::WriteRawString(StackStrF & val) SQInteger SqBuffer::WriteRawString(StackStrF & val)
{ {
// Validate the managed buffer reference // Validate the managed buffer reference
Validate(); Validate();
@ -53,10 +53,12 @@ void SqBuffer::WriteRawString(StackStrF & val)
Buffer::SzType length = ConvTo< Buffer::SzType >::From(val.mLen); Buffer::SzType length = ConvTo< Buffer::SzType >::From(val.mLen);
// Write the the string contents // Write the the string contents
m_Buffer->AppendS(val.mPtr, length); m_Buffer->AppendS(val.mPtr, length);
// Return the length of the written string
return val.mLen;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void SqBuffer::WriteClientString(StackStrF & val) SQInteger SqBuffer::WriteClientString(StackStrF & val)
{ {
// Validate the managed buffer reference // Validate the managed buffer reference
Validate(); Validate();
@ -76,6 +78,8 @@ void SqBuffer::WriteClientString(StackStrF & val)
// Write the size and then the string contents // Write the size and then the string contents
m_Buffer->Push< Uint16 >(size); m_Buffer->Push< Uint16 >(size);
m_Buffer->AppendS(val.mPtr, length); m_Buffer->AppendS(val.mPtr, length);
// Return the length of the written string
return val.mLen;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -583,12 +583,12 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Write a raw string to the buffer. * Write a raw string to the buffer.
*/ */
void WriteRawString(StackStrF & val); SQInteger WriteRawString(StackStrF & val);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Write a client encoded string to the buffer. * Write a client encoded string to the buffer.
*/ */
void WriteClientString(StackStrF & val); SQInteger WriteClientString(StackStrF & val);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Write a AABB to the buffer. * Write a AABB to the buffer.