[Libreoffice-commits] core.git: 9 commits - canvas/source editeng/source filter/source include/vcl slideshow/source svtools/inc svtools/source svx/source vcl/source

Caolán McNamara caolanm at redhat.com
Tue Jan 14 02:53:54 PST 2014


 canvas/source/directx/dx_textlayout_drawhelper.cxx |    8 +++---
 editeng/source/editeng/editdoc.cxx                 |    3 --
 filter/source/msfilter/msdffimp.cxx                |    4 +--
 include/vcl/textdata.hxx                           |   26 ++++++++++-----------
 slideshow/source/engine/shapes/gdimtftools.cxx     |   13 ++++------
 svtools/inc/pch/precompiled_svt.hxx                |    1 
 svtools/source/svhtml/parhtml.cxx                  |   10 --------
 svx/source/accessibility/AccessibleTextHelper.cxx  |   17 ++++++-------
 svx/source/dialog/docrecovery.cxx                  |    2 -
 vcl/source/edit/textdata.cxx                       |    2 -
 10 files changed, 37 insertions(+), 49 deletions(-)

New commits:
commit f0bae2b9c3491a9458eb7324bf5955614215cc27
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 14 10:44:55 2014 +0000

    longparas: drop wrong xub_StrLen casts now
    
    Change-Id: I720b921367ad810e3d775155535c1e05ab5f6f2c

diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx
index d1f76e6..183e6a1 100644
--- a/canvas/source/directx/dx_textlayout_drawhelper.cxx
+++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx
@@ -215,16 +215,16 @@ namespace dxcanvas
                 aVirtualDevice.DrawTextArray( aEmptyPoint,
                                               aText,
                                               pDXArray.get(),
-                                              (xub_StrLen)rText.StartPosition,
-                                              (xub_StrLen)rText.Length );
+                                              rText.StartPosition,
+                                              rText.Length );
             }
             else
             {
                 // draw the String
                 aVirtualDevice.DrawText( aEmptyPoint,
                                          aText,
-                                         (xub_StrLen)rText.StartPosition,
-                                         (xub_StrLen)rText.Length );
+                                         rText.StartPosition,
+                                         rText.Length );
             }
         }
     }
commit 240dbc509688a2538eb546103c6bea351fff2a6b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 14 10:13:45 2014 +0000

    sal_uLong->size_t
    
    Change-Id: Id10a0d7e0d635a6829966dc5ce0110dc715d7c6c

diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx
index afd4f10..925efff 100644
--- a/include/vcl/textdata.hxx
+++ b/include/vcl/textdata.hxx
@@ -160,11 +160,11 @@ struct TEIMEInfos
 template <class T> class ToolsList : public ::std::vector< T >
 {
 public:
-    sal_uLong       Count() const { return static_cast<sal_uLong>(::std::vector< T >::size()); }
-    sal_uLong       GetPos( T pObject ) const { return ( ::std::find( this->begin(), this->end(), pObject ) ) - this->begin(); }
-    T               GetObject( sal_uLong nIndex ) const { return (*this)[nIndex]; }
-    void            Insert( T pObject, sal_uLong nPos ) { ::std::vector< T >::insert( this->begin()+nPos, pObject ); }
-    void            Remove( sal_uLong nPos ) { ::std::vector< T >::erase( this->begin()+nPos ); }
+    size_t Count() const { return ::std::vector< T >::size(); }
+    size_t GetPos( T pObject ) const { return ( ::std::find( this->begin(), this->end(), pObject ) ) - this->begin(); }
+    T      GetObject( size_t nIndex ) const { return (*this)[nIndex]; }
+    void   Insert( T pObject, size_t nPos ) { ::std::vector< T >::insert( this->begin()+nPos, pObject ); }
+    void   Remove( size_t nPos ) { ::std::vector< T >::erase( this->begin()+nPos ); }
 };
 
 #endif // INCLUDED_VCL_TEXTDATA_HXX
commit f619315ae3f29d674042b62dfc1c11635817781a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 14 10:09:17 2014 +0000

    longparas: bump nLen to 32bit
    
    Change-Id: I49621bc3887baf8fcee17559818193325b83f27d

diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx
index f80c531..afd4f10 100644
--- a/include/vcl/textdata.hxx
+++ b/include/vcl/textdata.hxx
@@ -140,16 +140,16 @@ struct TEIMEInfos
 {
     OUString    aOldTextAfterStartPos;
     sal_uInt16* pAttribs;
-    TextPaM aPos;
-    sal_uInt16  nLen;
-    sal_Bool    bCursor;
-    sal_Bool    bWasCursorOverwrite;
+    TextPaM     aPos;
+    sal_Int32   nLen;
+    bool        bCursor;
+    bool        bWasCursorOverwrite;
 
-            TEIMEInfos( const TextPaM& rPos, const OUString& rOldTextAfterStartPos );
-            ~TEIMEInfos();
+    TEIMEInfos(const TextPaM& rPos, const OUString& rOldTextAfterStartPos);
+    ~TEIMEInfos();
 
-    void    CopyAttribs( const sal_uInt16* pA, sal_uInt16 nL );
-    void    DestroyAttribs();
+    void CopyAttribs(const sal_uInt16* pA, sal_Int32 nL);
+    void DestroyAttribs();
 };
 
 // -----------------  Wrapper for old Tools List -------------------
diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx
index d5a15d9..fc71388 100644
--- a/vcl/source/edit/textdata.cxx
+++ b/vcl/source/edit/textdata.cxx
@@ -300,7 +300,7 @@ TEIMEInfos::~TEIMEInfos()
     delete[] pAttribs;
 }
 
-void TEIMEInfos::CopyAttribs( const sal_uInt16* pA, sal_uInt16 nL )
+void TEIMEInfos::CopyAttribs(const sal_uInt16* pA, sal_Int32 nL)
 {
     nLen = nL;
     delete[] pAttribs;
commit ec3085d6256959722dca64c0df71487177cb4db3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 14 09:54:22 2014 +0000

    comment is wrong now with conversion to OUString
    
    Change-Id: Iff26cd2c966fc747895fbde7229a457a99c62f7a

diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 0b45180..2b0e40f 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -2144,8 +2144,7 @@ OUString EditDoc::GetParaAsString(
             pNextFeature = 0;   // Feature does not interest the below
 
         DBG_ASSERT( nEnd >= nIndex, "End in front of the index?" );
-        //!! beware of sub string length  of -1 which is also defined as STRING_LEN and
-        //!! thus would result in adding the whole sub string up to the end of the node !!
+        //!! beware of sub string length  of -1
         if (nEnd > nIndex)
             aStr += pNode->GetString().copy(nIndex, nEnd - nIndex);
 
commit e576b083c88b97750ce261da80c3933cc04725a7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 14 09:50:47 2014 +0000

    longparas: drop STRING_MAXLEN use now
    
    Change-Id: Iaaca13e732c234e9051be0ab66a7625f9c106eea

diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx
index 9e1813f..e1d5c62 100644
--- a/svtools/inc/pch/precompiled_svt.hxx
+++ b/svtools/inc/pch/precompiled_svt.hxx
@@ -381,7 +381,6 @@
 #include <tools/shl.hxx>
 #include <tools/solar.h>
 #include <tools/stream.hxx>
-#include <tools/string.hxx>
 #include <tools/tenccvt.hxx>
 #include <tools/time.hxx>
 #include <tools/urlobj.hxx>
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index b8076fe..b892cc4 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -22,7 +22,6 @@
 #include <stdio.h>
 #include <comphelper/string.hxx>
 #include <tools/stream.hxx>
-#include <tools/string.hxx>
 #include <tools/debug.hxx>
 #include <tools/color.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -783,8 +782,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak )
 
         default:
             bEqSignFound = false;
-            if( (nNextCh==cBreak && !cQuote) ||
-                (sal_uLong(aToken.getLength()) + MAX_LEN) > sal_uLong(STRING_MAXLEN & ~1 ))
+            if (nNextCh == cBreak && !cQuote)
                 bContinue = false;
             else
             {
@@ -794,12 +792,6 @@ int HTMLParser::ScanText( const sal_Unicode cBreak )
                     if( MAX_LEN == sTmpBuffer.getLength() )
                     {
                         aToken += sTmpBuffer.makeStringAndClear();
-                        if( (sal_uLong(aToken.getLength()) + MAX_LEN) >
-                                sal_uLong(STRING_MAXLEN & ~1 ) )
-                        {
-                            nNextCh = GetNextChar();
-                            return HTML_TEXTTOKEN;
-                        }
                     }
                     if( ( sal_Unicode(EOF) == (nNextCh = GetNextChar()) &&
                           rInput.IsEof() ) ||
commit ba4a888ea78a7ffd061f4ce8f35454778c036ea5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 14 09:47:52 2014 +0000

    xub_StrLen->sal_Size
    
    Change-Id: Iac6b7a01dd35fb6bb350644235409c4019a0a086

diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index a2586fc..808f131 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -1972,7 +1972,7 @@ void BrokenRecoveryDialog::impl_askForSavePath()
 
                     if ( ::osl::FileBase::E_None == result )
                     {
-                        OString  aTemp( aBuffer, static_cast< xub_StrLen >( aBytesRead ) );
+                        OString aTemp(aBuffer, static_cast<sal_Size>(aBytesRead));
                         aContent += aTemp;
                     }
                 } while ( ::osl::FileBase::E_None == result && aBytesRead );
commit 46d5aa65b015f19e45b4caeebe4aeee4acdb59c8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 14 09:46:00 2014 +0000

    longparas: xub_Strlen->sal_Int32
    
    Change-Id: Ib33b2a36e7fcd96ca9e5deff19e1d2d18aebd012

diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx
index 6aa63bc..00d0263 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -47,7 +47,6 @@
 #include <vcl/unohelp.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/viewsh.hxx>
-#include <tools/string.hxx>
 
 //------------------------------------------------------------------------
 //
@@ -671,12 +670,12 @@ namespace accessibility
                                this, aSelection.nEndPos, maLastSelection.nEndPos, aSelection.nEndPara, maLastSelection.nEndPara);
 
                     // #108947# Sort new range before calling FireEvent
-                    ::std::pair< xub_StrLen, xub_StrLen > sortedSelection(
+                    ::std::pair<sal_Int32, sal_Int32> sortedSelection(
                         makeSortedPair(::std::min( aSelection.nStartPara, nMaxValidParaIndex ),
                                        ::std::min( aSelection.nEndPara, nMaxValidParaIndex ) ) );
 
                     // #108947# Sort last range before calling FireEvent
-                    ::std::pair< xub_StrLen, xub_StrLen > sortedLastSelection(
+                    ::std::pair<sal_Int32, sal_Int32> sortedLastSelection(
                         makeSortedPair(::std::min( maLastSelection.nStartPara, nMaxValidParaIndex ),
                                        ::std::min( maLastSelection.nEndPara, nMaxValidParaIndex ) ) );
 
@@ -741,18 +740,18 @@ namespace accessibility
                                 else
                                 {
                                     // check for changed selection on paragraph <nPara>
-                                    const xub_StrLen nParaStartPos =
+                                    const sal_Int32 nParaStartPos =
                                             nPara == aTmpSel.nStartPara
                                             ? aTmpSel.nStartPos : 0;
-                                    const xub_StrLen nParaEndPos =
+                                    const sal_Int32 nParaEndPos =
                                             nPara == aTmpSel.nEndPara
-                                            ? aTmpSel.nEndPos : STRING_LEN;
-                                    const xub_StrLen nLastParaStartPos =
+                                            ? aTmpSel.nEndPos : -1;
+                                    const sal_Int32 nLastParaStartPos =
                                             nPara == aTmpLastSel.nStartPara
                                             ? aTmpLastSel.nStartPos : 0;
-                                    const xub_StrLen nLastParaEndPos =
+                                    const sal_Int32 nLastParaEndPos =
                                             nPara == aTmpLastSel.nEndPara
-                                            ? aTmpLastSel.nEndPos : STRING_LEN;
+                                            ? aTmpLastSel.nEndPos : -1;
                                     if ( nParaStartPos != nLastParaStartPos ||
                                          nParaEndPos != nLastParaEndPos )
                                     {
commit eded6f196058a1557a5cae62733a5aa67077ce10
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 14 09:40:50 2014 +0000

    longparas: expand STRING_LEN to text length locally
    
    Change-Id: I9ffdabdc44677033d8c8ac1b025ccb7c600db664

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 2e9e5f4..1d3e30e 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -24,7 +24,6 @@
 #include <vector>
 #include <osl/endian.h>
 #include <tools/solar.h>
-#include <tools/string.hxx>
 #include <rtl/math.hxx>
 
 #include <comphelper/classids.hxx>
@@ -4353,7 +4352,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
                                 sal_Bool bCreateNewParaObject = sal_False;
                                 for ( i = 0; i < nParagraphs; i++ )
                                 {
-                                    sal_Bool bIsRTL = aVirDev.GetTextIsRTL( rOutliner.GetText( rOutliner.GetParagraph( i ) ), 0, STRING_LEN );
+                                    OUString aString(rOutliner.GetText(rOutliner.GetParagraph(i)));
+                                    bool bIsRTL = aVirDev.GetTextIsRTL(aString, 0, aString.getLength());
                                     if ( bIsRTL )
                                     {
                                         SfxItemSet aSet2( rOutliner.GetParaAttribs( i ) );
commit a932e780600e9cbd1d6e31348889e9350ccd3cf0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 14 09:36:56 2014 +0000

    longparas: remove now broken STRING_LEN uses
    
    Change-Id: I89799855925b7c246262ae56c2637e20e51cffee

diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx
index 3988cfb..21c60e7 100644
--- a/slideshow/source/engine/shapes/gdimtftools.cxx
+++ b/slideshow/source/engine/shapes/gdimtftools.cxx
@@ -21,7 +21,6 @@
 // must be first
 #include <canvas/debug.hxx>
 #include <tools/diagnose_ex.h>
-#include <tools/string.hxx>
 #include <gdimtftools.hxx>
 
 #include <com/sun/star/document/XExporter.hpp>
@@ -241,20 +240,20 @@ sal_Int32 getNextActionOffset( MetaAction * pCurrAct )
     switch (pCurrAct->GetType()) {
     case META_TEXT_ACTION: {
         MetaTextAction * pAct = static_cast<MetaTextAction *>(pCurrAct);
-        return (pAct->GetLen() == (sal_uInt16)STRING_LEN
-                ? pAct->GetText().getLength() - pAct->GetIndex() : pAct->GetLen());
+        sal_Int32 nLen = std::min(pAct->GetLen(), pAct->GetText().getLength() - pAct->GetIndex());
+        return nLen;
     }
     case META_TEXTARRAY_ACTION: {
         MetaTextArrayAction * pAct =
             static_cast<MetaTextArrayAction *>(pCurrAct);
-        return (pAct->GetLen() == (sal_uInt16)STRING_LEN
-                ? pAct->GetText().getLength() - pAct->GetIndex() : pAct->GetLen());
+        sal_Int32 nLen = std::min(pAct->GetLen(), pAct->GetText().getLength() - pAct->GetIndex());
+        return nLen;
     }
     case META_STRETCHTEXT_ACTION: {
         MetaStretchTextAction * pAct =
             static_cast<MetaStretchTextAction *>(pCurrAct);
-        return (pAct->GetLen() == (sal_uInt16)STRING_LEN
-                ? pAct->GetText().getLength() - pAct->GetIndex() : pAct->GetLen());
+        sal_Int32 nLen = std::min(pAct->GetLen(), pAct->GetText().getLength() - pAct->GetIndex());
+        return nLen;
     }
     case META_FLOATTRANSPARENT_ACTION: {
         MetaFloatTransparentAction * pAct =


More information about the Libreoffice-commits mailing list