| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved | 2 * Copyright (C) 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved |
| 3 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 return (a == b) || equal(a.impl(), b.impl()); | 119 return (a == b) || equal(a.impl(), b.impl()); |
| 120 } | 120 } |
| 121 | 121 |
| 122 static const bool safeToCompareToEmptyOrDeleted = false; | 122 static const bool safeToCompareToEmptyOrDeleted = false; |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 // Private so no one uses this in the belief that it will return the | 125 // Private so no one uses this in the belief that it will return the |
| 126 // correctly-folded code point in all cases (see comment below). | 126 // correctly-folded code point in all cases (see comment below). |
| 127 template<typename T> static inline UChar foldCase(T ch) | 127 template<typename T> static inline UChar foldCase(T ch) |
| 128 { | 128 { |
| 129 if (IsSameType<T, LChar>::value) |
| 130 return StringImpl::latin1CaseFoldTable[ch]; |
| 129 // It's possible for WTF::Unicode::foldCase() to return a 32-bit | 131 // It's possible for WTF::Unicode::foldCase() to return a 32-bit |
| 130 // value that's not representable as a UChar. However, since this | 132 // value that's not representable as a UChar. However, since this |
| 131 // is rare and deterministic, and the result of this is merely used | 133 // is rare and deterministic, and the result of this is merely used |
| 132 // for hashing, go ahead and clamp the value. | 134 // for hashing, go ahead and clamp the value. |
| 133 return static_cast<UChar>(WTF::Unicode::foldCase(ch)); | 135 return static_cast<UChar>(WTF::Unicode::foldCase(ch)); |
| 134 } | 136 } |
| 135 }; | 137 }; |
| 136 | 138 |
| 137 // This hash can be used in cases where the key is a hash of a string, but w
e don't | 139 // This hash can be used in cases where the key is a hash of a string, but w
e don't |
| 138 // want to store the string. It's not really specific to string hashing, but
all our | 140 // want to store the string. It's not really specific to string hashing, but
all our |
| (...skipping 15 matching lines...) Expand all Loading... |
| 154 } | 156 } |
| 155 }; | 157 }; |
| 156 | 158 |
| 157 } | 159 } |
| 158 | 160 |
| 159 using WTF::AlreadyHashed; | 161 using WTF::AlreadyHashed; |
| 160 using WTF::CaseFoldingHash; | 162 using WTF::CaseFoldingHash; |
| 161 using WTF::StringHash; | 163 using WTF::StringHash; |
| 162 | 164 |
| 163 #endif | 165 #endif |
| OLD | NEW |