From 13d0637357affc1e30f94db7f90cad70bab7cb55 Mon Sep 17 00:00:00 2001 From: Konstantin Isakov Date: Mon, 2 Feb 2009 01:10:16 +0000 Subject: [PATCH] Provide local implementation of wcscasecmp() under Windows, where it's non- existent. --- src/dsl_details.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/dsl_details.cc b/src/dsl_details.cc index 890011d8..da974814 100644 --- a/src/dsl_details.cc +++ b/src/dsl_details.cc @@ -10,6 +10,27 @@ namespace Details { using std::wstring; using std::list; +#ifdef __WIN32 + +// wcscasecmp() function is a GNU extension, we need to reimplement it +// for non-GNU systems. + +int wcscasecmp( const wchar_t *s1, const wchar_t *s2 ) +{ + for( ; ; ++s1, ++s2 ) + { + if ( towlower( *s1 ) != towlower( *s2 ) ) + return towlower( *s1 ) > towlower( *s2 ) ? 1 : -1; + + if ( !*s1 ) + break; + } + + return 0; +} + +#endif + /////////////// ArticleDom wstring ArticleDom::Node::renderAsText() const