summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--registry/source/reflcnst.hxx6
-rw-r--r--registry/source/reflwrit.cxx13
-rw-r--r--sal/inc/sal/macros.h4
-rw-r--r--sal/osl/unx/pipe.c2
-rw-r--r--sal/osl/unx/security.c2
-rw-r--r--sal/rtl/source/alloc_cache.cxx7
-rw-r--r--sal/rtl/source/alloc_global.cxx2
-rw-r--r--store/source/stordata.hxx4
-rw-r--r--store/source/storlckb.cxx21
-rw-r--r--unotools/source/ucbhelper/ucblockbytes.cxx5
10 files changed, 45 insertions, 21 deletions
diff --git a/registry/source/reflcnst.hxx b/registry/source/reflcnst.hxx
index fa53d8efe70d..009dcdb90fec 100644
--- a/registry/source/reflcnst.hxx
+++ b/registry/source/reflcnst.hxx
@@ -258,7 +258,11 @@ inline sal_uInt32 writeUtf8(sal_uInt8* buffer, const sal_Char* v)
inline sal_uInt32 readUtf8(const sal_uInt8* buffer, sal_Char* v, sal_uInt32 maxSize)
{
- sal_uInt32 size = SAL_MIN(strlen((const sal_Char*) buffer) + 1, maxSize);
+ sal_uInt32 size = strlen((const sal_Char*) buffer) + 1;
+ if(size > maxSize)
+ {
+ size = maxSize;
+ }
memcpy(v, buffer, size);
diff --git a/registry/source/reflwrit.cxx b/registry/source/reflwrit.cxx
index 1c644e956eee..25fbef6e50c0 100644
--- a/registry/source/reflwrit.cxx
+++ b/registry/source/reflwrit.cxx
@@ -116,10 +116,15 @@ sal_uInt32 writeString(sal_uInt8* buffer, const sal_Unicode* v)
sal_uInt32 readString(const sal_uInt8* buffer, sal_Unicode* v, sal_uInt32 maxSize)
{
- sal_uInt32 len = SAL_MIN(UINT16StringLen(buffer) + 1, maxSize / 2);
+ sal_uInt32 len = UINT16StringLen(buffer) + 1;
sal_uInt32 i;
sal_uInt8* buff = (sal_uInt8*)buffer;
+ if(len > maxSize / 2)
+ {
+ len = maxSize / 2;
+ }
+
for (i = 0; i < (len - 1); i++)
{
sal_uInt16 aChar;
@@ -615,8 +620,9 @@ void MethodEntry::reallocParams(sal_uInt16 size)
if (m_paramCount)
{
sal_uInt16 i;
+ sal_uInt16 mn = size < m_paramCount ? size : m_paramCount;
- for (i = 0; i < SAL_MIN(size, m_paramCount); i++)
+ for (i = 0; i < mn; i++)
{
newParams[i].setData(m_params[i].m_typeName, m_params[i].m_name, m_params[i].m_mode);
}
@@ -638,8 +644,9 @@ void MethodEntry::reallocExcs(sal_uInt16 size)
newExcNames = NULL;
sal_uInt16 i;
+ sal_uInt16 mn = size < m_excCount ? size : m_excCount;
- for (i = 0; i < SAL_MIN(size, m_excCount); i++)
+ for (i = 0; i < mn; i++)
{
newExcNames[i] = m_excNames[i];
}
diff --git a/sal/inc/sal/macros.h b/sal/inc/sal/macros.h
index fb52d3c686a6..6f10585c542e 100644
--- a/sal/inc/sal/macros.h
+++ b/sal/inc/sal/macros.h
@@ -32,10 +32,6 @@
#include <stddef.h>
-#ifndef SAL_MIN
-# define SAL_MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
#ifndef SAL_N_ELEMENTS
# if defined(__cplusplus) && ( defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L )
/*
diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c
index 48b3f3817197..518559058f27 100644
--- a/sal/osl/unx/pipe.c
+++ b/sal/osl/unx/pipe.c
@@ -179,7 +179,7 @@ cpyBootstrapSocketPath(sal_Char *name, size_t len)
OUSTRING_TO_OSTRING_CVTFLAGS);
if (pStrValue && pStrValue->length > 0)
{
- size_t nCopy = SAL_MIN (len-1, (size_t)pStrValue->length);
+ size_t nCopy = (len-1 < (size_t)pStrValue->length) ? len-1 : (size_t)pStrValue->length;
strncpy (name, pStrValue->buffer, nCopy);
name[nCopy] = '\0';
bRet = (size_t)pStrValue->length < len;
diff --git a/sal/osl/unx/security.c b/sal/osl/unx/security.c
index 96605fc1739c..e138ba8272da 100644
--- a/sal/osl/unx/security.c
+++ b/sal/osl/unx/security.c
@@ -327,7 +327,7 @@ static sal_Bool SAL_CALL osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszD
OUSTRING_TO_OSTRING_CVTFLAGS);
if (pStrValue && pStrValue->length > 0)
{
- sal_Int32 nCopy = SAL_MIN ((sal_Int32)(nMax-1), pStrValue->length);
+ sal_Int32 nCopy = (sal_Int32)(nMax-1) < pStrValue->length ? (sal_Int32)(nMax-1) : pStrValue->length ;
strncpy (pszDirectory, pStrValue->buffer, nCopy);
pszDirectory[nCopy] = '\0';
bRet = (size_t)pStrValue->length < nMax;
diff --git a/sal/rtl/source/alloc_cache.cxx b/sal/rtl/source/alloc_cache.cxx
index 8e6860253448..a29b0785eba0 100644
--- a/sal/rtl/source/alloc_cache.cxx
+++ b/sal/rtl/source/alloc_cache.cxx
@@ -658,7 +658,10 @@ rtl_cache_depot_dequeue (
/* update depot stats */
depot->m_mag_count--;
- depot->m_curr_min = SAL_MIN(depot->m_curr_min, depot->m_mag_count);
+ if(depot->m_curr_min > depot->m_mag_count)
+ {
+ depot->m_curr_min = depot->m_mag_count;
+ }
}
return (mag);
}
@@ -1470,7 +1473,7 @@ rtl_cache_depot_wsupdate (
depot->m_prev_min = depot->m_curr_min;
depot->m_curr_min = depot->m_mag_count;
- npurge = SAL_MIN(depot->m_curr_min, depot->m_prev_min);
+ npurge = depot->m_curr_min < depot->m_prev_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/source/alloc_global.cxx b/sal/rtl/source/alloc_global.cxx
index 59213a11a8ea..7ac963c1cf2b 100644
--- a/sal/rtl/source/alloc_global.cxx
+++ b/sal/rtl/source/alloc_global.cxx
@@ -170,7 +170,7 @@ void * SAL_CALL rtl_reallocateMemory_CUSTOM (void * p, sal_Size n) SAL_THROW_EXT
p = rtl_allocateMemory (n);
if (p != 0)
{
- memcpy (p, p_old, SAL_MIN(n, n_old));
+ memcpy (p, p_old, (n < n_old) ? n : n_old);
rtl_freeMemory (p_old);
}
}
diff --git a/store/source/stordata.hxx b/store/source/stordata.hxx
index cbf5cd2b46f3..cbd004482e47 100644
--- a/store/source/stordata.hxx
+++ b/store/source/stordata.hxx
@@ -732,11 +732,11 @@ public:
return rtl_crc32 (nPath, pszName, rtl_str_getLength(pszName));
}
- sal_Size getName (sal_Char * pBuffer, sal_Size nBufsiz) const
+ sal_Size getName (sal_Char * pBuffer, sal_Size nBufsize) const
{
sal_Char const * pszName = PAGE().m_aNameBlock.m_pData;
sal_Size nLength = rtl_str_getLength(pszName);
- memcpy (pBuffer, pszName, SAL_MIN(nLength, nBufsiz));
+ memcpy (pBuffer, pszName, nLength < nBufsize ? nLength : nBufsize);
return nLength;
}
diff --git a/store/source/storlckb.cxx b/store/source/storlckb.cxx
index f9c0ff24efa3..539bf3707cac 100644
--- a/store/source/storlckb.cxx
+++ b/store/source/storlckb.cxx
@@ -167,8 +167,10 @@ storeError OStoreLockBytes::readAt (
nOffset, m_xNode->capacity());
sal_uInt32 nLength = sal_uInt32(aDescr.m_nLength);
- nLength = SAL_MIN(nLength, nBytes);
-
+ if(nLength > nBytes)
+ {
+ nLength = nBytes;
+ }
memcpy (
&pData[rnDone],
&m_xNode->m_pData[aDescr.m_nOffset],
@@ -186,7 +188,10 @@ storeError OStoreLockBytes::readAt (
nOffset - m_xNode->capacity(), OStoreDataPageData::capacity(m_xNode->m_aDescr)); // @@@
sal_uInt32 nLength = sal_uInt32(aDescr.m_nLength);
- nLength = SAL_MIN(nLength, nBytes);
+ if(nLength > nBytes)
+ {
+ nLength = nBytes;
+ }
storeError eErrCode = aPage.read (aDescr.m_nPage, aData, *m_xManager);
if (eErrCode != store_E_None)
@@ -259,7 +264,10 @@ storeError OStoreLockBytes::writeAt (
nOffset, m_xNode->capacity());
sal_uInt32 nLength = sal_uInt32(aDescr.m_nLength);
- nLength = SAL_MIN(nLength, nBytes);
+ if(nLength > nBytes)
+ {
+ nLength = nBytes;
+ }
memcpy (
&m_xNode->m_pData[aDescr.m_nOffset],
@@ -312,7 +320,10 @@ storeError OStoreLockBytes::writeAt (
}
// Modify data page.
- nLength = SAL_MIN(nLength, nBytes);
+ if(nLength > nBytes)
+ {
+ nLength = nBytes;
+ }
memcpy (
&xData->m_pData[aDescr.m_nOffset],
&pData[rnDone], nLength);
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx
index 037d16bbe811..e74c83d5df68 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -1415,7 +1415,10 @@ ErrCode UcbLockBytes::ReadAt ( sal_uLong nPos, void *pBuffer, sal_uLong nCount,
Sequence<sal_Int8> aData;
sal_Int32 nSize;
- nCount = SAL_MIN(nCount, 0x7FFFFFFF);
+ if(nCount > 0x7FFFFFFF)
+ {
+ nCount = 0x7FFFFFFF;
+ }
try
{
if ( !m_bTerminated && !IsSynchronMode() )