From: Christian P. <cp...@us...> - 2005-05-24 04:41:31
|
Update of /cvsroot/pclasses/pclasses2/src/Unicode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14310/src/Unicode Modified Files: String.cpp Log Message: - Do not throw errors reported when pre-flighting strings Index: String.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Unicode/String.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- String.cpp 24 May 2005 03:08:21 -0000 1.9 +++ String.cpp 24 May 2005 04:41:21 -0000 1.10 @@ -208,9 +208,6 @@ int32_t strSize = u_strToLower(0, 0, _data->str, _data->length, locale, &errorCode); - if(U_FAILURE(errorCode)) - throw UnicodeError(errorCode, "Could not convert string to lowercase", P_SOURCEINFO); - SharedPtr<Data> newData(alloc(strSize + 1)); errorCode = U_ZERO_ERROR; @@ -231,9 +228,6 @@ int32_t strSize = u_strToUpper(0, 0, _data->str, _data->length, locale, &errorCode); - if(U_FAILURE(errorCode)) - throw UnicodeError(errorCode, "Could not convert string to uppercase", P_SOURCEINFO); - SharedPtr<Data> newData(alloc(strSize + 1)); errorCode = U_ZERO_ERROR; @@ -254,9 +248,6 @@ int32_t strSize = u_strFoldCase(0, 0, _data->str, _data->length, 0, &errorCode); - if(U_FAILURE(errorCode)) - throw UnicodeError(errorCode, "Could not convert string to foldcase", P_SOURCEINFO); - SharedPtr<Data> newData(alloc(strSize + 1)); errorCode = U_ZERO_ERROR; @@ -282,12 +273,14 @@ if(str._data.null() || str._data->length == 0) return *this; - if(_data->size <= _data->length + str._data->length) - resize(_data->length + str._data->length); + if(_data->size <= _data->length + str._data->length + 1) + resize(_data->length + str._data->length + 1); else deepCopy(); - u_strncat(_data->str, str._data->str, str._data->length); + u_strncpy(_data->str + _data->length, str._data->str, str._data->length); + _data->length += str._data->length; + return *this; } @@ -764,9 +757,6 @@ // pre-flight .. get the required storage ... u_strToUTF8(0, 0, &resultLen, _data->str, _data->length, &errorCode); - if(U_FAILURE(errorCode)) - throw UnicodeError(errorCode, "Could not convert string to UTF8", P_SOURCEINFO); - ScopedArrayPtr<char> ret(new char[resultLen + 1]); ::int32_t retLen = 0; @@ -791,9 +781,6 @@ u_strFromUTF8(0, 0, &destLen, str, count, &errorCode); - if(U_FAILURE(errorCode)) - throw UnicodeError(errorCode, "Could not convert UTF8 string to unicode", P_SOURCEINFO); - SharedPtr<Data> data(alloc(destLen + 1)); errorCode = U_ZERO_ERROR; |