From fae5ebb9e817ff6f3776438f6eef3ccc7f7b58cb Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Thu, 10 Apr 2025 08:55:42 +0100 Subject: [PATCH] null termination was wiping buffer --- Engine/source/console/propertyParsing.h | 1 - Engine/source/math/mathTypes.cpp | 19 +++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Engine/source/console/propertyParsing.h b/Engine/source/console/propertyParsing.h index 62b582191..69bdc09f6 100644 --- a/Engine/source/console/propertyParsing.h +++ b/Engine/source/console/propertyParsing.h @@ -185,7 +185,6 @@ namespace PropertyInfo *ptr++ = ' '; } - *ptr = '\0'; return ptr; // return end of written string for chaining } diff --git a/Engine/source/math/mathTypes.cpp b/Engine/source/math/mathTypes.cpp index 6558786d6..60779b212 100644 --- a/Engine/source/math/mathTypes.cpp +++ b/Engine/source/math/mathTypes.cpp @@ -399,12 +399,11 @@ ConsoleGetType( TypeMatrixF ) static const U32 bufSize = 256; char* buffer = Con::getReturnBuffer(bufSize); - buffer = PropertyInfo::FormatPropertyBuffer(col0, buffer, bufSize); + PropertyInfo::FormatPropertyBuffer(col0, buffer, bufSize); *buffer++ = ' '; - buffer = PropertyInfo::FormatPropertyBuffer(col1, buffer, bufSize); + PropertyInfo::FormatPropertyBuffer(col1, buffer, bufSize); *buffer++ = ' '; - buffer = PropertyInfo::FormatPropertyBuffer(col2, buffer, bufSize); - *buffer = '\0'; // null-terminate just in case + PropertyInfo::FormatPropertyBuffer(col2, buffer, bufSize); return buffer; } @@ -444,9 +443,9 @@ ConsoleGetType( TypeMatrixPosition ) Point4F pos(col[0], col[4], col[8], col[12]); if (col[12] == 1.0f) - returnBuffer = PropertyInfo::FormatPropertyBuffer(&pos, returnBuffer, bufSize); + PropertyInfo::FormatPropertyBuffer(&pos, returnBuffer, bufSize); else - returnBuffer = PropertyInfo::FormatPropertyBuffer(&pos, returnBuffer, bufSize); + PropertyInfo::FormatPropertyBuffer(&pos, returnBuffer, bufSize); return returnBuffer; } @@ -644,9 +643,9 @@ ConsoleGetType( TypeEaseF ) char* buffer = Con::getReturnBuffer(bufSize); EaseF* pEase = (EaseF*)dptr; - buffer = PropertyInfo::FormatPropertyBuffer(pEase + 0, buffer, bufSize); + PropertyInfo::FormatPropertyBuffer(pEase + 0, buffer, bufSize); *buffer++ = ' '; - buffer = PropertyInfo::FormatPropertyBuffer(pEase + 2, buffer, bufSize); + PropertyInfo::FormatPropertyBuffer(pEase + 2, buffer, bufSize); *buffer = '\0'; // null-terminate just in case return buffer; @@ -691,12 +690,12 @@ ConsoleGetType(TypeRotationF) if (pt->mRotationType == RotationF::Euler) { EulerF out = pt->asEulerF(RotationF::Degrees); - returnBuffer = PropertyInfo::FormatPropertyBuffer(out, returnBuffer, bufSize); + PropertyInfo::FormatPropertyBuffer(out, returnBuffer, bufSize); } else if (pt->mRotationType == RotationF::AxisAngle) { AngAxisF out = pt->asAxisAngle(RotationF::Degrees); - returnBuffer = PropertyInfo::FormatPropertyBuffer(&out, returnBuffer, bufSize); + PropertyInfo::FormatPropertyBuffer(&out, returnBuffer, bufSize); } *returnBuffer = '\0'; // null-terminate just in case