summaryrefslogtreecommitdiff
path: root/sal/rtl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-11 08:47:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-15 07:26:17 +0100
commit7d8e94444d989d0ac4a4055b207726708e9ec0da (patch)
treece3e4a09ed7932496c4d901360ff23787c8f6e24 /sal/rtl
parent80fb8d406ced47e6a2089f0c8ba5c103d2fec91f (diff)
convert a<b?a:b to std::min(a,b)
with something like git grep -nP '(.*)\s*<\s*(.*)\s*\?\s*\g1\s*:\s*\g2' -- *.?xx Change-Id: Id5078b35961847feb78a66204fdb7598ee63fd23 Note: we also convert a>b?b:a Reviewed-on: https://gerrit.libreoffice.org/47736 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/rtl')
-rw-r--r--sal/rtl/alloc_cache.cxx3
-rw-r--r--sal/rtl/alloc_global.cxx2
-rw-r--r--sal/rtl/cipher.cxx3
-rw-r--r--sal/rtl/math.cxx2
-rw-r--r--sal/rtl/ustring.cxx2
5 files changed, 7 insertions, 5 deletions
diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx
index 6a3eea86d6a0..d9aeb7edcc77 100644
--- a/sal/rtl/alloc_cache.cxx
+++ b/sal/rtl/alloc_cache.cxx
@@ -31,6 +31,7 @@
#if defined(SAL_UNX)
#include <sys/time.h>
#endif
+#include <algorithm>
/**
* @internal
@@ -1283,7 +1284,7 @@ static void rtl_cache_depot_wsupdate(
depot->m_prev_min = depot->m_curr_min;
depot->m_curr_min = depot->m_mag_count;
- npurge = depot->m_curr_min < depot->m_prev_min ? depot->m_curr_min : depot->m_prev_min;
+ npurge = std::min(depot->m_curr_min, depot->m_prev_min);
for (; npurge > 0; npurge--)
{
rtl_cache_magazine_type * mag = rtl_cache_depot_dequeue (depot);
diff --git a/sal/rtl/alloc_global.cxx b/sal/rtl/alloc_global.cxx
index 25e2c1ea78b6..efbd2748dbf8 100644
--- a/sal/rtl/alloc_global.cxx
+++ b/sal/rtl/alloc_global.cxx
@@ -137,7 +137,7 @@ void * rtl_reallocateMemory_CUSTOM (void * p, sal_Size n) SAL_THROW_EXTERN_C()
p = rtl_allocateMemory (n);
if (p)
{
- memcpy (p, p_old, (n < n_old) ? n : n_old);
+ memcpy (p, p_old, std::min(n, n_old));
rtl_freeMemory (p_old);
}
}
diff --git a/sal/rtl/cipher.cxx b/sal/rtl/cipher.cxx
index 9a64ac4364b0..62f3104be3ed 100644
--- a/sal/rtl/cipher.cxx
+++ b/sal/rtl/cipher.cxx
@@ -22,6 +22,7 @@
#include <sal/types.h>
#include <rtl/alloc.h>
#include <rtl/cipher.h>
+#include <algorithm>
#define RTL_CIPHER_NTOHL(c, l) \
((l) = (static_cast<sal_uInt32>(*((c)++))) << 24, \
@@ -660,7 +661,7 @@ static rtlCipherError BF_init(
if (pArgData && nArgLen)
{
- nArgLen = ((nArgLen < 8) ? nArgLen : 8);
+ nArgLen = std::min<sal_Size>(nArgLen, 8);
if (eMode == rtl_Cipher_ModeStream)
{
memcpy(ctx->m_iv.m_byte, pArgData, nArgLen);
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index f8a0f9dcec47..4b149b9f99dd 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -443,7 +443,7 @@ inline void doubleToString(typename T::String ** pResult,
// Round the number
if(nDigits >= 0)
{
- if ((fValue += nRoundVal[nDigits > 15 ? 15 : nDigits] ) >= 10)
+ if ((fValue += nRoundVal[std::min<sal_Int32>(nDigits, 15)] ) >= 10)
{
fValue = 1.0;
nExp++;
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index d562c7c736a1..64fb1c3edd39 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -436,7 +436,7 @@ sal_Int32 rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
{
assert(firstLen >= 0 && secondLen >= 0);
sal_Int32 i;
- sal_Int32 len = firstLen < secondLen ? firstLen : secondLen;
+ sal_Int32 len = std::min(firstLen, secondLen);
for (i = 0; i < len; ++i) {
/* Check ASCII range */
SAL_WARN_IF( (static_cast<unsigned char>(*second)) > 127, "rtl.string",