michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include michael@0: #include "nsAString.h" michael@0: #include "plstr.h" michael@0: michael@0: michael@0: // define nsStringComparator michael@0: #include "string-template-def-unichar.h" michael@0: #include "nsTStringComparator.cpp" michael@0: #include "string-template-undef.h" michael@0: michael@0: // define nsCStringComparator michael@0: #include "string-template-def-char.h" michael@0: #include "nsTStringComparator.cpp" michael@0: #include "string-template-undef.h" michael@0: michael@0: michael@0: int michael@0: nsCaseInsensitiveCStringComparator::operator()( const char_type* lhs, michael@0: const char_type* rhs, michael@0: uint32_t lLength, michael@0: uint32_t rLength ) const michael@0: { michael@0: if (lLength != rLength) michael@0: return (lLength > rLength) ? 1 : -1; michael@0: int32_t result=int32_t(PL_strncasecmp(lhs, rhs, lLength)); michael@0: //Egads. PL_strncasecmp is returning *very* negative numbers. michael@0: //Some folks expect -1,0,1, so let's temper its enthusiasm. michael@0: if (result<0) michael@0: result=-1; michael@0: return result; michael@0: }