diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-09 09:31:29 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-09 09:32:40 +0100 |
commit | 07c1881b18bf8b6abdf976e3bdb564945d313a6c (patch) | |
tree | e53e48a313d2131b30e30f042ce4d6d34d6cd997 /tools | |
parent | 0c88ebd66b0283ca770658cf1d5ee2b7b367c64a (diff) |
ConvertFromUnicode can be made private
and default argument can be removed as its always the same
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/string.hxx | 10 | ||||
-rw-r--r-- | tools/source/string/strcvt.cxx | 26 |
2 files changed, 13 insertions, 23 deletions
diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index a8726b5b53da..4ace1289ffdd 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -176,6 +176,8 @@ private: void operator +=(int); // not implemented; to detect misuses // of operator +=(sal_Char) + static sal_Size ConvertFromUnicode( sal_Unicode c, sal_Char* pBuf, sal_Size nBufLen, + rtl_TextEncoding eTextEncoding ); public: ByteString(); ByteString( const ByteString& rStr ); @@ -255,12 +257,8 @@ public: ByteString& Convert( rtl_TextEncoding eSource, rtl_TextEncoding eTarget, sal_Bool bReplace = sal_True ); - static sal_Char ConvertFromUnicode( sal_Unicode c, - rtl_TextEncoding eTextEncoding, - sal_Bool bReplace = sal_True ); - static sal_Size ConvertFromUnicode( sal_Unicode c, sal_Char* pBuf, sal_Size nBufLen, - rtl_TextEncoding eTextEncoding, - sal_Bool bReplace = sal_True ); + static sal_Char ConvertFromUnicode(sal_Unicode c, + rtl_TextEncoding eTextEncoding); ByteString& ConvertLineEnd( LineEnd eLineEnd ); ByteString& ConvertLineEnd() { return ConvertLineEnd( GetSystemLineEnd() ); } diff --git a/tools/source/string/strcvt.cxx b/tools/source/string/strcvt.cxx index 3023a1011885..d5c734b332c6 100644 --- a/tools/source/string/strcvt.cxx +++ b/tools/source/string/strcvt.cxx @@ -386,11 +386,11 @@ ByteString& ByteString::Convert( rtl_TextEncoding eSource, rtl_TextEncoding eTar // ----------------------------------------------------------------------- -char ByteString::ConvertFromUnicode( sal_Unicode c, rtl_TextEncoding eTextEncoding, sal_Bool bReplace ) +char ByteString::ConvertFromUnicode(sal_Unicode c, rtl_TextEncoding eTextEncoding) { sal_Size nLen; char aBuf[30]; - nLen = ConvertFromUnicode( c, aBuf, sizeof( aBuf ), eTextEncoding, bReplace ); + nLen = ConvertFromUnicode(c, aBuf, sizeof( aBuf ), eTextEncoding); if ( nLen == 1 ) return aBuf[0]; else @@ -399,8 +399,7 @@ char ByteString::ConvertFromUnicode( sal_Unicode c, rtl_TextEncoding eTextEncodi // ----------------------------------------------------------------------- -sal_Size ByteString::ConvertFromUnicode( sal_Unicode c, char* pBuf, sal_Size nBufLen, rtl_TextEncoding eTextEncoding, - sal_Bool bReplace ) +sal_Size ByteString::ConvertFromUnicode( sal_Unicode c, char* pBuf, sal_Size nBufLen, rtl_TextEncoding eTextEncoding ) { // TextEncoding Dontknow wird nicht konvertiert if ( eTextEncoding == RTL_TEXTENCODING_DONTKNOW ) @@ -414,19 +413,12 @@ sal_Size ByteString::ConvertFromUnicode( sal_Unicode c, char* pBuf, sal_Size nBu sal_uInt32 nFlags = RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE | RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE | RTL_UNICODETOTEXT_FLAGS_FLUSH; - if ( bReplace ) - { - nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT | - RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT; - nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE; - if ( nBufLen > 1 ) - nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR; - } - else - { - nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_0 | - RTL_UNICODETOTEXT_FLAGS_INVALID_0; - } + + nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT | + RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT; + nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE; + if ( nBufLen > 1 ) + nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR; hConverter = rtl_createUnicodeToTextConverter( eTextEncoding ); nDestBytes = rtl_convertUnicodeToText( hConverter, 0, |