ConvertFromUnicode can be made private

and default argument can be removed as its always the same
This commit is contained in:
Caolán McNamara
2011-08-09 09:31:29 +01:00
parent 0c88ebd66b
commit 07c1881b18
2 changed files with 13 additions and 23 deletions

View File

@@ -176,6 +176,8 @@ private:
void operator +=(int); // not implemented; to detect misuses void operator +=(int); // not implemented; to detect misuses
// of operator +=(sal_Char) // of operator +=(sal_Char)
static sal_Size ConvertFromUnicode( sal_Unicode c, sal_Char* pBuf, sal_Size nBufLen,
rtl_TextEncoding eTextEncoding );
public: public:
ByteString(); ByteString();
ByteString( const ByteString& rStr ); ByteString( const ByteString& rStr );
@@ -255,12 +257,8 @@ public:
ByteString& Convert( rtl_TextEncoding eSource, ByteString& Convert( rtl_TextEncoding eSource,
rtl_TextEncoding eTarget, rtl_TextEncoding eTarget,
sal_Bool bReplace = sal_True ); sal_Bool bReplace = sal_True );
static sal_Char ConvertFromUnicode( sal_Unicode c, static sal_Char ConvertFromUnicode(sal_Unicode c,
rtl_TextEncoding eTextEncoding, 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 );
ByteString& ConvertLineEnd( LineEnd eLineEnd ); ByteString& ConvertLineEnd( LineEnd eLineEnd );
ByteString& ConvertLineEnd() ByteString& ConvertLineEnd()
{ return ConvertLineEnd( GetSystemLineEnd() ); } { return ConvertLineEnd( GetSystemLineEnd() ); }

View File

@@ -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; sal_Size nLen;
char aBuf[30]; char aBuf[30];
nLen = ConvertFromUnicode( c, aBuf, sizeof( aBuf ), eTextEncoding, bReplace ); nLen = ConvertFromUnicode(c, aBuf, sizeof( aBuf ), eTextEncoding);
if ( nLen == 1 ) if ( nLen == 1 )
return aBuf[0]; return aBuf[0];
else 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_Size ByteString::ConvertFromUnicode( sal_Unicode c, char* pBuf, sal_Size nBufLen, rtl_TextEncoding eTextEncoding )
sal_Bool bReplace )
{ {
// TextEncoding Dontknow wird nicht konvertiert // TextEncoding Dontknow wird nicht konvertiert
if ( eTextEncoding == RTL_TEXTENCODING_DONTKNOW ) 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 | sal_uInt32 nFlags = RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE |
RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE | RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE |
RTL_UNICODETOTEXT_FLAGS_FLUSH; RTL_UNICODETOTEXT_FLAGS_FLUSH;
if ( bReplace )
{ nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT | RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT;
RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT; nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE;
nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE; if ( nBufLen > 1 )
if ( nBufLen > 1 ) nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR;
nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR;
}
else
{
nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_0 |
RTL_UNICODETOTEXT_FLAGS_INVALID_0;
}
hConverter = rtl_createUnicodeToTextConverter( eTextEncoding ); hConverter = rtl_createUnicodeToTextConverter( eTextEncoding );
nDestBytes = rtl_convertUnicodeToText( hConverter, 0, nDestBytes = rtl_convertUnicodeToText( hConverter, 0,