summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-01-05 19:59:14 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-01-05 19:59:14 +0000
commit3ba642468c7ea11ef5b1006265ee9e45f1a9cf45 (patch)
tree9a139df6c76115179ce79a408a2fc3ff2a924419
parent2c06637bf86fed5be3b8a1d04f454b9fe6964c7f (diff)
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
-rw-r--r--src/pugixpath.cpp16
1 files 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 <typename T> 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: