From 3ba642468c7ea11ef5b1006265ee9e45f1a9cf45 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Mon, 5 Jan 2009 19:59:14 +0000 Subject: Removed std::min from XPath (macro problems, it was needed only once anyway) git-svn-id: http://pugixml.googlecode.com/svn/trunk@93 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixpath.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp index f94cefd..875950f 100644 --- a/src/pugixpath.cpp +++ b/src/pugixpath.cpp @@ -30,17 +30,6 @@ # pragma warning(disable: 4996) // this function or variable may be unsafe #endif -#if defined(_MSC_VER) && _MSC_VER == 1200 -// MSVC6 workaround -namespace std -{ - template const T& min(const T& a, const T& b) - { - return _cpp_min(a, b); - } -} -#endif - namespace { using namespace pugi; @@ -2185,8 +2174,11 @@ namespace pugi size_t pos = first < 1 ? 1 : (size_t)first; size_t end = last >= s.length() + 1 ? s.length() + 1 : (size_t)last; + + size_t size_requested = end - pos; + size_t size_to_end = s.length() - pos + 1; - return s.substr(pos - 1, std::min(end - pos, s.length() - pos + 1)); + return s.substr(pos - 1, size_requested < size_to_end ? size_requested : size_to_end); } case ast_func_normalize_space_0: -- cgit v1.2.3