Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55589 - sandbox/libs/mapreduce/examples/wordcount
From: cdm.henderson_at_[hidden]
Date: 2009-08-14 17:20:12


Author: chenderson
Date: 2009-08-14 17:20:11 EDT (Fri, 14 Aug 2009)
New Revision: 55589
URL: http://svn.boost.org/trac/boost/changeset/55589

Log:
strnicmp/strncasecmp for MSVC/GCC
Text files modified:
   sandbox/libs/mapreduce/examples/wordcount/wordcount.cpp | 8 ++++++++
   1 files changed, 8 insertions(+), 0 deletions(-)

Modified: sandbox/libs/mapreduce/examples/wordcount/wordcount.cpp
==============================================================================
--- sandbox/libs/mapreduce/examples/wordcount/wordcount.cpp (original)
+++ sandbox/libs/mapreduce/examples/wordcount/wordcount.cpp 2009-08-14 17:20:11 EDT (Fri, 14 Aug 2009)
@@ -126,7 +126,11 @@
 bool less<wordcount::reduce_key_t>::operator()(wordcount::reduce_key_t const &first, wordcount::reduce_key_t const &second) const
 {
     std::ptrdiff_t const len = std::min(first.second, second.second);
+#if defined(BOOST_MSVC)
     int const cmp = strnicmp(first.first, second.first, len);
+#else
+ int const cmp = strncasecmp(first.first, second.first, len);
+#endif
     if (cmp < 0)
         return true;
     else if (cmp > 0)
@@ -143,7 +147,11 @@
     else if (first.second == 0 && first.first == 0 && second.first == 0)
         return true;
 
+#if defined(BOOST_MSVC)
     return (strnicmp(first.first, second.first, first.second) == 0);
+#else
+ return (strncasecmp(first.first, second.first, first.second) == 0);
+#endif
 }
 
 } // namespace std


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk