mcatan 2004/04/14 14:51:10
Modified: include/log4cxx/helpers strictmath.h tchar.h
src boundedfifo.cpp
tests/src/helpers boundedfifotestcase.cpp
Log:
fixed conflict with Windows macros "min" and "max"
Revision Changes Path
1.2 +3 -3 logging-log4cxx/include/log4cxx/helpers/strictmath.h
Index: strictmath.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/helpers/strictmath.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- strictmath.h 10 Apr 2004 21:42:46 -0000 1.1
+++ strictmath.h 14 Apr 2004 21:51:09 -0000 1.2
@@ -10,7 +10,7 @@
#define _LOG4CXX_HELPERS_STRICTMATH_H
#include <log4cxx/config.h>
-
+
namespace log4cxx
{
namespace helpers
@@ -23,13 +23,13 @@
{
public:
template<typename _type> static inline const _type&
- min(const _type& a, const _type& b)
+ minimum(const _type& a, const _type& b)
{
return (a < b) ? a : b;
}
template<typename _type> static inline const _type&
- max(const _type& a, const _type& b)
+ maximum(const _type& a, const _type& b)
{
return (a > b) ? a : b;
}
1.25 +2 -2 logging-log4cxx/include/log4cxx/helpers/tchar.h
Index: tchar.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/helpers/tchar.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- tchar.h 10 Apr 2004 21:42:46 -0000 1.24
+++ tchar.h 14 Apr 2004 21:51:09 -0000 1.25
@@ -227,8 +227,8 @@
{
size_t os = epptr() - b; // taille allou�e
size_t is =
- helpers::StrictMath::max(
- helpers::StrictMath::min(
+ helpers::StrictMath::maximum(
+ helpers::StrictMath::minimum(
(os * 2), _MaxInc),_MinInc)
+ 1; // incr�ment d'allocation
char_type *p = al.allocate(os + is, 0);
1.9 +3 -3 logging-log4cxx/src/boundedfifo.cpp
Index: boundedfifo.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/boundedfifo.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- boundedfifo.cpp 10 Apr 2004 21:42:46 -0000 1.8
+++ boundedfifo.cpp 14 Apr 2004 21:51:09 -0000 1.9
@@ -84,11 +84,11 @@
int len1 = maxSize - first;
// we should not copy beyond the tmp array
- len1 = StrictMath::min(len1, newSize);
+ len1 = StrictMath::minimum(len1, newSize);
// er.. how much do we actually need to copy?
// We should not copy more than the actual number of elements.
- len1 = StrictMath::min(len1, numElements);
+ len1 = StrictMath::minimum(len1, numElements);
// Copy from buf starting a first, to tmp, starting at position 0, len1
std::copy(buf.begin() + first, buf.begin() + (first + len1),
tmp.begin());
@@ -99,7 +99,7 @@
if((len1 < numElements) && (len1 < newSize))
{
len2 = numElements - len1;
- len2 = StrictMath::min(len2, newSize - len1);
+ len2 = StrictMath::minimum(len2, newSize - len1);
std::copy(buf.begin(), buf.begin() + (len2), tmp.begin() +
len1);
}
1.4 +4 -4 logging-log4cxx/tests/src/helpers/boundedfifotestcase.cpp
Index: boundedfifotestcase.cpp
===================================================================
RCS file:
/home/cvs/logging-log4cxx/tests/src/helpers/boundedfifotestcase.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- boundedfifotestcase.cpp 10 Apr 2004 21:42:46 -0000 1.3
+++ boundedfifotestcase.cpp 14 Apr 2004 21:51:10 -0000 1.4
@@ -148,7 +148,7 @@
bf.resize(n);
- int expectedSize = StrictMath::min(n,
StrictMath::min(i, size));
+ int expectedSize = StrictMath::minimum(n,
StrictMath::minimum(i, size));
CPPUNIT_ASSERT_EQUAL(expectedSize, bf.length());
for (int c = 0; c < expectedSize; c++)
@@ -167,7 +167,7 @@
{
for (int i = 0; i < (size * 2); i++)
{
- for (int d = 0; d < StrictMath::min(i, size);
d++)
+ for (int d = 0; d < StrictMath::minimum(i,
size); d++)
{
BoundedFIFO bf(size);
@@ -186,7 +186,7 @@
bf.resize(n);
- int expectedSize = StrictMath::min(n,
x);
+ int expectedSize =
StrictMath::minimum(n, x);
CPPUNIT_ASSERT_EQUAL(expectedSize,
bf.length());
for (int c = 0; c < expectedSize; c++)
@@ -227,7 +227,7 @@
bf.resize(n);
- int expectedSize =
StrictMath::min(n, x);
+ int expectedSize =
StrictMath::minimum(n, x);
CPPUNIT_ASSERT_EQUAL(expectedSize, bf.length());
for (int c = 0; c <
expectedSize; c++)