From 795b1ef4fd56abf5f8730e15927e4f0a9405a95d Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Fri, 4 May 2012 13:36:21 +0200 Subject: [PATCH] Added String::Combine. It was previously commented out because it was broken. --- libmaxsi/string.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libmaxsi/string.cpp b/libmaxsi/string.cpp index 1b638f30..309c5129 100644 --- a/libmaxsi/string.cpp +++ b/libmaxsi/string.cpp @@ -333,7 +333,7 @@ namespace Maxsi } #endif -#if 0 +#if 1 char* Combine(size_t NumParameters, ...) { va_list param_pt; @@ -348,11 +348,12 @@ namespace Maxsi { TMP = va_arg(param_pt, const char*); - if ( TMP != NULL ) { ResultLength += strlen(TMP); } + if ( TMP != NULL ) { ResultLength += Length(TMP); } } // Allocate a string with the desired length. char* Result = new char[ResultLength+1]; + if ( !Result ) { return NULL; } Result[0] = 0; @@ -367,8 +368,8 @@ namespace Maxsi if ( TMP ) { - size_t TMPLength = strlen(TMP); - strcpy(Result + ResultOffset, TMP); + size_t TMPLength = Length(TMP); + Copy(Result + ResultOffset, TMP); ResultOffset += TMPLength; } }