[Libreoffice-commits] core.git: 5 commits - basic/source include/sal sc/source sot/source svl/source tools/source vcl/unx

Michael Stahl mstahl at redhat.com
Sun Mar 30 13:46:20 PDT 2014


 basic/source/runtime/iosys.cxx                |    2 ++
 include/sal/log-areas.dox                     |    4 ++++
 sc/source/filter/excel/xistream.cxx           |    1 -
 sot/source/sdstor/stgdir.cxx                  |    3 ++-
 sot/source/sdstor/stgstrms.cxx                |    7 +++----
 sot/source/sdstor/ucbstorage.cxx              |    3 +++
 svl/source/misc/strmadpt.cxx                  |    4 ++++
 tools/source/stream/stream.cxx                |    7 ++++++-
 tools/source/stream/strmunx.cxx               |    2 ++
 tools/source/stream/strmwnt.cxx               |    2 ++
 vcl/unx/kde4/tst_exclude_socket_notifiers.hxx |    2 +-
 11 files changed, 29 insertions(+), 8 deletions(-)

New commits:
commit 0dd6d4ed6ce66cdff14688d7acdf81992e86e64f
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Mar 29 21:45:44 2014 +0100

    kde4: loplugin:saloverride
    
    Change-Id: I3d299a5dc98ff2775d36c839363461b727a512d9

diff --git a/vcl/unx/kde4/tst_exclude_socket_notifiers.hxx b/vcl/unx/kde4/tst_exclude_socket_notifiers.hxx
index 0c874fd..01f01b9 100644
--- a/vcl/unx/kde4/tst_exclude_socket_notifiers.hxx
+++ b/vcl/unx/kde4/tst_exclude_socket_notifiers.hxx
@@ -95,7 +95,7 @@ class SocketTestThread : public QThread
     Q_OBJECT
 public:
     SocketTestThread():QThread(0),testResult(false){};
-    void run()
+    virtual void run() SAL_OVERRIDE
     {
         SocketEventsTester *tester = new SocketEventsTester();
         if (tester->init())
commit a6f0f4156e1484f9ee2566b814fd0c18b88d94d3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sun Mar 30 22:26:13 2014 +0200

    sot: convert that to SAL_INFO
    
    Change-Id: Iaf2de623c0893b0f500d54ce6558bf40af6e655b

diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 60a6aac..88ca865 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -266,6 +266,10 @@ certain functionality.
 @li @c slideshow.eventqueue
 @li @c slideshow.opengl
 
+ at section sot
+
+ at li @c sot - COM structured storage
+
 @section svl
 
 @li @c svl
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index c027867..6aed09b 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -416,7 +416,8 @@ sal_Int32 StgDirEntry::Seek( sal_Int32 nNew )
         {
             if ( !( nMode & STREAM_WRITE ) || !SetSize( nNew ) )
             {
-                OSL_ENSURE( nMode & STREAM_WRITE, "Trying to resize readonly stream by seeking, could be a wrong offset!" );
+                SAL_WARN_IF(!(nMode & STREAM_WRITE), "sot",
+                    "Trying to resize readonly stream by seeking, could be a wrong offset: " << nNew);
                 return nPos;
             }
             else
commit b3e52299c91d7f2ef16280fa2a0f5c4c6be37f6e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sun Mar 30 22:38:42 2014 +0200

    tools, sc: fix GCC -Werror=type-limits (comparison is always true)
    
    ... on 32 bit platforms.  These asserts appear to be impossible anyway.
    
    Change-Id: I6bd332ca49e9992740315e0f6c58e98ac337817c

diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx
index 5f98314..d31268c 100644
--- a/sc/source/filter/excel/xistream.cxx
+++ b/sc/source/filter/excel/xistream.cxx
@@ -430,7 +430,6 @@ XclImpStream::XclImpStream( SvStream& rInStrm, const XclImpRoot& rRoot, bool bCo
     mrStrm.Seek( STREAM_SEEK_TO_END );
     mnStreamSize = mrStrm.Tell();
     mrStrm.Seek( STREAM_SEEK_TO_BEGIN );
-    OSL_ENSURE( mnStreamSize < STREAM_SEEK_TO_END, "XclImpStream::XclImpStream - stream error" );
 }
 
 XclImpStream::~XclImpStream()
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 9921d6f..a8ce39c 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1769,7 +1769,6 @@ void* SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount,
 
     ResetError();
 
-    DBG_ASSERT( nEndOfData<STREAM_SEEK_TO_END,"Invalid EOF");
     return pResult;
 }
 
commit ba46f32c804e665741a6db6f2578a01045304d14
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sun Mar 30 22:31:53 2014 +0200

    deploy some asserts to detect truncated STREAM_SEEK_TO_END
    
    Since STREAM_SEEK_TO_END is now 64 bits it could happen that some
    existing code uses it in some indirect manner and it gets truncated to
    32 bits somewhere (on 32 bit platforms); try to detect that with asserts.
    
    Of course the checked value is now a valid stream position, so
    perhaps the checks should eventually be removed.
    
    Change-Id: I4248c00d758220bdc3ee94c7aa7a7bd4c86c57f0

diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 940d6d5..43942b8 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -374,6 +374,8 @@ sal_Size OslStream::PutData(const void* pData, sal_Size nSize)
 sal_uInt64 OslStream::SeekPos( sal_uInt64 nPos )
 {
     ::osl::FileBase::RC rc = ::osl::FileBase::E_None;
+    // check if a truncated STREAM_SEEK_TO_END was passed
+    assert(nPos != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END);
     if( nPos == STREAM_SEEK_TO_END )
     {
         rc = maFile.setPos( osl_Pos_End, 0 );
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index fcd19613..214b32e 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -1283,6 +1283,8 @@ sal_uLong StgTmpStrm::PutData( const void* pData, sal_uLong n )
 
 sal_uInt64 StgTmpStrm::SeekPos(sal_uInt64 n)
 {
+    // check if a truncated STREAM_SEEK_TO_END was passed
+    assert(n != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END);
     if( n == STREAM_SEEK_TO_END )
         n = GetSize();
     if( n && n > THRESHOLD && !pStrm )
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 8c0be29..deb5303 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -941,6 +941,9 @@ sal_uLong UCBStorageStream_Impl::PutData( const void* pData, sal_uLong nSize )
 
 sal_uInt64 UCBStorageStream_Impl::SeekPos(sal_uInt64 const nPos)
 {
+    // check if a truncated STREAM_SEEK_TO_END was passed
+    assert(nPos != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END);
+
     if( !Init() )
         return 0;
 
diff --git a/svl/source/misc/strmadpt.cxx b/svl/source/misc/strmadpt.cxx
index a55a0fa..bc7eaac 100644
--- a/svl/source/misc/strmadpt.cxx
+++ b/svl/source/misc/strmadpt.cxx
@@ -448,6 +448,8 @@ sal_uLong SvInputStream::GetData(void * pData, sal_uLong nSize)
         SetError(ERRCODE_IO_CANTREAD);
         return 0;
     }
+    // check if a truncated STREAM_SEEK_TO_END was passed
+    assert(m_nSeekedFrom != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END);
     sal_uInt32 nRead = 0;
     if (m_xSeekable.is())
     {
@@ -548,6 +550,8 @@ void SvInputStream::FlushData()
 // virtual
 sal_uInt64 SvInputStream::SeekPos(sal_uInt64 const nPos)
 {
+    // check if a truncated STREAM_SEEK_TO_END was passed
+    assert(nPos != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END);
     if (open())
     {
         if (nPos == STREAM_SEEK_TO_END)
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 48cae55..9921d6f 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -308,6 +308,8 @@ ErrCode SvAsyncLockBytes::FillAppend(const void * pBuffer, sal_Size nCount,
 // virtual
 sal_uInt64 SvAsyncLockBytes::Seek(sal_uInt64 const nPos)
 {
+    // check if a truncated STREAM_SEEK_TO_END was passed
+    assert(nPos != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END);
     if (nPos != STREAM_SEEK_TO_END)
         m_nSize = nPos;
     return m_nSize;
@@ -343,6 +345,8 @@ sal_Size SvStream::PutData( const void* pData, sal_Size nSize )
 
 sal_uInt64 SvStream::SeekPos(sal_uInt64 const nPos)
 {
+    // check if a truncated STREAM_SEEK_TO_END was passed
+    assert(nPos != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END);
     if( !GetError() && nPos == STREAM_SEEK_TO_END )
     {
         DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
@@ -1839,6 +1843,8 @@ sal_uInt64 SvMemoryStream::SeekPos(sal_uInt64 const nNewPos)
     // nEndOfData: First position in stream not allowed to read from
     // nSize: Size of allocated buffer
 
+    // check if a truncated STREAM_SEEK_TO_END was passed
+    assert(nNewPos != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END);
     if( nNewPos < nEndOfData )
         nPos = nNewPos;
     else if( nNewPos == STREAM_SEEK_TO_END )
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 010bcc6..c3144ed 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -358,6 +358,8 @@ sal_Size SvFileStream::PutData( const void* pData, sal_Size nSize )
 
 sal_uInt64 SvFileStream::SeekPos(sal_uInt64 const nPos)
 {
+    // check if a truncated STREAM_SEEK_TO_END was passed
+    assert(nPos != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END);
     if ( IsOpen() )
     {
         oslFileError rc;
diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx
index d5f519f..ad4f133 100644
--- a/tools/source/stream/strmwnt.cxx
+++ b/tools/source/stream/strmwnt.cxx
@@ -162,6 +162,8 @@ sal_Size SvFileStream::PutData( const void* pData, sal_Size nSize )
 
 sal_uInt64 SvFileStream::SeekPos(sal_uInt64 const nPos)
 {
+    // check if a truncated STREAM_SEEK_TO_END was passed
+    assert(nPos != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END);
     DWORD nNewPos = 0;
     if( IsOpen() )
     {
commit 1b40966fd0dd7e30c9fff40cc0dfcc15c3456221
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sun Mar 30 22:22:26 2014 +0200

    sot: fix some bizarre resize code that creates 4G temp files on 32bit
    
    StgTmpStrm::SetSize(): the nEndOfData - 1 may underflow if nEndOfData=0
    which happened to be the same value of STREAM_SEEK_TO_END before
    but not any more; also it's a mystery to me why the last byte in the
    buffer would need to be overwritten with 0 here.
    
    This also fixes the failure of ww8_export test.
    
    Change-Id: Iefe5a22c667ee83fbc315d772f357b913105ad93

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 680daf2..fcd19613 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -1241,10 +1241,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n)
         {
             if( n > nEndOfData )
             {
-                sal_uInt64 nCur = Tell();
-                Seek( nEndOfData - 1 );
-                WriteUChar( (sal_uInt8) 0 );
-                Seek( nCur );
+                SvMemoryStream::SetSize(n);
             }
             else
                 nEndOfData = n;


More information about the Libreoffice-commits mailing list