diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-03-14 09:47:56 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-03-14 09:47:56 +0100 |
commit | 7f8194a7d87a87b391ac1ee28c55870cdbc56ba0 (patch) | |
tree | 207aae7b6a00d2d4cbcf1d5c4516b00f86634e17 /rsc | |
parent | 5342a87464932ce062004e3587bd4339a10035db (diff) | |
parent | f59ba28bac7a38bb86e10779ca38276259dc79e7 (diff) |
debuglevels: pulled and merged DEV300.m102
Diffstat (limited to 'rsc')
-rw-r--r-- | rsc/source/tools/rscchar.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/rsc/source/tools/rscchar.cxx b/rsc/source/tools/rscchar.cxx index f666058617f8..f554040c4ec9 100644 --- a/rsc/source/tools/rscchar.cxx +++ b/rsc/source/tools/rscchar.cxx @@ -55,13 +55,13 @@ *************************************************************************/ char * RscChar::MakeUTF8( char * pStr, sal_uInt16 nTextEncoding ) { - sal_Size nMaxUniCodeBuf = strlen( pStr ) + 1; - char * pOrgStr = new char[ nMaxUniCodeBuf ]; - sal_uInt32 nOrgLen = 0; - + sal_Size nMaxUniCodeBuf = strlen( pStr ) + 1; if( nMaxUniCodeBuf * 6 > 0x0FFFFF ) RscExit( 10 ); + char * pOrgStr = new char[ nMaxUniCodeBuf ]; + sal_uInt32 nOrgLen = 0; + char cOld = '1'; while( cOld != 0 ) { @@ -119,9 +119,8 @@ char * RscChar::MakeUTF8( char * pStr, sal_uInt16 nTextEncoding ) } if( nChar > 255 ) { - rtl_freeMemory( pOrgStr ); - // Wert zu gross, oder kein 3 Ziffern + delete [] pOrgStr; return( NULL ); } c = (char)nChar; @@ -174,6 +173,7 @@ char * RscChar::MakeUTF8( char * pStr, sal_uInt16 nTextEncoding ) &nSrcCvtBytes ); rtl_destroyTextToUnicodeConverter( hConv ); + delete[] pOrgStr, pOrgStr = 0; hConv = rtl_createUnicodeToTextConverter( RTL_TEXTENCODING_UTF8 ); // factor fo 6 is the maximum size of an UNICODE character as utf8 @@ -188,9 +188,7 @@ char * RscChar::MakeUTF8( char * pStr, sal_uInt16 nTextEncoding ) &nSrcCvtBytes ); rtl_destroyTextToUnicodeConverter( hConv ); - - delete[] pUniCode; - delete[] pOrgStr; + delete[] pUniCode, pUniCode = 0; return pUtf8; }; |