[Libreoffice-commits] .: 3 commits - binfilter/bf_sfx2 binfilter/bf_svtools binfilter/bf_svx binfilter/bf_sw

Caolán McNamara caolan at kemper.freedesktop.org
Mon Sep 19 02:00:01 PDT 2011


 binfilter/bf_sfx2/source/doc/sfx2_docinf.cxx                  |   10 ++--
 binfilter/bf_svtools/source/filter.vcl/filter/svt_sgvtext.cxx |    3 -
 binfilter/bf_svtools/source/filter.vcl/igif/svt_gifread.cxx   |   11 +----
 binfilter/bf_svx/source/unoedit/svx_unotext.cxx               |    4 -
 binfilter/bf_sw/source/core/sw3io/crypter.hxx                 |    6 +-
 binfilter/bf_sw/source/core/sw3io/sw_crypter.cxx              |   22 +++++-----
 binfilter/bf_sw/source/core/sw3io/sw_sw3imp.cxx               |    8 +--
 binfilter/bf_sw/source/core/sw3io/sw_sw3nodes.cxx             |    6 ++
 8 files changed, 37 insertions(+), 33 deletions(-)

New commits:
commit 23f135dfd2d6631322286697f052c38af319f815
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Sep 19 09:58:42 2011 +0100

    port over the non-binfilter fix here

diff --git a/binfilter/bf_svtools/source/filter.vcl/filter/svt_sgvtext.cxx b/binfilter/bf_svtools/source/filter.vcl/filter/svt_sgvtext.cxx
index a247f6f..6571ed7 100644
--- a/binfilter/bf_svtools/source/filter.vcl/filter/svt_sgvtext.cxx
+++ b/binfilter/bf_svtools/source/filter.vcl/filter/svt_sgvtext.cxx
@@ -980,7 +980,8 @@ void DrawChar(OutputDevice& rOut, UCHAR c, ObjTextType T, PointType Pos, USHORT
 {
     SetTextContext(rOut,T,UpcasePossible(c),DrehWink,FitXMul,FitXDiv,FitYMul,FitYDiv);
     if ((T.Schnitt & TextKaptBit)!=0 && UpcasePossible(c)) c=Upcase(c);
-    String s( (char)c, RTL_TEXTENCODING_IBM_437 );
+    rtl::OUString s(reinterpret_cast<sal_Char*>(&c), 1,
+        RTL_TEXTENCODING_IBM_437);
     rOut.DrawText( Point( Pos.x, Pos.y ), s );
 }
 
commit 71369004e4ebe19532c33b98a694d023d5fa4ef4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Sep 18 23:25:51 2011 +0100

    mirror non-binfilter change in

diff --git a/binfilter/bf_svx/source/unoedit/svx_unotext.cxx b/binfilter/bf_svx/source/unoedit/svx_unotext.cxx
index 461856c..6b5048a 100644
--- a/binfilter/bf_svx/source/unoedit/svx_unotext.cxx
+++ b/binfilter/bf_svx/source/unoedit/svx_unotext.cxx
@@ -1624,7 +1624,7 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text
         {
         case text::ControlCharacter::PARAGRAPH_BREAK:
         {
-            const String aText( (char)13, 1 );  // '\r' geht auf'm Mac nicht
+            const String aText( (sal_Unicode)13 );  // '\r' geht auf'm Mac nicht
             insertString( xRange, aText, bAbsorb );
 
             return;
@@ -1675,7 +1675,7 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text
                 aRange.nEndPos  = aRange.nStartPos;
 
                 pRange->SetSelection( aRange );
-                const String aText( (char)13, 1 );  // '\r' geht auf'm Mac nicht
+                const String aText( (sal_Unicode)13 );  // '\r' geht auf'm Mac nicht
                 pRange->setString( aText );
 
                 aRange.nStartPos = 0;
commit bbd3255c11414295f61461d85f4c154dd985d240
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Sep 18 13:40:27 2011 +0100

    ditch ByteString::*Buffer*

diff --git a/binfilter/bf_sfx2/source/doc/sfx2_docinf.cxx b/binfilter/bf_sfx2/source/doc/sfx2_docinf.cxx
index 7875b2f..2e767c9 100644
--- a/binfilter/bf_sfx2/source/doc/sfx2_docinf.cxx
+++ b/binfilter/bf_sfx2/source/doc/sfx2_docinf.cxx
@@ -32,7 +32,7 @@
 #include <tools/tenccvt.hxx>
 #include <bf_svtools/useroptions.hxx>
 #include <sot/exchange.hxx>
-#include "rtl/tencinfo.h"
+#include <rtl/tencinfo.h>
 
 #include "fcontnr.hxx"
 #include "openflag.hxx"
@@ -185,11 +185,13 @@ static const char pDocInfoHeader[] = "SfxDocumentInfo";
 /*N*/         }
 /*N*/         else
 /*N*/         {
-/*N*/             ByteString aTemp;
 /*N*/             if ( nLen>1 )
 /*N*/             {
-/*N*/                 rStream.Read( aTemp.AllocBuffer( (xub_StrLen)( nLen - 1 ) ), nLen );
-/*N*/                 aString = String( aTemp, nEncoding );
+/*N*/                 rtl::OString aTemp = read_uInt8s_AsOString(rStream, nLen-1);
+/*N*/                 sal_uInt8 nTerminator = 0;
+/*N*/                 rStream >> nTerminator;
+/*N*/                 DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
+/*N*/                 aString = rtl::OStringToOUString(aTemp, nEncoding);
 /*N*/             }
 /*N*/             else
 /*N*/                 aString = String();
diff --git a/binfilter/bf_svtools/source/filter.vcl/igif/svt_gifread.cxx b/binfilter/bf_svtools/source/filter.vcl/igif/svt_gifread.cxx
index 46a07eb..dc53d76 100644
--- a/binfilter/bf_svtools/source/filter.vcl/igif/svt_gifread.cxx
+++ b/binfilter/bf_svtools/source/filter.vcl/igif/svt_gifread.cxx
@@ -262,15 +262,12 @@ BOOL GIFReader::ReadExtension()
                     // Appl.-Extension hat Laenge 11
                     if ( cSize == 0x0b )
                     {
-                        ByteString  aAppId;
-                        ByteString  aAppCode;
-
-                        rIStm.Read( aAppId.AllocBuffer( 8 ), 8 );
-                        rIStm.Read( aAppCode.AllocBuffer( 3 ), 3 );
+                        rtl::OString aAppId = read_uInt8s_AsOString(rIStm, 8);
+                        rtl::OString aAppCode = read_uInt8s_AsOString(rIStm, 3);
                         rIStm >> cSize;
 
                         // NetScape-Extension
-                        if( aAppId == "NETSCAPE" && aAppCode == "2.0" && cSize == 3 )
+                        if( aAppId.equalsL(RTL_CONSTASCII_STRINGPARAM("NETSCAPE")) && aAppCode.equalsL(RTL_CONSTASCII_STRINGPARAM("2.0")) && cSize == 3 )
                         {
                             rIStm >> cByte;
 
@@ -297,7 +294,7 @@ BOOL GIFReader::ReadExtension()
                             else
                                 rIStm.SeekRel( -1 );
                         }
-                        else if ( aAppId == "STARDIV " && aAppCode == "5.0" && cSize == 9 )
+                        else if ( aAppId.equalsL(RTL_CONSTASCII_STRINGPARAM("STARDIV ")) && aAppCode.equalsL(RTL_CONSTASCII_STRINGPARAM("5.0")) && cSize == 9 )
                         {
                             rIStm >> cByte;
 
diff --git a/binfilter/bf_sw/source/core/sw3io/crypter.hxx b/binfilter/bf_sw/source/core/sw3io/crypter.hxx
index 9993182..bd9a9a9 100644
--- a/binfilter/bf_sw/source/core/sw3io/crypter.hxx
+++ b/binfilter/bf_sw/source/core/sw3io/crypter.hxx
@@ -30,10 +30,10 @@
 #define _SW3CRYPT_HXX
 
 #include <bf_svtools/bf_solar.h>
+#include <rtl/strbuf.hxx>
 class String;
 namespace binfilter {
 
-
 #define PASSWDLEN 16
 
 class Crypter
@@ -44,8 +44,8 @@ public:
     short GetMaxPasswdLen() const { return PASSWDLEN; }
     short GetMinPasswdLen() const { return 5;         }
 
-    void Encrypt( ByteString& rTxt ) const;
-    void Decrypt( ByteString& rTxt ) const;
+    void Encrypt( rtl::OStringBuffer& rTxt ) const;
+    void Decrypt( rtl::OStringBuffer& rTxt ) const;
 };
 
 } //namespace binfilter
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_crypter.cxx b/binfilter/bf_sw/source/core/sw3io/sw_crypter.cxx
index 965bb03..83fef26 100644
--- a/binfilter/bf_sw/source/core/sw3io/sw_crypter.cxx
+++ b/binfilter/bf_sw/source/core/sw3io/sw_crypter.cxx
@@ -52,40 +52,40 @@ Crypter::Crypter( const ByteString& r )
 
     rtl::OStringBuffer aBuf(r);
     comphelper::string::padToLength(aBuf, PASSWDLEN, ' ');
-    ByteString aPasswd(aBuf.makeStringAndClear());
     memcpy( cPasswd, cEncode, PASSWDLEN );
-    Encrypt( aPasswd );
-    memcpy( cPasswd, aPasswd.GetBuffer(), PASSWDLEN );
+    Encrypt( aBuf );
+    memcpy( cPasswd, aBuf.getStr(), PASSWDLEN );
 }
 
 
 
-void Crypter::Encrypt( ByteString& r ) const
+void Crypter::Encrypt( rtl::OStringBuffer& r ) const
 {
-    xub_StrLen nLen = r.Len();
+    sal_Int32 nLen = r.getLength(), i = 0;
     if( !nLen )
         return ;
 
     xub_StrLen nCryptPtr = 0;
     BYTE cBuf[ PASSWDLEN ];
     memcpy( cBuf, cPasswd, PASSWDLEN );
-    BYTE* pSrc = (BYTE*)r.GetBufferAccess();
     BYTE* p = cBuf;
 
     while( nLen-- )
     {
-        *pSrc = *pSrc ^ ( *p ^ (BYTE) ( cBuf[ 0 ] * nCryptPtr ) );
+        r.setCharAt(i, r[i] ^ ( *p ^ (BYTE) ( cBuf[ 0 ] * nCryptPtr ) ));
         *p += ( nCryptPtr < (PASSWDLEN-1) ) ? *(p+1) : cBuf[ 0 ];
-        if( !*p ) *p += 1;
+        if( !*p )
+            *p += 1;
         p++;
-        if( ++nCryptPtr >= PASSWDLEN ) nCryptPtr = 0, p = cBuf;
-        pSrc++;
+        if( ++nCryptPtr >= PASSWDLEN )
+            nCryptPtr = 0, p = cBuf;
+        ++i;
     }
 }
 
 
 
-void Crypter::Decrypt( ByteString& r ) const
+void Crypter::Decrypt( rtl::OStringBuffer& r ) const
 {
     Encrypt( r );
 }
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3imp.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3imp.cxx
index ab01017..e8da6cd 100644
--- a/binfilter/bf_sw/source/core/sw3io/sw_sw3imp.cxx
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3imp.cxx
@@ -1646,9 +1646,9 @@ void Sw3StringPool::LoadOld( SvStream& r )
 /*N*/   {
 /*?*/       sal_Char buf[ 17 ];
 /*?*/       snprintf( buf, sizeof(buf), "%08"SAL_PRIxUINT32"%08"SAL_PRIxUINT32, nDate, nTime );
-/*?*/       ByteString aTest( buf );
+/*?*/       rtl::OStringBuffer aTest( buf );
 /*?*/       pCrypter->Encrypt( aTest );
-/*?*/       return sal_Bool( !memcmp( cPasswd, aTest.GetBuffer(), PASSWDLEN ) );
+/*?*/       return sal_Bool( !memcmp( cPasswd, aTest.getStr(), PASSWDLEN ) );
 /*N*/   }
 /*N*/   else
 /*N*/       return sal_Bool( ( nFileFlags & SWGF_HAS_PASSWD ) == 0 );
@@ -1664,9 +1664,9 @@ void Sw3StringPool::LoadOld( SvStream& r )
 /*?*/       pCrypter = new Crypter( pRoot->GetKey() );
 /*?*/       sal_Char buf[ 17 ];
 /*?*/       snprintf( buf, sizeof(buf), "%08"SAL_PRIxUINT32"%08"SAL_PRIxUINT32, nDate, nTime );
-/*?*/       ByteString aTest( buf );
+/*?*/       rtl::OStringBuffer aTest( buf );
 /*?*/       pCrypter->Encrypt( aTest );
-/*?*/       memcpy( cPasswd, aTest.GetBuffer(), aTest.Len() );
+/*?*/       memcpy( cPasswd, aTest.getStr(), aTest.getLength() );
 /*?*/       nFileFlags|= SWGF_HAS_PASSWD;
 /*N*/   }
 /*N*/ }
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3nodes.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3nodes.cxx
index ae436f1..60681a0 100644
--- a/binfilter/bf_sw/source/core/sw3io/sw_sw3nodes.cxx
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3nodes.cxx
@@ -677,7 +677,11 @@ SV_DECL_PTRARR( SwTxtAttrs, SwTxtAttrPtr, 5, 5 )
 /*N*/   ByteString aText8;
 /*N*/   pStrm->ReadByteString( aText8 );
 /*N*/   if( pCrypter )
-            pCrypter->Decrypt( aText8 );
+        {
+            rtl::OStringBuffer aBuffer(aText8);
+            pCrypter->Decrypt( aBuffer );
+            aText8 = aBuffer.makeStringAndClear();
+        }
 /*N*/   String aText( aText8, eSrcSet );
 /*N*/   if( !pNd )
 /*N*/   {


More information about the Libreoffice-commits mailing list