Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright (c) 1999 |
michael@0 | 3 | * Silicon Graphics Computer Systems, Inc. |
michael@0 | 4 | * |
michael@0 | 5 | * Copyright (c) 1999 |
michael@0 | 6 | * Boris Fomitchev |
michael@0 | 7 | * |
michael@0 | 8 | * This material is provided "as is", with absolutely no warranty expressed |
michael@0 | 9 | * or implied. Any use is at your own risk. |
michael@0 | 10 | * |
michael@0 | 11 | * Permission to use or copy this software for any purpose is hereby granted |
michael@0 | 12 | * without fee, provided the above notices are retained on all copies. |
michael@0 | 13 | * Permission to modify the code and to distribute modified code is granted, |
michael@0 | 14 | * provided the above notices are retained, and a notice that the code was |
michael@0 | 15 | * modified is included with the above copyright notice. |
michael@0 | 16 | * |
michael@0 | 17 | */ |
michael@0 | 18 | #include "stlport_prefix.h" |
michael@0 | 19 | |
michael@0 | 20 | #include <locale> |
michael@0 | 21 | |
michael@0 | 22 | _STLP_BEGIN_NAMESPACE |
michael@0 | 23 | |
michael@0 | 24 | // collate<char> |
michael@0 | 25 | |
michael@0 | 26 | collate<char>::~collate() {} |
michael@0 | 27 | |
michael@0 | 28 | int collate<char>::do_compare(const char* low1, const char* high1, |
michael@0 | 29 | const char* low2, const char* high2) const |
michael@0 | 30 | { return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); } |
michael@0 | 31 | |
michael@0 | 32 | string collate<char>::do_transform(const char* low, const char* high) const |
michael@0 | 33 | { return string(low, high); } |
michael@0 | 34 | |
michael@0 | 35 | long collate<char>::do_hash(const char* low, const char* high) const { |
michael@0 | 36 | unsigned long result = 0; |
michael@0 | 37 | for ( ; low < high; ++low) |
michael@0 | 38 | result = 5 * result + *low; |
michael@0 | 39 | return result; |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | #if !defined (_STLP_NO_WCHAR_T) |
michael@0 | 43 | // collate<wchar_t> |
michael@0 | 44 | |
michael@0 | 45 | collate<wchar_t>::~collate() {} |
michael@0 | 46 | |
michael@0 | 47 | int |
michael@0 | 48 | collate<wchar_t>::do_compare(const wchar_t* low1, const wchar_t* high1, |
michael@0 | 49 | const wchar_t* low2, const wchar_t* high2) const |
michael@0 | 50 | { return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); } |
michael@0 | 51 | |
michael@0 | 52 | wstring collate<wchar_t>::do_transform(const wchar_t* low, const wchar_t* high) const |
michael@0 | 53 | { return wstring(low, high); } |
michael@0 | 54 | |
michael@0 | 55 | long collate<wchar_t>::do_hash(const wchar_t* low, const wchar_t* high) const { |
michael@0 | 56 | unsigned long result = 0; |
michael@0 | 57 | for ( ; low < high; ++low) |
michael@0 | 58 | result = 5 * result + *low; |
michael@0 | 59 | return result; |
michael@0 | 60 | } |
michael@0 | 61 | #endif |
michael@0 | 62 | |
michael@0 | 63 | _STLP_END_NAMESPACE |
michael@0 | 64 | |
michael@0 | 65 | |
michael@0 | 66 | // Local Variables: |
michael@0 | 67 | // mode:C++ |
michael@0 | 68 | // End: |
michael@0 | 69 |