[Libreoffice-commits] .: 4 commits - starmath/source sw/inc sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Thu Aug 4 01:37:56 PDT 2011


 starmath/source/mathtype.cxx       |   14 ++++++++------
 sw/inc/shellio.hxx                 |    8 --------
 sw/source/filter/inc/fltbase.hxx   |   11 -----------
 sw/source/filter/writer/writer.cxx |   15 ---------------
 sw/source/filter/ww1/w1class.cxx   |    2 +-
 sw/source/filter/ww8/ww8par.cxx    |    3 +--
 sw/source/filter/ww8/ww8par6.cxx   |    9 +++++++--
 sw/source/ui/config/uinums.cxx     |    6 ++++--
 8 files changed, 21 insertions(+), 47 deletions(-)

New commits:
commit ecd14669f6eba8d291ff757bc776642c7babc1b4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Aug 4 09:27:22 2011 +0100

    replace ByteString::ConvertToUnicode

diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx
index cb2d473..4a3cf87 100644
--- a/starmath/source/mathtype.cxx
+++ b/starmath/source/mathtype.cxx
@@ -674,7 +674,6 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector,
     sal_uInt8 nTag,nRecord;
     sal_uInt8 nTabType,nTabStops;
     sal_uInt16 nTabOffset;
-    sal_Char nChar8;
     String sFontName;
     int i,nRet=1,newline=0;
     bool bSilent=false;
@@ -1762,14 +1761,17 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector,
                     aFont.nTface = 128-aFont.nTface;
                     *pS >> aFont.nStyle;
                     aUserStyles.insert(aFont);
-                    sFontName.Erase();
-                    do
+                    std::vector<sal_Char> aSeq;
+                    while(1)
                     {
+                        sal_Char nChar8(0);
                         *pS >> nChar8;
-                        sFontName.Append(ByteString::ConvertToUnicode(
-                            nChar8,RTL_TEXTENCODING_MS_1252));
+                        if (nChar8 == 0)
+                            break;
+                        aSeq.push_back(nChar8);
                     }
-                    while(nChar8);
+                    sFontName = rtl::OUString(&aSeq[0], aSeq.size(),
+                        RTL_TEXTENCODING_MS_1252);
                 }
                 break;
             case SIZE:
diff --git a/sw/source/filter/ww1/w1class.cxx b/sw/source/filter/ww1/w1class.cxx
index 91539d3..990c1c2 100644
--- a/sw/source/filter/ww1/w1class.cxx
+++ b/sw/source/filter/ww1/w1class.cxx
@@ -72,7 +72,7 @@ sal_Unicode Ww1PlainText::operator [] ( sal_uLong ulOffset )
     if( rFib.GetStream().Seek( ulFilePos + ulOffset ) == ulFilePos+ulOffset &&
         rFib.GetStream().Read( &cRead, sizeof( cRead ) ) == sizeof( cRead ) )
     {
-        cRet = ByteString::ConvertToUnicode( cRead, RTL_TEXTENCODING_MS_1252 );
+        cRet = rtl::OUString(&cRead, 1, RTL_TEXTENCODING_MS_1252).toChar();
     }
     else
         cRet = ' ';
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 785b8e6..0b33216 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3208,8 +3208,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
 
     if( '\x0' != cInsert )
     {
-        String sInsert = ByteString::ConvertToUnicode(cInsert,
-            RTL_TEXTENCODING_MS_1252 );
+        rtl::OUString sInsert(&cInsert, 1, RTL_TEXTENCODING_MS_1252);
         emulateMSWordAddTextToParagraph(sInsert);
     }
     if (!maApos.back()) //a para end in apo doesn't count
diff --git a/sw/source/ui/config/uinums.cxx b/sw/source/ui/config/uinums.cxx
index ac139fc..11ac568 100644
--- a/sw/source/ui/config/uinums.cxx
+++ b/sw/source/ui/config/uinums.cxx
@@ -403,8 +403,10 @@ SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
             nCharSet = RTL_TEXTENCODING_SYMBOL;
 
         if( VERSION_53A > nVersion )
-            aFmt.SetBulletChar( ByteString::ConvertToUnicode(
-                                            sal_Char(aFmt.GetBulletChar()), nCharSet ));
+        {
+            sal_Char cEncoded(aFmt.GetBulletChar());
+            aFmt.SetBulletChar(rtl::OUString(&cEncoded, 1, nCharSet).toChar());
+        }
     }
 
     if( VERSION_30B != nVersion )
commit c65f768206269dda73ccb520868d26b5638b2800
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Aug 4 09:26:29 2011 +0100

    callcatcher: remove unused methods

diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index 21aeb98..4955b75 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -483,14 +483,6 @@ public:
     SvStream& OutLong( SvStream& rStrm, long nVal );
     SvStream& OutULong( SvStream& rStrm, sal_uLong nVal );
 
-    // Output hex number; default is two-digit number.
-    SvStream& OutHex( SvStream& rStrm, sal_uLong nHex, sal_uInt8 nLen = 2 );
-    // Output four-digit hex number.
-    inline SvStream& OutHex4( SvStream& rStrm, sal_uInt16 nHex )
-        {   return OutHex( rStrm, nHex, 4 ); }
-
-    inline SvStream& OutHex( sal_uInt16 nHex, sal_uInt8 nLen = 2 )      { return OutHex( Strm(), nHex, nLen ); }
-    inline SvStream& OutHex4( sal_uInt16 nHex )     { return OutHex( Strm(), nHex, 4 ); }
     inline SvStream& OutLong( long nVal )       { return OutLong( Strm(), nVal ); }
     inline SvStream& OutULong( sal_uLong nVal )		{ return OutULong( Strm(), nVal ); }
 
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index 8e55505..8557f0a 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -261,21 +261,6 @@ SvStream& Writer::Strm()
 void Writer::SetStream(SvStream *const pStream)
 { m_pImpl->m_pStream = pStream; }
 
-
-SvStream& Writer::OutHex( SvStream& rStrm, sal_uLong nHex, sal_uInt8 nLen )
-{												   // in einen Stream aus
-    // Pointer an das Bufferende setzen
-    sal_Char* pStr = aNToABuf + (NTOABUFLEN-1);
-    for( sal_uInt8 n = 0; n < nLen; ++n )
-    {
-        *(--pStr) = (sal_Char)(nHex & 0xf ) + 48;
-        if( *pStr > '9' )
-            *pStr += 39;
-        nHex >>= 4;
-    }
-    return rStrm << pStr;
-}
-
 SvStream& Writer::OutLong( SvStream& rStrm, long nVal )
 {
     // Pointer an das Bufferende setzen
commit 402b448a4f0fb98479ddc73cb0488751f0dad75e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 3 22:41:41 2011 +0100

    SwFilterBase::ReadUnicode is dubious, luckily unused

diff --git a/sw/source/filter/inc/fltbase.hxx b/sw/source/filter/inc/fltbase.hxx
index 2748d48..919d42b 100644
--- a/sw/source/filter/inc/fltbase.hxx
+++ b/sw/source/filter/inc/fltbase.hxx
@@ -48,7 +48,6 @@ protected:
     inline void ReadChar( char &rC );
     inline void ReadByte( sal_uInt8 &rN );
     inline void Read( short &rN );
-    inline void ReadUnicode( sal_Unicode &rU );
     inline void Read( sal_uInt8 &rN0, sal_uInt16 &rN1, sal_uInt16 &rN2 );
     inline void Read( sal_uInt16 &rN );
     inline void Read( sal_uInt16 &rN1, sal_uInt16 &rN2 );
@@ -71,16 +70,6 @@ inline void SwFilterBase::ReadByte( sal_uInt8 &rN )
     nBytesLeft--;
     }
 
-inline void SwFilterBase::ReadUnicode( sal_Unicode &rU )
-{
-    {
-    sal_Char cC;
-    *pIn >> cC;
-    rU = ByteString::ConvertToUnicode(cC, eQuellChar);
-    nBytesLeft--;
-    }
-}
-
 inline void SwFilterBase::Read( short &rN )
     {
     *pIn >> rN;
commit 45fd57f285f6a780479147e547826dd824e68ae6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 3 22:37:55 2011 +0100

    ByteString::ConvertToUnicode->rtl::OUString ctor

diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 2afe16b..7b29062 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2780,11 +2780,16 @@ void SwWW8ImplReader::Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen
             {
                 if( bVer67 )
                 {
-                    cSymbol = ByteString::ConvertToUnicode(
-                        *(sal_Char*)(pData+2), RTL_TEXTENCODING_MS_1252 );
+                    //convert single byte from MS1252 to Unicode
+                    cSymbol = rtl::OUString(
+                        reinterpret_cast<const sal_Char*>(pData+2), 1,
+                        RTL_TEXTENCODING_MS_1252).toChar();
                 }
                 else
+                {
+                    //already is Unicode
                     cSymbol = SVBT16ToShort( pData+2 );
+                }
                 bSymbol = true;
             }
         }


More information about the Libreoffice-commits mailing list