[Libreoffice-commits] core.git: io/source io/test

2023-05-27 Thread Mike Kaganski (via logerrit)
 io/source/stm/opump.cxx  |4 ++--
 io/test/stm/datatest.cxx |9 +++--
 io/test/stm/marktest.cxx |6 ++
 io/test/stm/pipetest.cxx |4 +---
 4 files changed, 8 insertions(+), 15 deletions(-)

New commits:
commit 87276a497d9aa8a3f8ac0bfceb75d64938945f9a
Author: Mike Kaganski 
AuthorDate: Sun Apr 23 20:14:07 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat May 27 18:08:00 2023 +0200

Use getXWeak in io

Change-Id: If2b40ecdca67c6d82ff1a87443cb8533401e9ae8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150856
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/io/source/stm/opump.cxx b/io/source/stm/opump.cxx
index fc751b677f95..df3e6132319d 100644
--- a/io/source/stm/opump.cxx
+++ b/io/source/stm/opump.cxx
@@ -263,14 +263,14 @@ void Pump::run()
 
 if( ! rInput.is() )
 {
-throw NotConnectedException( "no input stream set", 
static_cast(this) );
+throw NotConnectedException( "no input stream set", getXWeak() 
);
 }
 Sequence< sal_Int8 > aData;
 while( rInput->readSomeBytes( aData, 65536 ) )
 {
 if( ! rOutput.is() )
 {
-throw NotConnectedException( "no output stream set", 
static_cast(this) );
+throw NotConnectedException( "no output stream set", 
getXWeak() );
 }
 rOutput->writeBytes( aData );
 osl_yieldThread();
diff --git a/io/test/stm/datatest.cxx b/io/test/stm/datatest.cxx
index a085bf6d7d5b..ef31f099d496 100644
--- a/io/test/stm/datatest.cxx
+++ b/io/test/stm/datatest.cxx
@@ -326,8 +326,7 @@ void ODataStreamTest::testSimple(   const Reference < 
XDataInputStream > 
 **/
 Reference < XInterface > SAL_CALL ODataStreamTest_CreateInstance( const 
Reference < XMultiServiceFactory > & rSMgr ) throw(Exception)
 {
-ODataStreamTest *p = new ODataStreamTest( rSMgr );
-return Reference < XInterface > ( (static_cast< OWeakObject *  >(p)) );
+return getXWeak(new ODataStreamTest( rSMgr ));
 }
 
 Sequence ODataStreamTest_getSupportedServiceNames( int i) throw ()
@@ -596,8 +595,7 @@ Reference < XInterface > SAL_CALL 
OMyPersistObject_CreateInstance(
 const Reference < XMultiServiceFactory > & rSMgr )
 throw(Exception)
 {
-MyPersistObject *p = new MyPersistObject( );
-return Reference < XInterface > ( (static_cast< OWeakObject *  >(p)) );
+return getXWeak(new MyPersistObject( ));
 }
 
 Sequence OMyPersistObject_getSupportedServiceNames( ) throw ()
@@ -1040,8 +1038,7 @@ void OObjectStreamTest::testObject( const Reference<  
XObjectOutputStream >
 
 Reference < XInterface > SAL_CALL OObjectStreamTest_CreateInstance( const 
Reference < XMultiServiceFactory > & rSMgr ) throw(Exception)
 {
-OObjectStreamTest *p = new OObjectStreamTest( rSMgr );
-return Reference < XInterface > ( (static_cast< OWeakObject *  >(p)) );
+return getXWeak(new OObjectStreamTest( rSMgr ));
 }
 
 Sequence OObjectStreamTest_getSupportedServiceNames( int i) throw ()
diff --git a/io/test/stm/marktest.cxx b/io/test/stm/marktest.cxx
index fbfc2008214f..0dd01a7f7747 100644
--- a/io/test/stm/marktest.cxx
+++ b/io/test/stm/marktest.cxx
@@ -360,8 +360,7 @@ void OMarkableOutputStreamTest::testSimple( const 
Reference< XOutputStream >
 **/
 Reference < XInterface > SAL_CALL OMarkableOutputStreamTest_CreateInstance( 
const Reference< XMultiServiceFactory > & rSMgr ) throw(Exception)
 {
-OMarkableOutputStreamTest *p = new OMarkableOutputStreamTest( rSMgr );
-return Reference < XInterface > ( (static_cast< OWeakObject *  >(p)) );
+return getXWeak(new OMarkableOutputStreamTest( rSMgr ));
 }
 
 
@@ -619,8 +618,7 @@ void OMarkableInputStreamTest::testSimple(  const 
Reference< XOutputStream >
 **/
 Reference < XInterface > SAL_CALL OMarkableInputStreamTest_CreateInstance( 
const Reference< XMultiServiceFactory > & rSMgr ) throw(Exception)
 {
-OMarkableInputStreamTest *p = new OMarkableInputStreamTest( rSMgr );
-return Reference < XInterface > ( (static_cast< OWeakObject *  >(p)) );
+return getXWeak(new OMarkableInputStreamTest( rSMgr ));
 }
 
 
diff --git a/io/test/stm/pipetest.cxx b/io/test/stm/pipetest.cxx
index 46637f3f245a..da5c5f20ba49 100644
--- a/io/test/stm/pipetest.cxx
+++ b/io/test/stm/pipetest.cxx
@@ -392,9 +392,7 @@ void OPipeTest::testMultithreading( const Reference < 
XInterface >  )
 **/
 Reference < XInterface > SAL_CALL OPipeTest_CreateInstance( const Reference< 
XMultiServiceFactory>  & rSMgr ) throw (Exception)
 {
-OPipeTest *p = new OPipeTest( rSMgr );
-Reference< XInterface > x ( (static_cast< OWeakObject *  >(p)) );
-return x;
+return getXWeak(new OPipeTest( rSMgr ));
 }
 
 


[Libreoffice-commits] core.git: io/source

2023-03-14 Thread Baole Fang (via logerrit)
 io/source/TextInputStream/TextInputStream.cxx |   18 ++
 1 file changed, 18 insertions(+)

New commits:
commit 16242898da50fbf680df558cb47d1978c3304572
Author: Baole Fang 
AuthorDate: Mon Mar 13 18:34:50 2023 -0400
Commit: Noel Grandin 
CommitDate: Tue Mar 14 06:47:26 2023 +

tdf#150135: Fix OTextInputStream to throw runtime exception when 
uninitialized

New method checkNull is added to the class to throw a runtime error if 
mxStream is uninitialized. It is run in the beginning of all methods that 
require an initialized mxStream.

Change-Id: Ia1f15d90c79c71b2a2350d9b60ef1bf68fb9009c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148819
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/io/source/TextInputStream/TextInputStream.cxx 
b/io/source/TextInputStream/TextInputStream.cxx
index 9f7c884725cd..1ce12a6e796e 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -72,6 +72,8 @@ class OTextInputStream : public WeakImplHelper< 
XTextInputStream2, XServiceInfo
 /// @throws IOException
 /// @throws RuntimeException
 sal_Int32 implReadNext();
+/// @throws RuntimeException
+void checkNull();
 
 public:
 OTextInputStream();
@@ -122,22 +124,33 @@ OTextInputStream::~OTextInputStream()
 }
 }
 
+// Check uninitialized object
+
+void OTextInputStream::checkNull()
+{
+if (mxStream==nullptr){
+throw RuntimeException("Uninitialized object");
+}
+}
 
 // XTextInputStream
 
 OUString OTextInputStream::readLine(  )
 {
+checkNull();
 static Sequence< sal_Unicode > aDummySeq;
 return implReadString( aDummySeq, true, true );
 }
 
 OUString OTextInputStream::readString( const Sequence< sal_Unicode >& 
Delimiters, sal_Bool bRemoveDelimiter )
 {
+checkNull();
 return implReadString( Delimiters, bRemoveDelimiter, false );
 }
 
 sal_Bool OTextInputStream::isEOF()
 {
+checkNull();
 bool bRet = false;
 if( mnCharsInBuffer == 0 && mbReachedEOF )
 bRet = true;
@@ -337,26 +350,31 @@ void OTextInputStream::setEncoding( const OUString& 
Encoding )
 
 sal_Int32 OTextInputStream::readBytes( Sequence< sal_Int8 >& aData, sal_Int32 
nBytesToRead )
 {
+checkNull();
 return mxStream->readBytes( aData, nBytesToRead );
 }
 
 sal_Int32 OTextInputStream::readSomeBytes( Sequence< sal_Int8 >& aData, 
sal_Int32 nMaxBytesToRead )
 {
+checkNull();
 return mxStream->readSomeBytes( aData, nMaxBytesToRead );
 }
 
 void OTextInputStream::skipBytes( sal_Int32 nBytesToSkip )
 {
+checkNull();
 mxStream->skipBytes( nBytesToSkip );
 }
 
 sal_Int32 OTextInputStream::available(  )
 {
+checkNull();
 return mxStream->available();
 }
 
 void OTextInputStream::closeInput(  )
 {
+checkNull();
 mxStream->closeInput();
 }
 


[Libreoffice-commits] core.git: io/source

2022-09-11 Thread Noel Grandin (via logerrit)
 io/source/stm/omark.cxx |   15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 5bb826373f766a0ec105406a98d5529e2c360e8c
Author: Noel Grandin 
AuthorDate: Sat Sep 10 19:17:43 2022 +0200
Commit: Noel Grandin 
CommitDate: Sun Sep 11 21:47:48 2022 +0200

no need to allocate MemRingBuffer separately in OMarkableOutputStream

Change-Id: I80d64f18480a2c078caeaa161f55767f66021253
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139781
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx
index 3991e2c9d966..d4bf6c74169a 100644
--- a/io/source/stm/omark.cxx
+++ b/io/source/stm/omark.cxx
@@ -115,7 +115,7 @@ private:
 Reference< XOutputStream >  m_output;
 bool m_bValidStream;
 
-std::unique_ptr m_pBuffer;
+MemRingBuffer m_aRingBuffer;
 map > m_mapMarks;
 sal_Int32 m_nCurrentPos;
 sal_Int32 m_nCurrentMark;
@@ -127,7 +127,6 @@ private:
 
 OMarkableOutputStream::OMarkableOutputStream( )
 : m_bValidStream(false)
-, m_pBuffer( new MemRingBuffer )
 , m_nCurrentPos(0)
 , m_nCurrentMark(0)
 {
@@ -139,14 +138,14 @@ void OMarkableOutputStream::writeBytes(const Sequence< 
sal_Int8 >& aData)
 if( !m_bValidStream ) {
 throw NotConnectedException();
 }
-if( m_mapMarks.empty() && ( m_pBuffer->getSize() == 0 ) ) {
+if( m_mapMarks.empty() && ( m_aRingBuffer.getSize() == 0 ) ) {
 // no mark and  buffer active, simple write through
 m_output->writeBytes( aData );
 }
 else {
 std::unique_lock guard( m_mutex );
 // new data must be buffered
-m_pBuffer->writeAt( m_nCurrentPos , aData );
+m_aRingBuffer.writeAt( m_nCurrentPos , aData );
 m_nCurrentPos += aData.getLength();
 checkMarksAndFlush();
 }
@@ -179,7 +178,7 @@ void OMarkableOutputStream::closeOutput()
 // all marks must be cleared and all
 
 m_mapMarks.clear();
-m_nCurrentPos = m_pBuffer->getSize();
+m_nCurrentPos = m_aRingBuffer.getSize();
 checkMarksAndFlush();
 
 m_output->closeOutput();
@@ -232,7 +231,7 @@ void OMarkableOutputStream::jumpToMark(sal_Int32 nMark)
 void OMarkableOutputStream::jumpToFurthest()
 {
 std::unique_lock guard( m_mutex );
-m_nCurrentPos = m_pBuffer->getSize();
+m_nCurrentPos = m_aRingBuffer.getSize();
 checkMarksAndFlush();
 }
 
@@ -328,8 +327,8 @@ void OMarkableOutputStream::checkMarksAndFlush()
 }
 
 Sequence seq(nNextFound);
-m_pBuffer->readAt( 0 , seq , nNextFound );
-m_pBuffer->forgetFromStart( nNextFound );
+m_aRingBuffer.readAt( 0 , seq , nNextFound );
+m_aRingBuffer.forgetFromStart( nNextFound );
 
 // now write data through to streams
 m_output->writeBytes( seq );


[Libreoffice-commits] core.git: io/source

2022-06-21 Thread Chris Sherlock (via logerrit)
 io/source/stm/odata.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 2bf296ddd10f0a56bdf799712bac1ccb10ed8b72
Author: Chris Sherlock 
AuthorDate: Mon Jun 13 17:09:08 2022 +1000
Commit: Stephan Bergmann 
CommitDate: Tue Jun 21 21:16:26 2022 +0200

io: drop unnecessary cast

Change-Id: Iaceab1b85e41dbb2102fe829f7abc2f8e3898a52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135693
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/io/source/stm/odata.cxx b/io/source/stm/odata.cxx
index 754cda450a94..7d39a5835852 100644
--- a/io/source/stm/odata.cxx
+++ b/io/source/stm/odata.cxx
@@ -25,7 +25,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -1094,7 +1093,7 @@ Reference< XPersistObject >  
OObjectInputStream::readObject()
 {
 // grow to the right size
 Reference< XPersistObject > xEmpty;
-m_aPersistVector.insert( m_aPersistVector.end(), 
static_cast(nId - nSize + 1), xEmpty );
+m_aPersistVector.insert( m_aPersistVector.end(), nId - 
nSize + 1, xEmpty );
 }
 
 m_aPersistVector[nId] = xLoadedObj;


[Libreoffice-commits] core.git: io/source javaunohelper/source jvmfwk/plugins jvmfwk/source

2022-06-21 Thread Noel Grandin (via logerrit)
 io/source/acceptor/acc_pipe.cxx |   13 +++--
 io/source/acceptor/acc_socket.cxx   |   15 ---
 io/source/acceptor/acceptor.hxx |6 +++---
 io/source/connector/connector.hxx   |4 ++--
 io/source/connector/ctr_pipe.cxx|5 +++--
 io/source/connector/ctr_socket.cxx  |5 +++--
 javaunohelper/source/vm.cxx |5 +++--
 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx |4 ++--
 jvmfwk/plugins/sunmajor/pluginlib/util.hxx  |5 +++--
 jvmfwk/source/framework.hxx |5 +++--
 10 files changed, 37 insertions(+), 30 deletions(-)

New commits:
commit 49fdae5bb4f584d26cea958e554678154bedf379
Author: Noel Grandin 
AuthorDate: Tue Jun 21 10:18:15 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Jun 21 12:59:41 2022 +0200

clang-tidy modernize-pass-by-value in io..jvmfwk

Change-Id: I6e19d4d03957c35caa79a231927eae04ae630442
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136209
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/io/source/acceptor/acc_pipe.cxx b/io/source/acceptor/acc_pipe.cxx
index db43c58db103..c3af874498de 100644
--- a/io/source/acceptor/acc_pipe.cxx
+++ b/io/source/acceptor/acc_pipe.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::osl;
 using namespace ::cppu;
@@ -43,7 +44,7 @@ namespace io_acceptor
 public WeakImplHelper< XConnection >
 {
 public:
-explicit PipeConnection( const OUString );
+explicit PipeConnection( OUString sConnectionDescription);
 
 virtual sal_Int32 SAL_CALL read( Sequence< sal_Int8 >& aReadBytes, 
sal_Int32 nBytesToRead ) override;
 virtual void SAL_CALL write( const Sequence< sal_Int8 >& aData ) 
override;
@@ -58,9 +59,9 @@ namespace io_acceptor
 
 }
 
-PipeConnection::PipeConnection( const OUString ) :
+PipeConnection::PipeConnection( OUString sConnectionDescription) :
 m_nStatus( 0 ),
-m_sDescription( sConnectionDescription )
+m_sDescription(std::move( sConnectionDescription ))
 {
 // make it unique
 m_sDescription += ",uniqueValue=";
@@ -121,9 +122,9 @@ namespace io_acceptor
 /***
  * PipeAcceptor
  **/
-PipeAcceptor::PipeAcceptor( const OUString  , const OUString & 
sConnectionDescription) :
-m_sPipeName( sPipeName ),
-m_sConnectionDescription( sConnectionDescription ),
+PipeAcceptor::PipeAcceptor( OUString sPipeName , OUString 
sConnectionDescription) :
+m_sPipeName(std::move( sPipeName )),
+m_sConnectionDescription(std::move( sConnectionDescription )),
 m_bClosed( false )
 {
 }
diff --git a/io/source/acceptor/acc_socket.cxx 
b/io/source/acceptor/acc_socket.cxx
index d52fdc423bdf..c211acdc3ab5 100644
--- a/io/source/acceptor/acc_socket.cxx
+++ b/io/source/acceptor/acc_socket.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::osl;
 using namespace ::cppu;
@@ -49,7 +50,7 @@ namespace io_acceptor {
 
 {
 public:
-explicit SocketConnection( const OUString & sConnectionDescription );
+explicit SocketConnection( OUString sConnectionDescription );
 
 virtual sal_Int32 SAL_CALL read( css::uno::Sequence< sal_Int8 >& 
aReadBytes,
  sal_Int32 nBytesToRead ) override;
@@ -129,9 +130,9 @@ namespace io_acceptor {
 }
 
 
-SocketConnection::SocketConnection( const OUString 
) :
+SocketConnection::SocketConnection( OUString sConnectionDescription) :
 m_nStatus( 0 ),
-m_sDescription( sConnectionDescription ),
+m_sDescription(std::move( sConnectionDescription )),
 _started(false),
 _closed(false),
 _error(false)
@@ -264,12 +265,12 @@ namespace io_acceptor {
 _listeners.erase(aListener);
 }
 
-SocketAcceptor::SocketAcceptor( const OUString ,
+SocketAcceptor::SocketAcceptor( OUString sSocketName,
 sal_uInt16 nPort,
 bool bTcpNoDelay,
-const OUString ) :
-m_sSocketName( sSocketName ),
-m_sConnectionDescription( sConnectionDescription ),
+OUString sConnectionDescription) :
+m_sSocketName(std::move( sSocketName )),
+m_sConnectionDescription(std::move( sConnectionDescription )),
 m_nPort( nPort ),
 m_bTcpNoDelay( bTcpNoDelay ),
 m_bClosed( false )
diff --git a/io/source/acceptor/acceptor.hxx b/io/source/acceptor/acceptor.hxx
index 9214a10b7509..9dc3690166cc 100644
--- a/io/source/acceptor/acceptor.hxx
+++ b/io/source/acceptor/acceptor.hxx
@@ -32,7 +32,7 @@ namespace io_acceptor {
 class PipeAcceptor
 {
 public:
-

[Libreoffice-commits] core.git: io/source

2022-05-08 Thread Noel Grandin (via logerrit)
 io/source/stm/opump.cxx |   64 +++-
 1 file changed, 36 insertions(+), 28 deletions(-)

New commits:
commit 34948e67772b4b27f47c4871b7428a0e3306d770
Author: Noel Grandin 
AuthorDate: Sun May 8 13:03:55 2022 +0200
Commit: Noel Grandin 
CommitDate: Sun May 8 20:50:12 2022 +0200

osl::Mutex->std::mutex in Pump

Change-Id: Idb25603ba5659b3d8cabbdddb00df60e43045b52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134020
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/io/source/stm/opump.cxx b/io/source/stm/opump.cxx
index 598d16aa4f61..fc751b677f95 100644
--- a/io/source/stm/opump.cxx
+++ b/io/source/stm/opump.cxx
@@ -30,11 +30,10 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
-#include 
 #include 
-
+#include 
 
 using namespace osl;
 using namespace cppu;
@@ -49,14 +48,14 @@ namespace io_stm {
 class Pump : public WeakImplHelper<
   XActiveDataSource, XActiveDataSink, XActiveDataControl, 
XConnectable, XServiceInfo >
 {
-Mutex   m_aMutex;
+std::mutex  m_aMutex;
 oslThread   m_aThread;
 
 Reference< XConnectable >   m_xPred;
 Reference< XConnectable >   m_xSucc;
 Reference< XInputStream >   m_xInput;
 Reference< XOutputStream >  m_xOutput;
-comphelper::OInterfaceContainerHelper2  m_cnt;
+comphelper::OInterfaceContainerHelper4  m_cnt;
 boolm_closeFired;
 
 void run();
@@ -101,7 +100,6 @@ namespace io_stm {
 }
 
 Pump::Pump() : m_aThread( nullptr ),
-   m_cnt( m_aMutex ),
m_closeFired( false )
 {
 }
@@ -118,12 +116,14 @@ Pump::~Pump()
 
 void Pump::fireError( const  Any & exception )
 {
-comphelper::OInterfaceIteratorHelper2 iter( m_cnt );
+std::unique_lock guard( m_aMutex );
+comphelper::OInterfaceIteratorHelper4 iter( guard, m_cnt 
);
+guard.unlock();
 while( iter.hasMoreElements() )
 {
 try
 {
-static_cast< XStreamListener * > ( iter.next() )->error( exception 
);
+iter.next()->error( exception );
 }
 catch ( const RuntimeException  )
 {
@@ -136,7 +136,7 @@ void Pump::fireClose()
 {
 bool bFire = false;
 {
-MutexGuard guard( m_aMutex );
+std::unique_lock guard( m_aMutex );
 if( ! m_closeFired  )
 {
 m_closeFired = true;
@@ -147,12 +147,14 @@ void Pump::fireClose()
 if( !bFire )
 return;
 
-comphelper::OInterfaceIteratorHelper2 iter( m_cnt );
+std::unique_lock guard( m_aMutex );
+comphelper::OInterfaceIteratorHelper4 iter( guard, m_cnt 
);
+guard.unlock();
 while( iter.hasMoreElements() )
 {
 try
 {
-static_cast< XStreamListener * > ( iter.next() )->closed( );
+iter.next()->closed( );
 }
 catch ( const RuntimeException  )
 {
@@ -163,12 +165,14 @@ void Pump::fireClose()
 
 void Pump::fireStarted()
 {
-comphelper::OInterfaceIteratorHelper2 iter( m_cnt );
+std::unique_lock guard( m_aMutex );
+comphelper::OInterfaceIteratorHelper4 iter( guard, m_cnt 
);
+guard.unlock();
 while( iter.hasMoreElements() )
 {
 try
 {
-static_cast< XStreamListener * > ( iter.next() )->started( );
+iter.next()->started( );
 }
 catch ( const RuntimeException  )
 {
@@ -179,12 +183,14 @@ void Pump::fireStarted()
 
 void Pump::fireTerminated()
 {
-comphelper::OInterfaceIteratorHelper2 iter( m_cnt );
+std::unique_lock guard( m_aMutex );
+comphelper::OInterfaceIteratorHelper4 iter( guard, m_cnt 
);
+guard.unlock();
 while( iter.hasMoreElements() )
 {
 try
 {
-static_cast< XStreamListener * > ( iter.next() )->terminated();
+iter.next()->terminated();
 }
 catch ( const RuntimeException  )
 {
@@ -200,7 +206,7 @@ void Pump::close()
 Reference< XInputStream > rInput;
 Reference< XOutputStream > rOutput;
 {
-MutexGuard guard( m_aMutex );
+std::unique_lock guard( m_aMutex );
 rInput = m_xInput;
 m_xInput.clear();
 
@@ -250,7 +256,7 @@ void Pump::run()
 Reference< XInputStream > rInput;
 Reference< XOutputStream > rOutput;
 {
-Guard< Mutex > aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 rInput = m_xInput;
 rOutput = m_xOutput;
 }
@@ -301,28 +307,28 @@ void Pump::run()
 
 void Pump::setPredecessor( const Reference< XConnectable >& xPred )
 {
-Guard< Mutex > aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 m_xPred = xPred;
 }
 
 
 Reference< XConnectable 

[Libreoffice-commits] core.git: io/source

2022-05-08 Thread Noel Grandin (via logerrit)
 io/source/stm/omark.cxx |   21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

New commits:
commit cb65f89db892c3b0cecbafec77e61292e7d5afe8
Author: Noel Grandin 
AuthorDate: Sun May 8 12:55:59 2022 +0200
Commit: Noel Grandin 
CommitDate: Sun May 8 20:49:47 2022 +0200

osl::Mutex->std::mutex in OMarkableInputStream

Change-Id: I935573e63471e5f38e719df51b3510992347fe09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134019
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx
index 60ec1f9d2f28..3991e2c9d966 100644
--- a/io/source/stm/omark.cxx
+++ b/io/source/stm/omark.cxx
@@ -37,7 +37,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 
@@ -430,7 +429,7 @@ private:
 sal_Int32 m_nCurrentPos;
 sal_Int32 m_nCurrentMark;
 
-Mutex m_mutex;
+std::mutex m_mutex;
 };
 
 }
@@ -455,7 +454,7 @@ sal_Int32 OMarkableInputStream::readBytes(Sequence< 
sal_Int8 >& aData, sal_Int32
 "MarkableInputStream::readBytes NotConnectedException",
 *this );
 }
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 if( m_mapMarks.empty() && ! m_pBuffer->getSize() ) {
 // normal read !
 nBytesRead = m_input->readBytes( aData, nBytesToRead );
@@ -500,7 +499,7 @@ sal_Int32 OMarkableInputStream::readSomeBytes(Sequence< 
sal_Int8 >& aData, sal_I
 *this );
 }
 
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 if( m_mapMarks.empty() && ! m_pBuffer->getSize() ) {
 // normal read !
 nBytesRead = m_input->readSomeBytes( aData, nMaxBytesToRead );
@@ -560,7 +559,7 @@ sal_Int32 OMarkableInputStream::available()
 *this );
 }
 
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 sal_Int32 nAvail = m_input->available() + ( m_pBuffer->getSize() - 
m_nCurrentPos );
 return nAvail;
 }
@@ -573,7 +572,7 @@ void OMarkableInputStream::closeInput()
 "MarkableInputStream::closeInput NotConnectedException",
 *this );
 }
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 
 m_input->closeInput();
 
@@ -590,7 +589,7 @@ void OMarkableInputStream::closeInput()
 
 sal_Int32 OMarkableInputStream::createMark()
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 sal_Int32 nMark = m_nCurrentMark;
 
 m_mapMarks[nMark] = m_nCurrentPos;
@@ -601,7 +600,7 @@ sal_Int32 OMarkableInputStream::createMark()
 
 void OMarkableInputStream::deleteMark(sal_Int32 Mark)
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 map >::iterator ii = m_mapMarks.find( 
Mark );
 
 if( ii == m_mapMarks.end() ) {
@@ -615,7 +614,7 @@ void OMarkableInputStream::deleteMark(sal_Int32 Mark)
 
 void OMarkableInputStream::jumpToMark(sal_Int32 nMark)
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 map >::iterator ii = m_mapMarks.find( 
nMark );
 
 if( ii == m_mapMarks.end() )
@@ -629,14 +628,14 @@ void OMarkableInputStream::jumpToMark(sal_Int32 nMark)
 
 void OMarkableInputStream::jumpToFurthest()
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 m_nCurrentPos = m_pBuffer->getSize();
 checkMarksAndFlush();
 }
 
 sal_Int32 OMarkableInputStream::offsetToMark(sal_Int32 nMark)
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 map >::const_iterator ii = 
m_mapMarks.find( nMark );
 
 if( ii == m_mapMarks.end() )


[Libreoffice-commits] core.git: io/source

2022-05-08 Thread Noel Grandin (via logerrit)
 io/source/stm/omark.cxx |   20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 0daeb60f4fd24a0b075b94775a9d635fe7fc0824
Author: Noel Grandin 
AuthorDate: Sun May 8 12:54:05 2022 +0200
Commit: Noel Grandin 
CommitDate: Sun May 8 20:49:22 2022 +0200

osl::Mutex->std::mutex in OMarkableOutputStream

Change-Id: Ie39f8cd7f8de8dfe647d006d0fd0c62fddc72a8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134018
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx
index 411f6412c830..60ec1f9d2f28 100644
--- a/io/source/stm/omark.cxx
+++ b/io/source/stm/omark.cxx
@@ -39,7 +39,7 @@
 
 #include 
 #include 
-
+#include 
 
 using namespace ::std;
 using namespace ::cppu;
@@ -121,7 +121,7 @@ private:
 sal_Int32 m_nCurrentPos;
 sal_Int32 m_nCurrentMark;
 
-Mutex m_mutex;
+std::mutex m_mutex;
 };
 
 }
@@ -145,7 +145,7 @@ void OMarkableOutputStream::writeBytes(const Sequence< 
sal_Int8 >& aData)
 m_output->writeBytes( aData );
 }
 else {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 // new data must be buffered
 m_pBuffer->writeAt( m_nCurrentPos , aData );
 m_nCurrentPos += aData.getLength();
@@ -158,7 +158,7 @@ void OMarkableOutputStream::flush()
 {
 Reference< XOutputStream > output;
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 output = m_output;
 }
 
@@ -176,7 +176,7 @@ void OMarkableOutputStream::closeOutput()
 if( !m_bValidStream ) {
 throw NotConnectedException();
 }
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 // all marks must be cleared and all
 
 m_mapMarks.clear();
@@ -194,7 +194,7 @@ void OMarkableOutputStream::closeOutput()
 
 sal_Int32 OMarkableOutputStream::createMark()
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 sal_Int32 nMark = m_nCurrentMark;
 
 m_mapMarks[nMark] = m_nCurrentPos;
@@ -205,7 +205,7 @@ sal_Int32 OMarkableOutputStream::createMark()
 
 void OMarkableOutputStream::deleteMark(sal_Int32 Mark)
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 map >::iterator ii = m_mapMarks.find( 
Mark );
 
 if( ii == m_mapMarks.end() ) {
@@ -219,7 +219,7 @@ void OMarkableOutputStream::deleteMark(sal_Int32 Mark)
 
 void OMarkableOutputStream::jumpToMark(sal_Int32 nMark)
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 map >::iterator ii = m_mapMarks.find( 
nMark );
 
 if( ii == m_mapMarks.end() ) {
@@ -232,7 +232,7 @@ void OMarkableOutputStream::jumpToMark(sal_Int32 nMark)
 
 void OMarkableOutputStream::jumpToFurthest()
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 m_nCurrentPos = m_pBuffer->getSize();
 checkMarksAndFlush();
 }
@@ -240,7 +240,7 @@ void OMarkableOutputStream::jumpToFurthest()
 sal_Int32 OMarkableOutputStream::offsetToMark(sal_Int32 nMark)
 {
 
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 map >::const_iterator ii = 
m_mapMarks.find( nMark );
 
 if( ii == m_mapMarks.end() )


[Libreoffice-commits] core.git: io/source

2022-05-08 Thread Noel Grandin (via logerrit)
 io/source/acceptor/acceptor.cxx |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit e8b38f770012d2dad923c8a174ba4e9553db9afa
Author: Noel Grandin 
AuthorDate: Sun May 8 12:51:17 2022 +0200
Commit: Noel Grandin 
CommitDate: Sun May 8 19:56:03 2022 +0200

osl::Mutex->std::mutex in OAcceptor

Change-Id: I0fa5628ff601a89ed9c74212b4986689957eab1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134017
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/io/source/acceptor/acceptor.cxx b/io/source/acceptor/acceptor.cxx
index 79af13d385b9..af0883be9769 100644
--- a/io/source/acceptor/acceptor.cxx
+++ b/io/source/acceptor/acceptor.cxx
@@ -17,8 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-
 #include 
 #include 
 #include 
@@ -33,6 +31,7 @@
 
 #include "acceptor.hxx"
 #include 
+#include 
 #include 
 
 using namespace ::osl;
@@ -61,7 +60,7 @@ namespace {
 private:
 std::unique_ptr m_pPipe;
 std::unique_ptr m_pSocket;
-Mutex m_mutex;
+std::mutex m_mutex;
 OUString m_sLastDescription;
 bool m_bInAccept;
 
@@ -136,7 +135,7 @@ Reference< XConnection > OAcceptor::accept( const OUString 

 catch( ... )
 {
 {
-MutexGuard g( m_mutex );
+std::unique_lock g( m_mutex );
 m_pPipe.reset();
 }
 throw;
@@ -169,7 +168,7 @@ Reference< XConnection > OAcceptor::accept( const OUString 

 catch( ... )
 {
 {
-MutexGuard g( m_mutex );
+std::unique_lock g( m_mutex );
 m_pSocket.reset();
 }
 throw;
@@ -212,7 +211,7 @@ Reference< XConnection > OAcceptor::accept( const OUString 

 
 void SAL_CALL OAcceptor::stopAccepting(  )
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 
 if( m_pPipe )
 {


[Libreoffice-commits] core.git: io/source

2022-05-04 Thread Stephan Bergmann (via logerrit)
 io/source/stm/opump.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 609402c6167c33f74b17e0c6c4ba093b343abd01
Author: Stephan Bergmann 
AuthorDate: Wed May 4 09:44:30 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed May 4 11:46:07 2022 +0200

Just use Any ctor instead of makeAny in io

Change-Id: I3b659072c54dde7f49aa90e5d52d24f5d762654a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133805
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/io/source/stm/opump.cxx b/io/source/stm/opump.cxx
index 97f254b6be2a..598d16aa4f61 100644
--- a/io/source/stm/opump.cxx
+++ b/io/source/stm/opump.cxx
@@ -272,15 +272,15 @@ void Pump::run()
 }
 catch ( const IOException & e )
 {
-fireError( makeAny( e ) );
+fireError( Any( e ) );
 }
 catch ( const RuntimeException & e )
 {
-fireError( makeAny( e ) );
+fireError( Any( e ) );
 }
 catch ( const Exception & e )
 {
-fireError( makeAny( e ) );
+fireError( Any( e ) );
 }
 
 close();


[Libreoffice-commits] core.git: io/source

2021-12-19 Thread Noel Grandin (via logerrit)
 io/source/acceptor/acc_pipe.cxx |4 ++--
 io/source/acceptor/acceptor.hxx |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 86aa6ad680998d2e854b964f63b51a2c7d98251a
Author: Noel Grandin 
AuthorDate: Sat Dec 18 22:11:49 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Dec 20 08:32:43 2021 +0100

osl::Mutex->std::mutex in PipeAcceptor

Change-Id: Iafe6c0238d5a00bbf3c586b36c10ea7793f466b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127122
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/io/source/acceptor/acc_pipe.cxx b/io/source/acceptor/acc_pipe.cxx
index 62f90993dca7..d95ea998e6c1 100644
--- a/io/source/acceptor/acc_pipe.cxx
+++ b/io/source/acceptor/acc_pipe.cxx
@@ -144,7 +144,7 @@ namespace io_acceptor
 {
 Pipe pipe;
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 pipe = m_pipe;
 }
 if( ! pipe.is() )
@@ -177,7 +177,7 @@ namespace io_acceptor
 m_bClosed = true;
 Pipe pipe;
 {
-MutexGuard guard( m_mutex );
+std::unique_lock guard( m_mutex );
 pipe = m_pipe;
 m_pipe.clear();
 }
diff --git a/io/source/acceptor/acceptor.hxx b/io/source/acceptor/acceptor.hxx
index 0ebe00c9e372..9214a10b7509 100644
--- a/io/source/acceptor/acceptor.hxx
+++ b/io/source/acceptor/acceptor.hxx
@@ -21,7 +21,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
@@ -39,7 +39,7 @@ namespace io_acceptor {
 
 void stopAccepting();
 
-::osl::Mutex m_mutex;
+std::mutex m_mutex;
 ::osl::Pipe m_pipe;
 OUString m_sPipeName;
 OUString m_sConnectionDescription;


[Libreoffice-commits] core.git: io/source

2021-12-19 Thread Noel Grandin (via logerrit)
 io/source/connector/connector.hxx  |5 +++--
 io/source/connector/ctr_socket.cxx |6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 5f4a580ea13d34d7cc0ece0099dd2003612ca635
Author: Noel Grandin 
AuthorDate: Sat Dec 18 22:13:09 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Dec 20 08:32:29 2021 +0100

osl::Mutex->std::mutex in SocketConnection

Change-Id: Ifce8ab564c6f43f65ce02706b74f2c58d9b42bd4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127123
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/io/source/connector/connector.hxx 
b/io/source/connector/connector.hxx
index a9321932798e..691fc7a885df 100644
--- a/io/source/connector/connector.hxx
+++ b/io/source/connector/connector.hxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace stoc_connector
 {
@@ -80,12 +81,12 @@ namespace stoc_connector
 oslInterlockedCount m_nStatus;
 OUString m_sDescription;
 
-::osl::Mutex _mutex;
+std::mutex _mutex;
 bool _started;
 bool _closed;
 bool _error;
 
-  XStreamListener_hash_set _listeners;
+XStreamListener_hash_set _listeners;
 };
 }
 
diff --git a/io/source/connector/ctr_socket.cxx 
b/io/source/connector/ctr_socket.cxx
index 98b4131be407..a171dc9e7d3b 100644
--- a/io/source/connector/ctr_socket.cxx
+++ b/io/source/connector/ctr_socket.cxx
@@ -35,7 +35,7 @@ namespace stoc_connector {
 XStreamListener_hash_set listeners;
 
 {
-::osl::MutexGuard guard(pCon->_mutex);
+std::unique_lock guard(pCon->_mutex);
 if(!*notified)
 {
 *notified = true;
@@ -210,14 +210,14 @@ namespace stoc_connector {
 // XConnectionBroadcaster
 void SAL_CALL SocketConnection::addStreamListener(const 
Reference & aListener)
 {
-MutexGuard guard(_mutex);
+std::unique_lock guard(_mutex);
 
 _listeners.insert(aListener);
 }
 
 void SAL_CALL SocketConnection::removeStreamListener(const 
Reference & aListener)
 {
-MutexGuard guard(_mutex);
+std::unique_lock guard(_mutex);
 
 _listeners.erase(aListener);
 }


[Libreoffice-commits] core.git: io/source io/test sw/inc

2021-01-03 Thread Alchemist (via logerrit)
 io/source/acceptor/acceptor.hxx   |4 +---
 io/source/connector/connector.hxx |4 +---
 io/source/stm/streamhelper.hxx|5 +
 io/test/stm/testfactreg.hxx   |6 +-
 sw/inc/accessibilityoptions.hxx   |4 +---
 sw/inc/usrfld.hxx |5 +
 sw/inc/viewsh.hxx |5 ++---
 sw/inc/viscrs.hxx |4 +---
 sw/inc/wdocsh.hxx |7 +++
 9 files changed, 12 insertions(+), 32 deletions(-)

New commits:
commit 74583d24f67f41d15da211cfb00b7eaa8419e685
Author: Alchemist 
AuthorDate: Thu Dec 31 18:04:12 2020 +0530
Commit: Julien Nabet 
CommitDate: Sun Jan 3 10:11:23 2021 +0100

tdf#124176 Use pragma once instead of include guards

Change-Id: I491742c51ddc7c97f02b148dfb81d9ba820a759e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108600
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/io/source/acceptor/acceptor.hxx b/io/source/acceptor/acceptor.hxx
index a88f3728f5e7..0ebe00c9e372 100644
--- a/io/source/acceptor/acceptor.hxx
+++ b/io/source/acceptor/acceptor.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_IO_SOURCE_ACCEPTOR_ACCEPTOR_HXX
-#define INCLUDED_IO_SOURCE_ACCEPTOR_ACCEPTOR_HXX
+#pragma once
 
 #include 
 #include 
@@ -71,6 +70,5 @@ namespace io_acceptor {
 
 }
 
-#endif // INCLUDED_IO_SOURCE_ACCEPTOR_ACCEPTOR_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/io/source/connector/connector.hxx 
b/io/source/connector/connector.hxx
index 9aad55a45dfa..a9321932798e 100644
--- a/io/source/connector/connector.hxx
+++ b/io/source/connector/connector.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_IO_SOURCE_CONNECTOR_CONNECTOR_HXX
-#define INCLUDED_IO_SOURCE_CONNECTOR_CONNECTOR_HXX
+#pragma once
 
 #include 
 
@@ -90,6 +89,5 @@ namespace stoc_connector
 };
 }
 
-#endif // INCLUDED_IO_SOURCE_CONNECTOR_CONNECTOR_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/io/source/stm/streamhelper.hxx b/io/source/stm/streamhelper.hxx
index c1bb1b7db748..6d49003e9d77 100644
--- a/io/source/stm/streamhelper.hxx
+++ b/io/source/stm/streamhelper.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_IO_SOURCE_STM_STREAMHELPER_HXX
-#define INCLUDED_IO_SOURCE_STM_STREAMHELPER_HXX
+#pragma once
 
 #include 
 
@@ -83,6 +82,4 @@ public:
 
 }
 
-#endif // INCLUDED_IO_SOURCE_STM_STREAMHELPER_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/io/test/stm/testfactreg.hxx b/io/test/stm/testfactreg.hxx
index 2dbff6d62d2b..7952867b4912 100644
--- a/io/test/stm/testfactreg.hxx
+++ b/io/test/stm/testfactreg.hxx
@@ -17,9 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_IO_TEST_STM_TESTFACTREG_HXX
-#define INCLUDED_IO_TEST_STM_TESTFACTREG_HXX
-
+#pragma once
 #include 
 
 Reference< XInterface > SAL_CALL OPipeTest_CreateInstance( const Reference< 
XMultiServiceFactory > & rSMgr ) throw( Exception );
@@ -106,6 +104,4 @@ Sequence createIntSeq( sal_Int32 i );
 }\
 ((void)0)
 
-#endif // INCLUDED_IO_TEST_STM_TESTFACTREG_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/accessibilityoptions.hxx b/sw/inc/accessibilityoptions.hxx
index 92ec871b5bd3..ce8e94a158be 100644
--- a/sw/inc/accessibilityoptions.hxx
+++ b/sw/inc/accessibilityoptions.hxx
@@ -16,8 +16,7 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef INCLUDED_SW_INC_ACCESSIBILITYOPTIONS_HXX
-#define INCLUDED_SW_INC_ACCESSIBILITYOPTIONS_HXX
+#pragma once
 
 struct SwAccessibilityOptions
 {
@@ -34,6 +33,5 @@ struct SwAccessibilityOptions
 bool IsStopAnimatedGraphics() const   { return 
bIsStopAnimatedGraphics;}
 void SetStopAnimatedGraphics( bool b ){ bIsStopAnimatedGraphics = b; }
 };
-#endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx
index 3592c6834380..d9ea9e407440 100644
--- a/sw/inc/usrfld.hxx
+++ b/sw/inc/usrfld.hxx
@@ -16,8 +16,7 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef INCLUDED_SW_INC_USRFLD_HXX
-#define INCLUDED_SW_INC_USRFLD_HXX
+#pragma once
 
 #include "swdllapi.h"
 #include "fldbas.hxx"
@@ -129,6 +128,4 @@ public:
 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
-#endif // INCLUDED_SW_INC_USRFLD_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 071c60d11bd3..27d29e9f65f0 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -16,8 +16,8 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the 

[Libreoffice-commits] core.git: io/source

2020-07-01 Thread Stephan Bergmann (via logerrit)
 io/source/services.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3550a459db6d633fccd5a8599b75662689d270c4
Author: Stephan Bergmann 
AuthorDate: Wed Jul 1 10:00:12 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jul 1 11:33:54 2020 +0200

Upcoming improved loplugin:staticanonymous -> redundantstatic: io

Change-Id: I150aa3666a9e1acf5fba445b9a709ccd9d8c7e85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97593
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/io/source/services.cxx b/io/source/services.cxx
index c0da0ee8b3ad..9035cec86334 100644
--- a/io/source/services.cxx
+++ b/io/source/services.cxx
@@ -27,7 +27,7 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::registry;
 
-static const struct ImplementationEntry g_entries[] =
+const struct ImplementationEntry g_entries[] =
 {
 {
 io_acceptor::acceptor_CreateInstance, 
io_acceptor::acceptor_getImplementationName ,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source

2020-06-05 Thread Stephan Bergmann (via logerrit)
 io/source/connector/connector.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a2c7244ae1ea65345ba11c1ce2501dba34b51362
Author: Stephan Bergmann 
AuthorDate: Fri Jun 5 10:29:51 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 5 12:53:05 2020 +0200

Make it more obvious that the error message is composed

...from a pipe name and an error number

Change-Id: I1e79c1d635fd7f51faf9ede09ca862b37bd7b990
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95577
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/io/source/connector/connector.cxx 
b/io/source/connector/connector.cxx
index 0f4792f3aa8e..f5b77a43cb7d 100644
--- a/io/source/connector/connector.cxx
+++ b/io/source/connector/connector.cxx
@@ -92,8 +92,8 @@ namespace stoc_connector
 else
 {
 OUString const sMessage(
-"Connector : couldn't connect to pipe " + aName + "("
-+ OUString::number(pConn->m_pipe.getError()) + ")");
+"Connector : couldn't connect to pipe \"" + aName + 
"\": "
++ OUString::number(pConn->m_pipe.getError()));
 SAL_WARN("io.connector", sMessage);
 throw NoConnectException( sMessage );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source

2020-06-04 Thread Stephan Bergmann (via logerrit)
 io/source/acceptor/acceptor.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit f1125b56d1d049448542c699a5c62dc6aa3a0bab
Author: Stephan Bergmann 
AuthorDate: Thu Jun 4 10:37:21 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jun 4 21:17:45 2020 +0200

Upcoming loplugin:elidestringvar: io

Change-Id: Ic68bc08ed70733728a50d3753a27ec62ed4953f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95485
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/io/source/acceptor/acceptor.cxx b/io/source/acceptor/acceptor.cxx
index d1f2bb54bf40..15df65592a33 100644
--- a/io/source/acceptor/acceptor.cxx
+++ b/io/source/acceptor/acceptor.cxx
@@ -119,8 +119,7 @@ namespace io_acceptor
 m_sLastDescription != sConnectionDescription )
 {
 // instantiate another acceptor for different ports
-OUString sMessage = "acceptor::accept called multiple times with 
different connection strings\n";
-throw ConnectionSetupException( sMessage );
+throw ConnectionSetupException( "acceptor::accept called multiple 
times with different connection strings\n" );
 }
 
 if( m_sLastDescription.isEmpty() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source

2020-04-07 Thread Noel Grandin (via logerrit)
 io/source/stm/odata.cxx|   75 -
 io/source/stm/opump.cxx|   22 ++--
 io/source/stm/streamhelper.cxx |   29 ---
 3 files changed, 63 insertions(+), 63 deletions(-)

New commits:
commit 33b3439e65bc22c2d149eb18c3d7d9da43699246
Author: Noel Grandin 
AuthorDate: Tue Apr 7 14:19:30 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 7 15:37:24 2020 +0200

loplugin:flatten in io

Change-Id: I4f4dbbd4ce279cb25a8e4deba1967b5c23ce1385
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91818
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/io/source/stm/odata.cxx b/io/source/stm/odata.cxx
index 6ffd12c89387..3e802b2d37a5 100644
--- a/io/source/stm/odata.cxx
+++ b/io/source/stm/odata.cxx
@@ -907,30 +907,29 @@ void OObjectOutputStream::writeObject( const Reference< 
XPersistObject > & xPObj
 
 void OObjectOutputStream::connectToMarkable()
 {
-if( ! m_bValidMarkable ) {
-if( ! m_bValidStream )
+if(  m_bValidMarkable )
+return;
+
+if( ! m_bValidStream )
+throw NotConnectedException();
+
+// find the markable stream !
+Reference< XInterface > rTry(m_output);
+while( true ) {
+if( ! rTry.is() )
 {
 throw NotConnectedException();
 }
-
-// find the markable stream !
-Reference< XInterface > rTry(m_output);
-while( true ) {
-if( ! rTry.is() )
-{
-throw NotConnectedException();
-}
-Reference < XMarkableStream > markable( rTry , UNO_QUERY );
-if( markable.is() )
-{
-m_rMarkable = markable;
-break;
-}
-Reference < XActiveDataSource > source( rTry , UNO_QUERY );
-rTry = source;
+Reference < XMarkableStream > markable( rTry , UNO_QUERY );
+if( markable.is() )
+{
+m_rMarkable = markable;
+break;
 }
-m_bValidMarkable = true;
+Reference < XActiveDataSource > source( rTry , UNO_QUERY );
+rTry = source;
 }
+m_bValidMarkable = true;
 }
 
 
@@ -1180,30 +1179,30 @@ Reference< XPersistObject >  
OObjectInputStream::readObject()
 
 void OObjectInputStream::connectToMarkable()
 {
-if( ! m_bValidMarkable ) {
-if( ! m_bValidStream )
+if(  m_bValidMarkable )return;
+
+if( ! m_bValidStream )
+{
+throw NotConnectedException( );
+}
+
+// find the markable stream !
+Reference< XInterface > rTry(m_input);
+while( true ) {
+if( ! rTry.is() )
 {
 throw NotConnectedException( );
 }
-
-// find the markable stream !
-Reference< XInterface > rTry(m_input);
-while( true ) {
-if( ! rTry.is() )
-{
-throw NotConnectedException( );
-}
-Reference<  XMarkableStream > markable( rTry , UNO_QUERY );
-if( markable.is() )
-{
-m_rMarkable = markable;
-break;
-}
-Reference < XActiveDataSink > sink( rTry , UNO_QUERY );
-rTry = sink;
+Reference<  XMarkableStream > markable( rTry , UNO_QUERY );
+if( markable.is() )
+{
+m_rMarkable = markable;
+break;
 }
-m_bValidMarkable = true;
+Reference < XActiveDataSink > sink( rTry , UNO_QUERY );
+rTry = sink;
 }
+m_bValidMarkable = true;
 }
 
 sal_Int32 OObjectInputStream::createMark()
diff --git a/io/source/stm/opump.cxx b/io/source/stm/opump.cxx
index 29f09bdd3e81..cba66d3c50fc 100644
--- a/io/source/stm/opump.cxx
+++ b/io/source/stm/opump.cxx
@@ -146,19 +146,19 @@ void Pump::fireClose()
 }
 }
 
-if( bFire )
+if( !bFire )
+return;
+
+OInterfaceIteratorHelper iter( m_cnt );
+while( iter.hasMoreElements() )
 {
-OInterfaceIteratorHelper iter( m_cnt );
-while( iter.hasMoreElements() )
+try
 {
-try
-{
-static_cast< XStreamListener * > ( iter.next() )->closed( );
-}
-catch ( const RuntimeException & )
-{
-
TOOLS_WARN_EXCEPTION("io.streams","com.sun.star.comp.stoc.Pump: unexpected 
exception during calling listeners");
-}
+static_cast< XStreamListener * > ( iter.next() )->closed( );
+}
+catch ( const RuntimeException & )
+{
+TOOLS_WARN_EXCEPTION("io.streams","com.sun.star.comp.stoc.Pump: 
unexpected exception during calling listeners");
 }
 }
 }
diff --git a/io/source/stm/streamhelper.cxx b/io/source/stm/streamhelper.cxx
index 2eace1e70d4c..4a2df5891be1 100644
--- a/io/source/stm/streamhelper.cxx
+++ b/io/source/stm/streamhelper.cxx
@@ -68,21 +68,22 @@ void MemRingBuffer::resizeBuffer( 

[Libreoffice-commits] core.git: io/source

2019-08-31 Thread Arkadiy Illarionov (via logerrit)
 io/source/TextInputStream/TextInputStream.cxx |   19 +++--
 io/source/stm/odata.cxx   |   50 +-
 io/source/stm/streamhelper.cxx|   13 +++---
 3 files changed, 30 insertions(+), 52 deletions(-)

New commits:
commit 01837a85004a6f891a09c0a63ed7eff75d634827
Author: Arkadiy Illarionov 
AuthorDate: Sat Aug 31 17:40:19 2019 +0300
Commit: Arkadiy Illarionov 
CommitDate: Sun Sep 1 02:04:50 2019 +0200

Simplify Sequence iterations in io

Use comphelper::findValue and initializer lists.

Change-Id: I4ebaf556a21b263e48b82a7290093eb8a832d9da
Reviewed-on: https://gerrit.libreoffice.org/78351
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-by: Arkadiy Illarionov 

diff --git a/io/source/TextInputStream/TextInputStream.cxx 
b/io/source/TextInputStream/TextInputStream.cxx
index c1ae805571f6..d90f30976ec8 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -19,6 +19,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -167,8 +168,6 @@ OUString OTextInputStream::implReadString( const Sequence< 
sal_Unicode >& Delimi
 bool bFound = false;
 bool bFoundFirstLineEndChar = false;
 sal_Unicode cFirstLineEndChar = 0;
-const sal_Unicode* pDelims = Delimiters.getConstArray();
-const sal_Int32 nDelimCount = Delimiters.getLength();
 while( !bFound )
 {
 // Still characters available?
@@ -213,18 +212,12 @@ OUString OTextInputStream::implReadString( const 
Sequence< sal_Unicode >& Delimi
 cFirstLineEndChar = c;
 }
 }
-else
+else if( comphelper::findValue(Delimiters, c) != -1 )
 {
-for( sal_Int32 i = 0 ; i < nDelimCount ; i++ )
-{
-if( c == pDelims[ i ] )
-{
-bFound = true;
-nCopyLen = nBufferReadPos;
-if( bRemoveDelimiter )
-nCopyLen--;
-}
-}
+bFound = true;
+nCopyLen = nBufferReadPos;
+if( bRemoveDelimiter )
+nCopyLen--;
 }
 }
 
diff --git a/io/source/stm/odata.cxx b/io/source/stm/odata.cxx
index 260280216c11..0c1dd29f9bb1 100644
--- a/io/source/stm/odata.cxx
+++ b/io/source/stm/odata.cxx
@@ -167,7 +167,7 @@ sal_Int8 ODataInputStream::readByte()
 {
 throw UnexpectedEOFException();
 }
-return aTmp.getArray()[0];
+return aTmp.getConstArray()[0];
 }
 
 sal_Unicode ODataInputStream::readChar()
@@ -522,54 +522,40 @@ void ODataOutputStream::writeBoolean(sal_Bool Value)
 
 void ODataOutputStream::writeByte(sal_Int8 Value)
 {
-Sequence aTmp( 1 );
-aTmp.getArray()[0] = Value;
-writeBytes( aTmp );
+writeBytes( { Value } );
 }
 
 void ODataOutputStream::writeChar(sal_Unicode Value)
 {
-Sequence aTmp( 2 );
-sal_Int8 * pBytes = aTmp.getArray();
-pBytes[0] = sal_Int8(Value >> 8);
-pBytes[1] = sal_Int8(Value);
-writeBytes( aTmp );
+writeBytes( { sal_Int8(Value >> 8),
+  sal_Int8(Value) } );
 }
 
 
 void ODataOutputStream::writeShort(sal_Int16 Value)
 {
-Sequence aTmp( 2 );
-sal_Int8 * pBytes = aTmp.getArray();
-pBytes[0] = sal_Int8(Value >> 8);
-pBytes[1] = sal_Int8(Value);
-writeBytes( aTmp );
+writeBytes( { sal_Int8(Value >> 8),
+  sal_Int8(Value) } );
 }
 
 void ODataOutputStream::writeLong(sal_Int32 Value)
 {
-Sequence aTmp( 4 );
-sal_Int8 * pBytes = aTmp.getArray();
-pBytes[0] = sal_Int8(Value >> 24);
-pBytes[1] = sal_Int8(Value >> 16);
-pBytes[2] = sal_Int8(Value >> 8);
-pBytes[3] = sal_Int8(Value);
-writeBytes( aTmp );
+writeBytes( { sal_Int8(Value >> 24),
+  sal_Int8(Value >> 16),
+  sal_Int8(Value >> 8),
+  sal_Int8(Value) } );
 }
 
 void ODataOutputStream::writeHyper(sal_Int64 Value)
 {
-Sequence aTmp( 8 );
-sal_Int8 * pBytes = aTmp.getArray();
-pBytes[0] = sal_Int8(Value >> 56);
-pBytes[1] = sal_Int8(Value >> 48);
-pBytes[2] = sal_Int8(Value >> 40);
-pBytes[3] = sal_Int8(Value >> 32);
-pBytes[4] = sal_Int8(Value >> 24);
-pBytes[5] = sal_Int8(Value >> 16);
-pBytes[6] = sal_Int8(Value >> 8);
-pBytes[7] = sal_Int8(Value);
-writeBytes( aTmp );
+writeBytes( { sal_Int8(Value >> 56),
+  sal_Int8(Value >> 48),
+  sal_Int8(Value >> 40),
+  sal_Int8(Value >> 32),
+  sal_Int8(Value >> 24),
+  sal_Int8(Value >> 16),
+  sal_Int8(Value >> 8),
+  sal_Int8(Value) } );
 }
 
 
diff --git a/io/source/stm/streamhelper.cxx b/io/source/stm/streamhelper.cxx
index 20280b850563..be0644d5e1b2 100644
--- a/io/source/stm/streamhelper.cxx
+++ b/io/source/stm/streamhelper.cxx
@@ -118,7 +118,7 @@ void 

[Libreoffice-commits] core.git: io/source

2018-12-18 Thread Libreoffice Gerrit user
 io/source/acceptor/acc_pipe.cxx   |5 ++---
 io/source/acceptor/acc_socket.cxx |6 ++
 io/source/connector/connector.cxx |   10 --
 3 files changed, 8 insertions(+), 13 deletions(-)

New commits:
commit 36e9ecd900fec7e4cc517d829345bd3e8406be59
Author: Noel Grandin 
AuthorDate: Tue Dec 18 12:00:09 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Dec 19 07:04:51 2018 +0100

use unique_ptr in io

fixing a leak in PipeAcceptor::accept

Change-Id: Id47da5e2a2c4060958aee9233feec859aebc69c7
Reviewed-on: https://gerrit.libreoffice.org/65345
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/io/source/acceptor/acc_pipe.cxx b/io/source/acceptor/acc_pipe.cxx
index 4410760c6f26..50a9939a2144 100644
--- a/io/source/acceptor/acc_pipe.cxx
+++ b/io/source/acceptor/acc_pipe.cxx
@@ -148,19 +148,18 @@ namespace io_acceptor
 OUString error = "io.acceptor: pipe already closed" + m_sPipeName;
 throw ConnectionSetupException( error );
 }
-PipeConnection *pConn = new PipeConnection( m_sConnectionDescription );
+std::unique_ptr pConn(new PipeConnection( 
m_sConnectionDescription ));
 
 oslPipeError status = pipe.accept( pConn->m_pipe );
 
 if( m_bClosed )
 {
 // stopAccepting was called !
-delete pConn;
 return Reference < XConnection >();
 }
 else if( osl_Pipe_E_None == status )
 {
-return Reference < XConnection > ( static_cast(pConn) );
+return Reference < XConnection > ( static_cast(pConn.release()) );
 }
 else
 {
diff --git a/io/source/acceptor/acc_socket.cxx 
b/io/source/acceptor/acc_socket.cxx
index f34b3635eb7b..5a9956eb75d9 100644
--- a/io/source/acceptor/acc_socket.cxx
+++ b/io/source/acceptor/acc_socket.cxx
@@ -330,17 +330,15 @@ namespace io_acceptor {
 
 Reference< XConnection > SocketAcceptor::accept( )
 {
-SocketConnection *pConn = new SocketConnection( 
m_sConnectionDescription );
+std::unique_ptr pConn(new SocketConnection( 
m_sConnectionDescription ));
 
 if( m_socket.acceptConnection( pConn->m_socket )!= osl_Socket_Ok )
 {
 // stopAccepting was called
-delete pConn;
 return Reference < XConnection > ();
 }
 if( m_bClosed )
 {
-delete pConn;
 return Reference < XConnection > ();
 }
 
@@ -358,7 +356,7 @@ namespace io_acceptor {
sizeof( nTcpNoDelay ) , 
osl_Socket_LevelTcp );
 }
 
-return Reference < XConnection > ( static_cast(pConn) );
+return Reference < XConnection > ( static_cast(pConn.release()) );
 }
 
 void SocketAcceptor::stopAccepting()
diff --git a/io/source/connector/connector.cxx 
b/io/source/connector/connector.cxx
index 1de3ee92ec2d..c95219d53ab9 100644
--- a/io/source/connector/connector.cxx
+++ b/io/source/connector/connector.cxx
@@ -85,11 +85,11 @@ namespace stoc_connector
 {
 OUString aName(aDesc.getParameter("name"));
 
-PipeConnection *pConn = new PipeConnection( 
sConnectionDescription );
+std::unique_ptr pConn(new PipeConnection( 
sConnectionDescription ));
 
 if( pConn->m_pipe.create( aName.pData, osl_Pipe_OPEN, 
osl::Security() ) )
 {
-r.set( static_cast(pConn) );
+r.set( static_cast(pConn.release()) );
 }
 else
 {
@@ -97,7 +97,6 @@ namespace stoc_connector
 "Connector : couldn't connect to pipe " + aName + "("
 + OUString::number(pConn->m_pipe.getError()) + ")");
 SAL_WARN("io.connector", sMessage);
-delete pConn;
 throw NoConnectException( sMessage );
 }
 }
@@ -114,7 +113,7 @@ namespace stoc_connector
 bool bTcpNoDelay
 = aDesc.getParameter("tcpnodelay").toInt32() != 0;
 
-SocketConnection *pConn = new SocketConnection( 
sConnectionDescription);
+std::unique_ptr pConn(new SocketConnection( 
sConnectionDescription));
 
 SocketAddr AddrTarget( aHost.pData, nPort );
 if(pConn->m_socket.connect(AddrTarget) != osl_Socket_Ok)
@@ -123,7 +122,6 @@ namespace stoc_connector
 OUString sError = pConn->m_socket.getErrorAsString();
 sMessage += sError;
 sMessage += ")";
-delete pConn;
 throw NoConnectException( sMessage );
 }
 // we enable tcpNoDelay for loopback connections because
@@ -135,7 +133,7 @@ namespace stoc_connector
sizeof( nTcpNoDelay ) , 
osl_Socket_LevelTcp );
 

[Libreoffice-commits] core.git: io/source

2018-10-21 Thread Libreoffice Gerrit user
 io/source/stm/streamhelper.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 24e4b37987ccd410b6d6672151d84c790cdb7e56
Author: Mike Kaganski 
AuthorDate: Sat Oct 20 22:42:29 2018 +0200
Commit: Mike Kaganski 
CommitDate: Sun Oct 21 08:02:01 2018 +0200

tdf#120703 (PVS): handle failed realloc

V701 realloc() possible leak: when realloc() fails in allocating memory,
 original pointer 'm_p' is lost. Consider assigning realloc() to a
 temporary pointer.

Change-Id: Ic298927a266da4d543f3856a1c9f97ba1f6fe941
Reviewed-on: https://gerrit.libreoffice.org/62092
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 

diff --git a/io/source/stm/streamhelper.cxx b/io/source/stm/streamhelper.cxx
index 0ef0d3e1f7ae..c382cae96390 100644
--- a/io/source/stm/streamhelper.cxx
+++ b/io/source/stm/streamhelper.cxx
@@ -75,8 +75,10 @@ void MemRingBuffer::resizeBuffer( sal_Int32 nMinSize )
 }
 
 if( nNewLen != m_nBufferLen ) {
-m_p = static_cast(std::realloc( m_p , nNewLen ));
-if( !m_p ) {
+   if (auto p = static_cast(std::realloc(m_p, nNewLen)))
+m_p = p;
+else
+{
 throw css::io::BufferSizeExceededException(
 "MemRingBuffer::resizeBuffer BufferSizeExceededException");
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source lingucomponent/source sot/source

2018-01-15 Thread Noel Grandin
 io/source/stm/omark.cxx   |6 +++---
 io/source/stm/opipe.cxx   |4 ++--
 io/source/stm/streamhelper.cxx|2 +-
 io/source/stm/streamhelper.hxx|3 ---
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |   11 ---
 sot/source/sdstor/ucbstorage.cxx  |4 +---
 6 files changed, 11 insertions(+), 19 deletions(-)

New commits:
commit 34d8710fff4859d455b51a7e0d90fe3a35bf2e6b
Author: Noel Grandin 
Date:   Tue Jan 9 13:28:35 2018 +0200

remove local copies of std::min,std::max

Change-Id: I067c4dcabad55180e4734fb06338a8e843713936
Reviewed-on: https://gerrit.libreoffice.org/47692
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx
index fa0e0ae2cb80..a49ea4df7015 100644
--- a/io/source/stm/omark.cxx
+++ b/io/source/stm/omark.cxx
@@ -527,8 +527,8 @@ sal_Int32 OMarkableInputStream::readSomeBytes(Sequence< 
sal_Int8 >& aData, sal_I
 // read from buffer
 sal_Int32 nRead = 0;
 sal_Int32 nInBuffer = m_pBuffer->getSize() - m_nCurrentPos;
-sal_Int32 nAdditionalBytesToRead = 
Min(nMaxBytesToRead-nInBuffer,m_input->available());
-nAdditionalBytesToRead = Max(0 , nAdditionalBytesToRead );
+sal_Int32 nAdditionalBytesToRead = 
std::min(nMaxBytesToRead-nInBuffer,m_input->available());
+nAdditionalBytesToRead = std::max(0 , 
nAdditionalBytesToRead );
 
 // read enough bytes into buffer
 if( 0 == nInBuffer ) {
@@ -543,7 +543,7 @@ sal_Int32 OMarkableInputStream::readSomeBytes(Sequence< 
sal_Int8 >& aData, sal_I
 m_pBuffer->writeAt( m_pBuffer->getSize() , aData );
 }
 
-nBytesRead = Min( nMaxBytesToRead , nInBuffer + nRead );
+nBytesRead = std::min( nMaxBytesToRead , nInBuffer + nRead );
 
 // now take everything from buffer !
 m_pBuffer->readAt( m_nCurrentPos , aData , nBytesRead );
diff --git a/io/source/stm/opipe.cxx b/io/source/stm/opipe.cxx
index afdc92feef54..1065629f91f9 100644
--- a/io/source/stm/opipe.cxx
+++ b/io/source/stm/opipe.cxx
@@ -159,7 +159,7 @@ sal_Int32 OPipeImpl::readSomeBytes(Sequence< sal_Int8 >& 
aData, sal_Int32 nMaxBy
 }
 if( m_pFIFO->getSize() )
 {
-sal_Int32 nSize = Min( nMaxBytesToRead , m_pFIFO->getSize() );
+sal_Int32 nSize = std::min( nMaxBytesToRead , 
m_pFIFO->getSize() );
 aData.realloc( nSize );
 m_pFIFO->read( aData , nSize );
 return nSize;
@@ -197,7 +197,7 @@ void OPipeImpl::skipBytes(sal_Int32 nBytesToSkip)
 }
 m_nBytesToSkip += nBytesToSkip;
 
-nBytesToSkip = Min( m_pFIFO->getSize() , m_nBytesToSkip );
+nBytesToSkip = std::min( m_pFIFO->getSize() , m_nBytesToSkip );
 m_pFIFO->skip( nBytesToSkip );
 m_nBytesToSkip -= nBytesToSkip;
 }
diff --git a/io/source/stm/streamhelper.cxx b/io/source/stm/streamhelper.cxx
index efe53dcc42ab..ffd1726c6754 100644
--- a/io/source/stm/streamhelper.cxx
+++ b/io/source/stm/streamhelper.cxx
@@ -148,7 +148,7 @@ void MemRingBuffer::writeAt( sal_Int32 nPos, const 
Sequence  )
 // one area copy
 memcpy( &( m_p[nStartWritingIndex]), seq.getConstArray() , nLen );
 }
-m_nOccupiedBuffer = Max( nPos + seq.getLength() , m_nOccupiedBuffer );
+m_nOccupiedBuffer = std::max( nPos + seq.getLength() , m_nOccupiedBuffer );
 checkInvariants();
 }
 
diff --git a/io/source/stm/streamhelper.hxx b/io/source/stm/streamhelper.hxx
index c03673d6f4df..94d7c60a75bc 100644
--- a/io/source/stm/streamhelper.hxx
+++ b/io/source/stm/streamhelper.hxx
@@ -24,9 +24,6 @@
 
 #include 
 
-#define Max( a, b ) (((a)>(b)) ? (a) : (b) )
-#define Min( a, b ) (((a)<(b)) ? (a) : (b) )
-
 namespace io_stm
 {
 
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 4bdaa74d0a2a..4da78de3995b 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -60,9 +60,6 @@ using namespace com::sun::star::uno;
 using namespace com::sun::star::linguistic2;
 using namespace linguistic;
 
-// min, max
-#define Max(a,b) (a > b ? a : b)
-
 Hyphenator::Hyphenator() :
 aEvtListeners   ( GetLinguMutex() )
 {
@@ -364,8 +361,8 @@ Reference< XHyphenatedWord > SAL_CALL 
Hyphenator::hyphenate( const OUString& aWo
 {
 const bool bFailed = 0 != hnj_hyphen_hyphenate3( dict, 
lcword.get(), n, hyphens.get(), nullptr,
 , , , minLead, minTrail,
-Max(dict->clhmin, Max(dict->clhmin, 2) + Max(0, minLead  - 
Max(dict->lhmin, 2))),
-Max(dict->crhmin, Max(dict->crhmin, 2) + Max(0, minTrail - 
Max(dict->rhmin, 

[Libreoffice-commits] core.git: io/source

2016-05-01 Thread Andrea Gelmini
 io/source/stm/odata.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 75d965e5fc6e03513e8da1014c58d67f586b798b
Author: Andrea Gelmini 
Date:   Sat Apr 30 14:36:22 2016 +0200

Fix typo in code

Change-Id: I670b016fb937fd4e87939afedd6d2047533812bf
Reviewed-on: https://gerrit.libreoffice.org/24531
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/io/source/stm/odata.cxx b/io/source/stm/odata.cxx
index 5b61d14..9e2f717 100644
--- a/io/source/stm/odata.cxx
+++ b/io/source/stm/odata.cxx
@@ -1287,7 +1287,7 @@ Reference< XPersistObject >  
OObjectInputStream::readObject() throw (css::io::IO
 // skip data of new version
 skipBytes( nLen - m_rMarkable->offsetToMark( nMark ) );
 
-bool bLoadSuccesfull = true;
+bool bLoadSuccessful = true;
 if( nId )
 {
 if( !aName.isEmpty() )
@@ -1312,14 +1312,14 @@ Reference< XPersistObject >  
OObjectInputStream::readObject() throw (css::io::IO
 else
 {
 // no service with this name could be instantiated
-bLoadSuccesfull = false;
+bLoadSuccessful = false;
 }
 }
 else {
 if( m_aPersistVector.size() < nId )
 {
 // id unknown, load failure !
-bLoadSuccesfull = false;
+bLoadSuccessful = false;
 }
 else
 {
@@ -1333,7 +1333,7 @@ Reference< XPersistObject >  
OObjectInputStream::readObject() throw (css::io::IO
 skipBytes( nObjLen + nLen - m_rMarkable->offsetToMark( nMark ) );
 m_rMarkable->deleteMark( nMark );
 
-if( ! bLoadSuccesfull )
+if( ! bLoadSuccessful )
 {
 throw WrongFormatException();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source

2016-04-07 Thread Stephan Bergmann
 io/source/acceptor/acc_socket.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit aea456a37445f402f1fb3eb1415ca6af7046cf1e
Author: Stephan Bergmann 
Date:   Thu Apr 7 13:06:22 2016 +0200

clean up

Change-Id: Ibf0df59d2773a3356b21e1b4c70889511b373e56

diff --git a/io/source/acceptor/acc_socket.cxx 
b/io/source/acceptor/acc_socket.cxx
index b1a30a1..0a1edc5 100644
--- a/io/source/acceptor/acc_socket.cxx
+++ b/io/source/acceptor/acc_socket.cxx
@@ -203,8 +203,8 @@ namespace io_acceptor {
 aReadBytes.realloc( nBytesToRead );
 }
 
-sal_Int32 i = 0;
-i = m_socket.read( aReadBytes.getArray()  , aReadBytes.getLength() 
);
+sal_Int32 i = m_socket.read(
+aReadBytes.getArray(), aReadBytes.getLength());
 
 if(i != nBytesToRead)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source

2016-04-07 Thread Stephan Bergmann
 io/source/acceptor/acc_socket.cxx  |   10 --
 io/source/connector/ctr_pipe.cxx   |9 ++---
 io/source/connector/ctr_socket.cxx |7 ++-
 3 files changed, 8 insertions(+), 18 deletions(-)

New commits:
commit dee0a619bff88776d2b6c5b824fc8e8950418f70
Author: Stephan Bergmann 
Date:   Thu Apr 7 12:24:28 2016 +0200

Revert "reduce unnecessary realloc'ing"

This reverts commit 9f6e6fabcd5718e0b65437c5ce398e520f47aae1, which is 
wrong, as
it would cause the functions to now try to read aReadBytes.getLength() 
bytes if
that is initially larger than nBytesToRead.

diff --git a/io/source/acceptor/acc_socket.cxx 
b/io/source/acceptor/acc_socket.cxx
index 3fe29f3..b1a30a1 100644
--- a/io/source/acceptor/acc_socket.cxx
+++ b/io/source/acceptor/acc_socket.cxx
@@ -198,12 +198,13 @@ namespace io_acceptor {
 {
 notifyListeners(this, &_started, callStarted);
 
-if( aReadBytes.getLength() < nBytesToRead )
+if( aReadBytes.getLength() != nBytesToRead )
 {
 aReadBytes.realloc( nBytesToRead );
 }
 
-sal_Int32 i = m_socket.read( aReadBytes.getArray()  , 
aReadBytes.getLength() );
+sal_Int32 i = 0;
+i = m_socket.read( aReadBytes.getArray()  , aReadBytes.getLength() 
);
 
 if(i != nBytesToRead)
 {
@@ -219,10 +220,7 @@ namespace io_acceptor {
 
 throw ioException;
 }
-if( i < aReadBytes.getLength() )
-{
-aReadBytes.realloc( i );
-}
+
 return i;
 }
 else
diff --git a/io/source/connector/ctr_pipe.cxx b/io/source/connector/ctr_pipe.cxx
index dafdc42..df15291 100644
--- a/io/source/connector/ctr_pipe.cxx
+++ b/io/source/connector/ctr_pipe.cxx
@@ -49,16 +49,11 @@ namespace stoc_connector {
 {
 if( ! m_nStatus )
 {
-if( aReadBytes.getLength() < nBytesToRead )
+if( aReadBytes.getLength() != nBytesToRead )
 {
 aReadBytes.realloc( nBytesToRead );
 }
-sal_Int32 n = m_pipe.read( aReadBytes.getArray()  , 
aReadBytes.getLength() );
-if( n < aReadBytes.getLength() )
-{
-aReadBytes.realloc( n );
-}
-return n;
+return m_pipe.read( aReadBytes.getArray()  , 
aReadBytes.getLength() );
 }
 else {
 throw IOException();
diff --git a/io/source/connector/ctr_socket.cxx 
b/io/source/connector/ctr_socket.cxx
index 787a470..2c0d3f6 100644
--- a/io/source/connector/ctr_socket.cxx
+++ b/io/source/connector/ctr_socket.cxx
@@ -123,7 +123,7 @@ namespace stoc_connector {
 {
 notifyListeners(this, &_started, callStarted);
 
-if( aReadBytes.getLength() < nBytesToRead )
+if( aReadBytes.getLength() != nBytesToRead )
 {
 aReadBytes.realloc( nBytesToRead );
 }
@@ -143,10 +143,7 @@ namespace stoc_connector {
 
 throw ioException;
 }
-if( i < aReadBytes.getLength() )
-{
-aReadBytes.realloc( i );
-}
+
 return i;
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source

2016-04-01 Thread Noel Grandin
 io/source/acceptor/acc_socket.cxx  |   10 ++
 io/source/connector/ctr_pipe.cxx   |9 +++--
 io/source/connector/ctr_socket.cxx |7 +--
 3 files changed, 18 insertions(+), 8 deletions(-)

New commits:
commit 9f6e6fabcd5718e0b65437c5ce398e520f47aae1
Author: Noel Grandin 
Date:   Sun Feb 21 14:15:39 2016 +0200

reduce unnecessary realloc'ing

Change-Id: Ic597814706573576a0ba330a69a7a38aa97e5224
Reviewed-on: https://gerrit.libreoffice.org/23694
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/io/source/acceptor/acc_socket.cxx 
b/io/source/acceptor/acc_socket.cxx
index b1a30a1..3fe29f3 100644
--- a/io/source/acceptor/acc_socket.cxx
+++ b/io/source/acceptor/acc_socket.cxx
@@ -198,13 +198,12 @@ namespace io_acceptor {
 {
 notifyListeners(this, &_started, callStarted);
 
-if( aReadBytes.getLength() != nBytesToRead )
+if( aReadBytes.getLength() < nBytesToRead )
 {
 aReadBytes.realloc( nBytesToRead );
 }
 
-sal_Int32 i = 0;
-i = m_socket.read( aReadBytes.getArray()  , aReadBytes.getLength() 
);
+sal_Int32 i = m_socket.read( aReadBytes.getArray()  , 
aReadBytes.getLength() );
 
 if(i != nBytesToRead)
 {
@@ -220,7 +219,10 @@ namespace io_acceptor {
 
 throw ioException;
 }
-
+if( i < aReadBytes.getLength() )
+{
+aReadBytes.realloc( i );
+}
 return i;
 }
 else
diff --git a/io/source/connector/ctr_pipe.cxx b/io/source/connector/ctr_pipe.cxx
index df15291..dafdc42 100644
--- a/io/source/connector/ctr_pipe.cxx
+++ b/io/source/connector/ctr_pipe.cxx
@@ -49,11 +49,16 @@ namespace stoc_connector {
 {
 if( ! m_nStatus )
 {
-if( aReadBytes.getLength() != nBytesToRead )
+if( aReadBytes.getLength() < nBytesToRead )
 {
 aReadBytes.realloc( nBytesToRead );
 }
-return m_pipe.read( aReadBytes.getArray()  , 
aReadBytes.getLength() );
+sal_Int32 n = m_pipe.read( aReadBytes.getArray()  , 
aReadBytes.getLength() );
+if( n < aReadBytes.getLength() )
+{
+aReadBytes.realloc( n );
+}
+return n;
 }
 else {
 throw IOException();
diff --git a/io/source/connector/ctr_socket.cxx 
b/io/source/connector/ctr_socket.cxx
index 2c0d3f6..787a470 100644
--- a/io/source/connector/ctr_socket.cxx
+++ b/io/source/connector/ctr_socket.cxx
@@ -123,7 +123,7 @@ namespace stoc_connector {
 {
 notifyListeners(this, &_started, callStarted);
 
-if( aReadBytes.getLength() != nBytesToRead )
+if( aReadBytes.getLength() < nBytesToRead )
 {
 aReadBytes.realloc( nBytesToRead );
 }
@@ -143,7 +143,10 @@ namespace stoc_connector {
 
 throw ioException;
 }
-
+if( i < aReadBytes.getLength() )
+{
+aReadBytes.realloc( i );
+}
 return i;
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source

2015-11-10 Thread Mario J . Rugiero
 io/source/acceptor/acc_socket.cxx  |5 +++--
 io/source/connector/ctr_socket.cxx |5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit b62f1bd5bf850ce18bafa332d5da121939bb5133
Author: Mario J. Rugiero 
Date:   Mon Nov 9 11:37:26 2015 -0300

Replaced for_each and algorithm include by range based loop and exception.

Since the only thing used from algorithm was std::for_each, and 
std::exception
was being used without including it.

Change-Id: Ida415bfbcae2b14811183a6afa46b6f6e1ac6ab2
Reviewed-on: https://gerrit.libreoffice.org/19864
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/io/source/acceptor/acc_socket.cxx 
b/io/source/acceptor/acc_socket.cxx
index a5321eb..976b782 100644
--- a/io/source/acceptor/acc_socket.cxx
+++ b/io/source/acceptor/acc_socket.cxx
@@ -19,7 +19,7 @@
 
 #include "acceptor.hxx"
 
-#include 
+#include 
 #include 
 
 #include 
@@ -123,7 +123,8 @@ namespace io_acceptor {
 }
 }
 
-::std::for_each(listeners.begin(), listeners.end(), t);
+for(auto& listener : listeners)
+t(listener);
 }
 
 static void callStarted(Reference xStreamListener)
diff --git a/io/source/connector/ctr_socket.cxx 
b/io/source/connector/ctr_socket.cxx
index 6b53436..3d7e320 100644
--- a/io/source/connector/ctr_socket.cxx
+++ b/io/source/connector/ctr_socket.cxx
@@ -20,7 +20,7 @@
 
 #include "connector.hxx"
 #include 
-#include 
+#include 
 
 using namespace ::osl;
 using namespace ::com::sun::star::uno;
@@ -43,7 +43,8 @@ namespace stoc_connector {
 }
 }
 
-::std::for_each(listeners.begin(), listeners.end(), t);
+for(auto& listener : listeners)
+t(listener);
 }
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source

2015-11-02 Thread Stephan Bergmann
 io/source/TextInputStream/TextInputStream.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 84eeebd75010a6263fc6aba0ebc16014013a3410
Author: Stephan Bergmann 
Date:   Tue Nov 3 08:48:10 2015 +0100

Fix create/destroy mismatch

Change-Id: Ibff6caedae0c5ed84cf4864c7a52af56a7cea527

diff --git a/io/source/TextInputStream/TextInputStream.cxx 
b/io/source/TextInputStream/TextInputStream.cxx
index 6a4d97b..98db657 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -129,8 +129,8 @@ OTextInputStream::~OTextInputStream()
 {
 if( mbEncodingInitialized )
 {
-rtl_destroyUnicodeToTextContext( mConvText2Unicode, 
mContextText2Unicode );
-rtl_destroyUnicodeToTextConverter( mConvText2Unicode );
+rtl_destroyTextToUnicodeContext( mConvText2Unicode, 
mContextText2Unicode );
+rtl_destroyTextToUnicodeConverter( mConvText2Unicode );
 }
 
 delete[] mpBuffer;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source io/test

2015-10-23 Thread Noel Grandin
 io/source/acceptor/acc_pipe.cxx|   36 +--
 io/source/acceptor/acc_socket.cxx  |   64 +-
 io/source/acceptor/acceptor.hxx|4 +-
 io/source/connector/connector.hxx  |   68 ++---
 io/source/connector/ctr_pipe.cxx   |   18 -
 io/source/connector/ctr_socket.cxx |   18 -
 io/source/stm/odata.cxx|8 ++--
 io/source/stm/opump.cxx|   22 +--
 io/test/stm/pumptest.cxx   |   12 +++---
 9 files changed, 125 insertions(+), 125 deletions(-)

New commits:
commit 63cec254e7ce54c7f919442002187638ff5dfed1
Author: Noel Grandin 
Date:   Fri Oct 23 10:44:22 2015 +0200

com::sun::star->css in io

Change-Id: I4a0cd4b29db91584c23148d659846c71b90b0d65

diff --git a/io/source/acceptor/acc_pipe.cxx b/io/source/acceptor/acc_pipe.cxx
index 9ca89e4..37097aa 100644
--- a/io/source/acceptor/acc_pipe.cxx
+++ b/io/source/acceptor/acc_pipe.cxx
@@ -46,19 +46,19 @@ namespace io_acceptor
 virtual ~PipeConnection();
 
 virtual sal_Int32 SAL_CALL read( Sequence< sal_Int8 >& aReadBytes, 
sal_Int32 nBytesToRead )
-throw(::com::sun::star::io::IOException,
-  ::com::sun::star::uno::RuntimeException, std::exception) 
override;
+throw(css::io::IOException,
+  css::uno::RuntimeException, std::exception) override;
 virtual void SAL_CALL write( const Sequence< sal_Int8 >& aData )
-throw(::com::sun::star::io::IOException,
-  ::com::sun::star::uno::RuntimeException, std::exception) 
override;
+throw(css::io::IOException,
+  css::uno::RuntimeException, std::exception) override;
 virtual void SAL_CALL flush(  ) throw(
-::com::sun::star::io::IOException,
-::com::sun::star::uno::RuntimeException, std::exception) override;
+css::io::IOException,
+css::uno::RuntimeException, std::exception) override;
 virtual void SAL_CALL close(  )
-throw(::com::sun::star::io::IOException,
-  ::com::sun::star::uno::RuntimeException, std::exception) 
override;
+throw(css::io::IOException,
+  css::uno::RuntimeException, std::exception) override;
 virtual OUString SAL_CALL getDescription(  )
-throw(::com::sun::star::uno::RuntimeException, std::exception) 
override;
+throw(css::uno::RuntimeException, std::exception) override;
 public:
 ::osl::StreamPipe m_pipe;
 oslInterlockedCount m_nStatus;
@@ -83,8 +83,8 @@ namespace io_acceptor
 }
 
 sal_Int32 PipeConnection::read( Sequence < sal_Int8 > & aReadBytes , 
sal_Int32 nBytesToRead )
-throw(::com::sun::star::io::IOException,
-  ::com::sun::star::uno::RuntimeException, std::exception)
+throw(css::io::IOException,
+  css::uno::RuntimeException, std::exception)
 {
 if( ! m_nStatus )
 {
@@ -106,8 +106,8 @@ namespace io_acceptor
 }
 
 void PipeConnection::write( const Sequence < sal_Int8 >  )
-throw(::com::sun::star::io::IOException,
-  ::com::sun::star::uno::RuntimeException, std::exception)
+throw(css::io::IOException,
+  css::uno::RuntimeException, std::exception)
 {
 if( ! m_nStatus )
 {
@@ -122,14 +122,14 @@ namespace io_acceptor
 }
 
 void PipeConnection::flush( )
-throw(  ::com::sun::star::io::IOException,
-::com::sun::star::uno::RuntimeException, std::exception)
+throw(  css::io::IOException,
+css::uno::RuntimeException, std::exception)
 {
 }
 
 void PipeConnection::close()
-throw( ::com::sun::star::io::IOException,
-   ::com::sun::star::uno::RuntimeException, std::exception)
+throw( css::io::IOException,
+   css::uno::RuntimeException, std::exception)
 {
 if(  1 == osl_atomic_increment( (_nStatus) ) )
 {
@@ -138,7 +138,7 @@ namespace io_acceptor
 }
 
 OUString PipeConnection::getDescription()
-throw(::com::sun::star::uno::RuntimeException, std::exception)
+throw(css::uno::RuntimeException, std::exception)
 {
 return m_sDescription;
 }
diff --git a/io/source/acceptor/acc_socket.cxx 
b/io/source/acceptor/acc_socket.cxx
index e5bdf63..a5321eb 100644
--- a/io/source/acceptor/acc_socket.cxx
+++ b/io/source/acceptor/acc_socket.cxx
@@ -40,7 +40,7 @@ namespace io_acceptor {
 template
 struct ReferenceHash
 {
-size_t operator () (const ::com::sun::star::uno::Reference & ref) 
const
+size_t operator () (const css::uno::Reference & ref) const
 {
 return reinterpret_cast(ref.get());
 }
@@ -49,50 +49,50 @@ namespace io_acceptor {
 template
 struct ReferenceEqual
 {
-

[Libreoffice-commits] core.git: io/source

2015-07-08 Thread Stephan Bergmann
 io/source/stm/streamhelper.hxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 8585e0a1fd7a31a6ee85b05fdff57b11797e0ea3
Author: Stephan Bergmann sberg...@redhat.com
Date:   Wed Jul 8 20:59:29 2015 +0200

Avoid loplugin:staticmethods in non-debug build

Change-Id: I205531a51f9d3e6611aafc5eb8fbd1ab49a517d8

diff --git a/io/source/stm/streamhelper.hxx b/io/source/stm/streamhelper.hxx
index 0275557..1fa232b 100644
--- a/io/source/stm/streamhelper.hxx
+++ b/io/source/stm/streamhelper.hxx
@@ -118,6 +118,7 @@ private:
 assert( m_nOccupiedBuffer = m_nBufferLen );
 assert( m_nStart = 0 );
 assert( 0 == m_nStart || m_nStart  m_nBufferLen );
+(void) this; // avoid loplugin:staticmethods
 }
 
 sal_Int8*m_p;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source jurt/com

2015-01-20 Thread Noel Grandin
 io/source/acceptor/acc_socket.cxx |6 +-
 io/source/connector/connector.cxx |4 +++-
 jurt/com/sun/star/lib/connections/socket/socketAcceptor.java  |8 
 jurt/com/sun/star/lib/connections/socket/socketConnector.java |6 +-
 4 files changed, 17 insertions(+), 7 deletions(-)

New commits:
commit c9e6b5854197dd33d4e20ed78aee8382472a0f01
Author: Noel Grandin n...@peralex.com
Date:   Sun Jan 11 13:54:04 2015 +0200

enable tcpNoDelay for loopback connections automatically

it can make a significant speed difference for applications
talking to the office binary via UNO

Change-Id: If6e901908fe6a6119ac1fd0bf8feebabe5602ff7
Reviewed-on: https://gerrit.libreoffice.org/13856
Reviewed-by: Noel Grandin noelgran...@gmail.com
Tested-by: Noel Grandin noelgran...@gmail.com

diff --git a/io/source/acceptor/acc_socket.cxx 
b/io/source/acceptor/acc_socket.cxx
index 830a9b3..89fb44d 100644
--- a/io/source/acceptor/acc_socket.cxx
+++ b/io/source/acceptor/acc_socket.cxx
@@ -380,7 +380,11 @@ namespace io_acceptor {
 }
 
 pConn-completeConnectionString();
-if( m_bTcpNoDelay )
+OUString remoteHostname = pConn-m_addr.getHostname();
+// we enable tcpNoDelay for loopback connections because
+// it can make a significant speed difference on linux boxes.
+if( m_bTcpNoDelay || remoteHostname == localhost ||
+remoteHostname.startsWith(127.0.0.) )
 {
 sal_Int32 nTcpNoDelay = sal_True;
 pConn-m_socket.setOption( osl_Socket_OptionTcpNoDelay , 
nTcpNoDelay,
diff --git a/io/source/connector/connector.cxx 
b/io/source/connector/connector.cxx
index 0aca22c..81bfdb6 100644
--- a/io/source/connector/connector.cxx
+++ b/io/source/connector/connector.cxx
@@ -132,7 +132,9 @@ namespace stoc_connector
 delete pConn;
 throw NoConnectException( sMessage );
 }
-if( bTcpNoDelay )
+// we enable tcpNoDelay for loopback connections because
+// it can make a significant speed difference on linux boxes.
+if( bTcpNoDelay || aHost == localhost || 
aHost.startsWith(127.0.0.) )
 {
 sal_Int32 nTcpNoDelay = sal_True;
 pConn-m_socket.setOption( osl_Socket_OptionTcpNoDelay , 
nTcpNoDelay,
diff --git a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java 
b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
index e3dbea7..85790df 100644
--- a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
+++ b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
@@ -28,9 +28,7 @@ import com.sun.star.lang.XSingleServiceFactory;
 import com.sun.star.registry.XRegistryKey;
 
 import java.io.IOException;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
+import java.net.*;
 
 /**
  * A component that implements the codeXAcceptor/code interface.
@@ -152,7 +150,9 @@ public final class socketAcceptor implements XAcceptor {
 System.err.println(#  + getClass().getName()
+ .accept: accepted  + socket);
 }
-if (tcpNoDelay != null) {
+// we enable tcpNoDelay for loopback connections because
+// it can make a significant speed difference on linux boxes.
+if (tcpNoDelay != null || 
((InetSocketAddress)socket.getRemoteSocketAddress()).getAddress().isLoopbackAddress())
 {
 socket.setTcpNoDelay(tcpNoDelay.booleanValue());
 }
 return new SocketConnection(acceptingDescription, socket);
diff --git a/jurt/com/sun/star/lib/connections/socket/socketConnector.java 
b/jurt/com/sun/star/lib/connections/socket/socketConnector.java
index a0c4937..1d3c2b1 100644
--- a/jurt/com/sun/star/lib/connections/socket/socketConnector.java
+++ b/jurt/com/sun/star/lib/connections/socket/socketConnector.java
@@ -131,8 +131,10 @@ public final class socketConnector implements XConnector {
 throw new ConnectionSetupException(e);
 }
 Socket socket = null;
+boolean isLoopbackAddress = false;
 for (int i = 0; i  adr.length; ++i) {
 try {
+isLoopbackAddress = adr[i].isLoopbackAddress();
 socket = new Socket(adr[i], desc.getPort());
 break;
 } catch (IOException e) {
@@ -142,7 +144,9 @@ public final class socketConnector implements XConnector {
 }
 XConnection con;
 try {
-if (desc.getTcpNoDelay() != null)
+// we enable tcpNoDelay for loopback connections because
+// it can make a significant speed difference on linux boxes.
+if (desc.getTcpNoDelay() != null || isLoopbackAddress)
 

[Libreoffice-commits] core.git: io/source

2014-11-21 Thread Stephan Bergmann
 io/source/TextInputStream/TextInputStream.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7a0bfcbce147eff61dc9b7d243b571dd34110df8
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Nov 21 18:31:31 2014 +0100

fdo#79941: Properly handle short reads

Change-Id: Ie762ff272410d809382f98a1d446946b566df747

diff --git a/io/source/TextInputStream/TextInputStream.cxx 
b/io/source/TextInputStream/TextInputStream.cxx
index 1f2db18..ceee33a 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -294,7 +294,7 @@ sal_Int32 OTextInputStream::implReadNext()
 sal_Int32 nBytesToRead = READ_BYTE_COUNT;
 sal_Int32 nRead = mxStream-readSomeBytes( mSeqSource, nBytesToRead );
 sal_Int32 nTotalRead = nRead;
-if( nRead  nBytesToRead )
+if( nRead == 0 )
 mbReachedEOF = true;
 
 // Try to convert
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source

2014-05-30 Thread Noel Grandin
 io/source/connector/connector.hxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5d13b6e8216178258a3ffb5ef4793669099183e4
Author: Noel Grandin n...@peralex.com
Date:   Fri May 30 09:01:35 2014 +0200

fix . in #define

as a consequence of
commit 9e3cc6b47444f988a68ca3ddcad779ed0480b00c
fdo#68849: Add header guards to all include files

Change-Id: Ibabf0d88ff4d928311ad5079ac3aa1fd6a2c1e6d

diff --git a/io/source/connector/connector.hxx 
b/io/source/connector/connector.hxx
index b113097..cf24e18 100644
--- a/io/source/connector/connector.hxx
+++ b/io/source/connector/connector.hxx
@@ -17,8 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_IO_SOURCE_CONNECTOR_CONNECTOR.HXX
-#define INCLUDED_IO_SOURCE_CONNECTOR_CONNECTOR.HXX
+#ifndef INCLUDED_IO_SOURCE_CONNECTOR_CONNECTOR_HXX
+#define INCLUDED_IO_SOURCE_CONNECTOR_CONNECTOR_HXX
 
 #include cppuhelper/implbase1.hxx
 #include cppuhelper/implbase2.hxx
@@ -133,6 +133,6 @@ namespace stoc_connector
 };
 }
 
-#endif // INCLUDED_IO_SOURCE_CONNECTOR_CONNECTOR.HXX
+#endif // INCLUDED_IO_SOURCE_CONNECTOR_CONNECTOR_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source io/test

2014-02-26 Thread Alexander Wilms
 io/source/TextInputStream/TextInputStream.cxx   |8 
 io/source/TextOutputStream/TextOutputStream.cxx |8 
 io/source/stm/omark.cxx |4 ++--
 io/test/testcomponent.cxx   |3 +--
 4 files changed, 11 insertions(+), 12 deletions(-)

New commits:
commit 043e378521faecfcc09e0d7007de93882c50c461
Author: Alexander Wilms f.alexander.wi...@gmail.com
Date:   Tue Feb 25 19:07:42 2014 +0100

Remove visual noise from io

Change-Id: I46f8c4f793596b0e6feb2db7b9302b9b6eb9644b
Reviewed-on: https://gerrit.libreoffice.org/8273
Tested-by: Caolán McNamara caol...@redhat.com
Reviewed-by: Caolán McNamara caol...@redhat.com

diff --git a/io/source/TextInputStream/TextInputStream.cxx 
b/io/source/TextInputStream/TextInputStream.cxx
index 07379af..d6df3a2 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -48,7 +48,7 @@ using namespace ::com::sun::star::registry;
 
 namespace io_TextInputStream
 {
-//===
+
 // Implementation XTextInputStream
 
 typedef WeakImplHelper2 XTextInputStream2, XServiceInfo  
TextInputStreamHelper;
@@ -145,7 +145,7 @@ void OTextInputStream::implResizeBuffer( void )
 }
 
 
-//===
+
 // XTextInputStream
 
 OUString OTextInputStream::readLine(  )
@@ -379,7 +379,7 @@ void OTextInputStream::setEncoding( const OUString 
Encoding )
 mEncoding = Encoding;
 }
 
-//===
+
 // XInputStream
 
 sal_Int32 OTextInputStream::readBytes( Sequence sal_Int8  aData, sal_Int32 
nBytesToRead )
@@ -413,7 +413,7 @@ void OTextInputStream::closeInput(  )
 }
 
 
-//===
+
 // XActiveDataSink
 
 void OTextInputStream::setInputStream( const Reference XInputStream  
aStream )
diff --git a/io/source/TextOutputStream/TextOutputStream.cxx 
b/io/source/TextOutputStream/TextOutputStream.cxx
index e26d515..6c1988e 100644
--- a/io/source/TextOutputStream/TextOutputStream.cxx
+++ b/io/source/TextOutputStream/TextOutputStream.cxx
@@ -48,7 +48,7 @@ using namespace ::com::sun::star::registry;
 
 namespace io_TextOutputStream
 {
-//===
+
 // Implementation XTextOutputStream
 
 typedef WeakImplHelper2 XTextOutputStream2, XServiceInfo  
TextOutputStreamHelper;
@@ -159,7 +159,7 @@ Sequencesal_Int8 OTextOutputStream::implConvert( const 
OUString rSource )
 }
 
 
-//===
+
 // XTextOutputStream
 
 void OTextOutputStream::writeString( const OUString aString )
@@ -192,7 +192,7 @@ void OTextOutputStream::setEncoding( const OUString 
Encoding )
 mEncoding = Encoding;
 }
 
-//===
+
 // XOutputStream
 void OTextOutputStream::writeBytes( const Sequence sal_Int8  aData )
 throw(NotConnectedException, BufferSizeExceededException, IOException, 
RuntimeException)
@@ -226,7 +226,7 @@ void OTextOutputStream::checkOutputStream()
 }
 
 
-//===
+
 // XActiveDataSource
 
 void OTextOutputStream::setOutputStream( const Reference XOutputStream  
aStream )
diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx
index af47604..7cf5d49 100644
--- a/io/source/stm/omark.cxx
+++ b/io/source/stm/omark.cxx
@@ -472,9 +472,9 @@ SequenceOUString 
OMarkableOutputStream_getSupportedServiceNames(void)
 
 
 
-//
+
 // XMarkableInputStream
-//
+
 
 
 class OMarkableInputStream :
diff --git a/io/test/testcomponent.cxx b/io/test/testcomponent.cxx
index 260c723..10204c8 100644
--- a/io/test/testcomponent.cxx
+++ b/io/test/testcomponent.cxx
@@ -23,8 +23,7 @@
 // Expands the dll-names depending on the actual environment.
 // Example : testcomponent com.sun.star.io.Pipe stm
 //
-// Therefor the testcode must exist in teststm and the testservice must be 
named test.com.sun.star.io.Pipe
-//
+// Therefore the testcode must exist in teststm and the testservice must be 
named test.com.sun.star.io.Pipe
 
 #include stdio.h
 #include com/sun/star/registry/XImplementationRegistration.hpp
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source

2013-10-22 Thread Jürgen Schmidt
 io/source/TextOutputStream/TextOutputStream.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit ed445d95eda257aef5efeb4ed55ceb43a00b8343
Author: Jürgen Schmidt j...@apache.org
Date:   Mon Oct 21 15:55:06 2013 +

Resolves: #i75731# check output stream and...

throw IOExceptioin if it is not intialized

(cherry picked from commit cf17f922f01bd75643749a7fd01a03f8167bccee)

Change-Id: I07f6def513ef54b736689bf22565645f0c313982

diff --git a/io/source/TextOutputStream/TextOutputStream.cxx 
b/io/source/TextOutputStream/TextOutputStream.cxx
index f7d309c..84f9f48 100644
--- a/io/source/TextOutputStream/TextOutputStream.cxx
+++ b/io/source/TextOutputStream/TextOutputStream.cxx
@@ -63,6 +63,7 @@ class OTextOutputStream : public TextOutputStreamHelper
 rtl_UnicodeToTextContextmContextUnicode2Text;
 
 Sequencesal_Int8 implConvert( const OUString rSource );
+void checkOutputStream() throw(IOException);
 
 public:
 OTextOutputStream();
@@ -163,6 +164,7 @@ Sequencesal_Int8 OTextOutputStream::implConvert( const 
OUString rSource )
 void OTextOutputStream::writeString( const OUString aString )
 throw(IOException, RuntimeException)
 {
+checkOutputStream();
 if( !mbEncodingInitialized )
 {
 OUString aUtf8Str(utf8);
@@ -194,22 +196,35 @@ void OTextOutputStream::setEncoding( const OUString 
Encoding )
 void OTextOutputStream::writeBytes( const Sequence sal_Int8  aData )
 throw(NotConnectedException, BufferSizeExceededException, IOException, 
RuntimeException)
 {
+checkOutputStream();
 mxStream-writeBytes( aData );
 }
 
 void OTextOutputStream::flush(  )
 throw(NotConnectedException, BufferSizeExceededException, IOException, 
RuntimeException)
 {
+checkOutputStream();
 mxStream-flush();
 }
 
 void OTextOutputStream::closeOutput(  )
 throw(NotConnectedException, BufferSizeExceededException, IOException, 
RuntimeException)
 {
+checkOutputStream();
 mxStream-closeOutput();
 }
 
 
+void OTextOutputStream::checkOutputStream()
+throw(IOException)
+{
+if (! mxStream.is() )
+throw IOException(
+OUString(output stream is not initialized, you have to use 
setOutputStream first),
+ReferenceXInterface());
+}
+
+
 //===
 // XActiveDataSource
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: io/source lingucomponent/source linguistic/source lotuswordpro/source odk/examples

2013-08-11 Thread Takeshi Abe
 io/source/TextInputStream/TextInputStream.cxx  |2 
+-
 io/source/TextOutputStream/TextOutputStream.cxx|2 
+-
 io/source/acceptor/acceptor.cxx|2 
+-
 io/source/connector/connector.cxx  |2 
+-
 io/source/stm/factreg.cxx  |2 
+-
 lingucomponent/source/languageguessing/guesslang.cxx   |2 
+-
 linguistic/source/gciterator.cxx   |4 
++--
 linguistic/source/lngprophelp.cxx  |2 
+-
 lotuswordpro/source/filter/lwpbackgroundstuff.cxx  |2 
+-
 lotuswordpro/source/filter/lwppttntbl.hxx  |2 
+-
 odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx |2 
+-
 11 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 12b1d1cda3332a09476f703629fef372c2b06b2a
Author: Takeshi Abe t...@fixedpoint.jp
Date:   Mon Aug 12 09:16:31 2013 +0900

Mark as const

Change-Id: I9277052ee9c6197cef7a46bd8f3ab9c5515c2502

diff --git a/io/source/TextInputStream/TextInputStream.cxx 
b/io/source/TextInputStream/TextInputStream.cxx
index 0d6645d..a5b6de3 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -471,7 +471,7 @@ Sequence OUString  
OTextInputStream::getSupportedServiceNames(void) throw()
 
 using namespace io_TextInputStream;
 
-static struct ImplementationEntry g_entries[] =
+static const struct ImplementationEntry g_entries[] =
 {
 {
 TextInputStream_CreateInstance, TextInputStream_getImplementationName ,
diff --git a/io/source/TextOutputStream/TextOutputStream.cxx 
b/io/source/TextOutputStream/TextOutputStream.cxx
index 48db4a9..53487dd 100644
--- a/io/source/TextOutputStream/TextOutputStream.cxx
+++ b/io/source/TextOutputStream/TextOutputStream.cxx
@@ -271,7 +271,7 @@ Sequence OUString  
OTextOutputStream::getSupportedServiceNames(void) throw()
 
 using namespace io_TextOutputStream;
 
-static struct ImplementationEntry g_entries[] =
+static const struct ImplementationEntry g_entries[] =
 {
 {
 TextOutputStream_CreateInstance, 
TextOutputStream_getImplementationName ,
diff --git a/io/source/acceptor/acceptor.cxx b/io/source/acceptor/acceptor.cxx
index bf28d7b..8f94584 100644
--- a/io/source/acceptor/acceptor.cxx
+++ b/io/source/acceptor/acceptor.cxx
@@ -311,7 +311,7 @@ namespace io_acceptor
 
 using namespace io_acceptor;
 
-static struct ImplementationEntry g_entries[] =
+static const struct ImplementationEntry g_entries[] =
 {
 {
 acceptor_CreateInstance, acceptor_getImplementationName ,
diff --git a/io/source/connector/connector.cxx 
b/io/source/connector/connector.cxx
index e6df227..5356f39 100644
--- a/io/source/connector/connector.cxx
+++ b/io/source/connector/connector.cxx
@@ -216,7 +216,7 @@ namespace stoc_connector
 }
 using namespace stoc_connector;
 
-static struct ImplementationEntry g_entries[] =
+static const struct ImplementationEntry g_entries[] =
 {
 {
 connector_CreateInstance, connector_getImplementationName ,
diff --git a/io/source/stm/factreg.cxx b/io/source/stm/factreg.cxx
index 935f2a5..6fb39e7 100644
--- a/io/source/stm/factreg.cxx
+++ b/io/source/stm/factreg.cxx
@@ -34,7 +34,7 @@ using namespace ::com::sun::star::registry;
 
 using namespace io_stm;
 
-static struct ImplementationEntry g_entries[] =
+static const struct ImplementationEntry g_entries[] =
 {
 {
 OPipeImpl_CreateInstance, OPipeImpl_getImplementationName ,
diff --git a/lingucomponent/source/languageguessing/guesslang.cxx 
b/lingucomponent/source/languageguessing/guesslang.cxx
index d8777c6..b5370e7 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -401,7 +401,7 @@ Reference XInterface  SAL_CALL LangGuess_Impl_create(
 // EXPORTED ### functions to allow for registration and creation of the 
UNO component
 
//##
 
-static struct ::cppu::ImplementationEntry s_component_entries [] =
+static const struct ::cppu::ImplementationEntry s_component_entries [] =
 {
 {
 LangGuess_Impl_create, getImplementationName_LangGuess_Impl,
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index d701126..d7382e3 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -76,7 +76,7 @@ static uno::Sequence OUString  
GrammarCheckingIterator_getSupportedServiceName
 
 
 // white space list: obtained from the fonts.config.txt of a Linux system.
-static sal_Unicode aWhiteSpaces[] =
+static const sal_Unicode aWhiteSpaces[] =
 {
 0x0020,   /* SPACE */
 0x00a0,   /* NO-BREAK SPACE */
@@ -128,7 +128,7 @@ static 

[Libreoffice-commits] core.git: io/source

2013-07-01 Thread Mark Wielaard
 io/source/TextInputStream/TextInputStream.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 2fc0fa62b26ce34675fcb94de59194592421eeb5
Author: Mark Wielaard m...@klomp.org
Date:   Sun Jun 30 17:03:37 2013 +0200

Fix memory leak in OTextInputStream.

Delete mpBuffer when done in destructor or replaced in implResizeBuffer.

Change-Id: Ide1b44f10a482ce9bb6135fb879e62e0a8ccea29
Reviewed-on: https://gerrit.libreoffice.org/4637
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/io/source/TextInputStream/TextInputStream.cxx 
b/io/source/TextInputStream/TextInputStream.cxx
index ff734fa..0d6645d 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -128,6 +128,8 @@ OTextInputStream::~OTextInputStream()
 rtl_destroyUnicodeToTextContext( mConvText2Unicode, 
mContextText2Unicode );
 rtl_destroyUnicodeToTextConverter( mConvText2Unicode );
 }
+
+delete[] mpBuffer;
 }
 
 void OTextInputStream::implResizeBuffer( void )
@@ -135,6 +137,7 @@ void OTextInputStream::implResizeBuffer( void )
 sal_Int32 mnNewBufferSize = mnBufferSize * 2;
 sal_Unicode* pNewBuffer = new sal_Unicode[ mnNewBufferSize ];
 memcpy( pNewBuffer, mpBuffer, mnCharsInBuffer * sizeof( sal_Unicode ) );
+delete[] mpBuffer;
 mpBuffer = pNewBuffer;
 mnBufferSize = mnNewBufferSize;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits