From 8d8a3d26372d9c0a784e181121fc2b360f6fee51 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 31 Aug 2017 16:47:29 +0200 Subject: Add trailing ,/; to string repr of float vector/matrix This makes it possible to differentiate between a scalar and a one-element vector, and fixes #111. --- src/XMLNode.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/XMLNode.cpp') diff --git a/src/XMLNode.cpp b/src/XMLNode.cpp index 0ddc511..2bf1330 100644 --- a/src/XMLNode.cpp +++ b/src/XMLNode.cpp @@ -379,9 +379,9 @@ void XMLNode::setContent(float32 _fValue) template static std::string setContentList_internal(T* pfList, int _iSize) { - std::string str = (_iSize > 0) ? StringUtil::toString(pfList[0]) : ""; - for (int i = 1; i < _iSize; i++) { - str += "," + StringUtil::toString(pfList[i]); + std::string str; + for (int i = 0; i < _iSize; i++) { + str += StringUtil::toString(pfList[i]) + ","; } return str; } @@ -422,8 +422,7 @@ static std::string setContentMatrix_internal(T* _pfMatrix, int _iWidth, int _iHe for (int x = 1; x < _iWidth; x++) s << "," << _pfMatrix[x*s1 + y*s2]; - if (y != _iHeight-1) - s << ";"; + s << ";"; } return s.str(); -- cgit v1.2.3