From b42094b2b06f4837a6df65e6b87caf8139fc0d0d Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Fri, 14 Sep 2012 01:42:30 -0500 Subject: remove use of SAL_MIN() macro Change-Id: Ia91118388240c9a54d010b94aef34ad528ce5761 --- registry/source/reflcnst.hxx | 6 +++++- registry/source/reflwrit.cxx | 13 ++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'registry/source') 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]; } -- cgit