Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) | 4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All r ights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All r ights reserved. |
| 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2285 if (a->is8Bit()) { | 2285 if (a->is8Bit()) { |
| 2286 if (b->is8Bit()) | 2286 if (b->is8Bit()) |
| 2287 return equalIgnoringASCIICase(a->characters8(), b->characters8(), le ngth); | 2287 return equalIgnoringASCIICase(a->characters8(), b->characters8(), le ngth); |
| 2288 return equalIgnoringASCIICase(a->characters8(), b->characters16(), lengt h); | 2288 return equalIgnoringASCIICase(a->characters8(), b->characters16(), lengt h); |
| 2289 } | 2289 } |
| 2290 if (b->is8Bit()) | 2290 if (b->is8Bit()) |
| 2291 return equalIgnoringASCIICase(a->characters16(), b->characters8(), lengt h); | 2291 return equalIgnoringASCIICase(a->characters16(), b->characters8(), lengt h); |
| 2292 return equalIgnoringASCIICase(a->characters16(), b->characters16(), length); | 2292 return equalIgnoringASCIICase(a->characters16(), b->characters16(), length); |
| 2293 } | 2293 } |
| 2294 | 2294 |
| 2295 bool equalIgnoringASCIICase(const StringImpl* a, const LChar* b) | 2295 bool equalIgnoringASCIICase(const StringImpl* a, const LChar* b, unsigned length ) |
| 2296 { | 2296 { |
| 2297 if (!a || !b) | 2297 if (!a || !b) |
| 2298 return !a == !b; | 2298 return !a == !b; |
| 2299 size_t length = strlen(reinterpret_cast<const char*>(b)); | |
| 2300 CHECK_LE(length, numeric_limits<unsigned>::max()); | |
|
esprehn
2016/05/24 22:44:26
This isn't needed, we're not going to allocate a s
| |
| 2301 if (length != a->length()) | 2299 if (length != a->length()) |
| 2302 return false; | 2300 return false; |
| 2303 return equalSubstringIgnoringASCIICase(a, 0, b, length); | 2301 return equalSubstringIgnoringASCIICase(a, 0, b, length); |
| 2304 } | 2302 } |
| 2305 | 2303 |
| 2306 template<typename CharacterType1, typename CharacterType2> | 2304 template<typename CharacterType1, typename CharacterType2> |
| 2307 int codePointCompareIgnoringASCIICase(unsigned l1, unsigned l2, const CharacterT ype1* c1, const CharacterType2* c2) | 2305 int codePointCompareIgnoringASCIICase(unsigned l1, unsigned l2, const CharacterT ype1* c1, const CharacterType2* c2) |
| 2308 { | 2306 { |
| 2309 const unsigned lmin = l1 < l2 ? l1 : l2; | 2307 const unsigned lmin = l1 < l2 ? l1 : l2; |
| 2310 unsigned pos = 0; | 2308 unsigned pos = 0; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2358 } else if (localeIdMatchesLang(localeIdentifier, "lt")) { | 2356 } else if (localeIdMatchesLang(localeIdentifier, "lt")) { |
| 2359 // TODO(rob.buis) implement upper-casing rules for lt | 2357 // TODO(rob.buis) implement upper-casing rules for lt |
| 2360 // like in StringImpl::upper(locale). | 2358 // like in StringImpl::upper(locale). |
| 2361 } | 2359 } |
| 2362 } | 2360 } |
| 2363 | 2361 |
| 2364 return toUpper(c); | 2362 return toUpper(c); |
| 2365 } | 2363 } |
| 2366 | 2364 |
| 2367 } // namespace WTF | 2365 } // namespace WTF |
| OLD | NEW |