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

Noel Grandin noel.grandin at collabora.co.uk
Mon Jan 15 09:36:58 UTC 2018


 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 <noel.grandin at collabora.co.uk>
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 <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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<sal_Int32>(nMaxBytesToRead-nInBuffer,m_input->available());
+        nAdditionalBytesToRead = std::max<sal_Int32>(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<sal_Int8> &seq )
         // 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 <assert.h>
 
-#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,
                     &rep, &pos, &cut, 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, 2))) );
+                    std::max<sal_Int16>(dict->clhmin, std::max<sal_Int16>(dict->clhmin, 2) + std::max(0, minLead  - std::max<sal_Int16>(dict->lhmin, 2))),
+                    std::max<sal_Int16>(dict->crhmin, std::max<sal_Int16>(dict->crhmin, 2) + std::max(0, minTrail - std::max<sal_Int16>(dict->rhmin, 2))) );
             if (bFailed)
             {
                 // whoops something did not work
@@ -600,8 +597,8 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const
         {
             const bool bFailed = 0 != hnj_hyphen_hyphenate3(dict, lcword.get(), n, hyphens.get(), nullptr,
                     &rep, &pos, &cut, 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, 2))) );
+                    std::max<sal_Int16>(dict->clhmin, std::max<sal_Int16>(dict->clhmin, 2) + std::max(0, minLead - std::max<sal_Int16>(dict->lhmin, 2))),
+                    std::max<sal_Int16>(dict->crhmin, std::max<sal_Int16>(dict->crhmin, 2) + std::max(0, minTrail - std::max<sal_Int16>(dict->rhmin, 2))) );
             if (bFailed)
             {
                 if (rep)
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 71403d35e82f..148c23fefaa5 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -309,8 +309,6 @@ void FileStreamWrapper_Impl::checkError()
 #define COMMIT_RESULT_NOTHING_TO_DO     1
 #define COMMIT_RESULT_SUCCESS           2
 
-#define min( x, y ) (( x < y ) ? x : y)
-
 SotClipboardFormatId GetFormatId_Impl( const SvGlobalName& aName )
 {
     if ( aName == SvGlobalName( SO3_SW_CLASSID_60 ) )
@@ -803,7 +801,7 @@ sal_uInt64 UCBStorageStream_Impl::ReadSourceWriteTemporary(sal_uInt64 aLength)
 
             for (sal_uInt64 nInd = 0; nInd < aLength && aReaded == 32000 ; nInd += 32000)
             {
-                sal_uLong aToCopy = min( aLength - nInd, 32000 );
+                sal_uLong aToCopy = std::min<sal_uInt64>( aLength - nInd, 32000 );
                 aReaded = m_rSource->readBytes( aData, aToCopy );
                 aResult += m_pStream->WriteBytes(aData.getArray(), aReaded);
             }


More information about the Libreoffice-commits mailing list