Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: third_party/WebKit/Source/wtf/text/StringImpl.cpp

Issue 1373773002: Fix check-webkit-style errors in Source/wtf/text/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 // Nothing to do if the string is all ASCII with no uppercase. 514 // Nothing to do if the string is all ASCII with no uppercase.
515 if (firstIndexToBeLowered == m_length) 515 if (firstIndexToBeLowered == m_length)
516 return this; 516 return this;
517 517
518 LChar* data8; 518 LChar* data8;
519 RefPtr<StringImpl> newImpl = createUninitialized(m_length, data8); 519 RefPtr<StringImpl> newImpl = createUninitialized(m_length, data8);
520 memcpy(data8, characters8(), firstIndexToBeLowered); 520 memcpy(data8, characters8(), firstIndexToBeLowered);
521 521
522 for (unsigned i = firstIndexToBeLowered; i < m_length; ++i) { 522 for (unsigned i = firstIndexToBeLowered; i < m_length; ++i) {
523 LChar ch = characters8()[i]; 523 LChar ch = characters8()[i];
524 data8[i] = UNLIKELY(ch & ~0x7F) ? static_cast<LChar>(Unicode::toLowe r(ch)) 524 data8[i] = UNLIKELY(ch & ~0x7F)
525 : toASCIILower(ch); 525 ? static_cast<LChar>(Unicode::toLower(ch)) : toASCIILower(ch);
526 } 526 }
527 527
528 return newImpl.release(); 528 return newImpl.release();
529 } 529 }
530 530
531 bool noUpper = true; 531 bool noUpper = true;
532 UChar ored = 0; 532 UChar ored = 0;
533 533
534 const UChar* end = characters16() + m_length; 534 const UChar* end = characters16() + m_length;
535 for (const UChar* chp = characters16(); chp != end; ++chp) { 535 for (const UChar* chp = characters16(); chp != end; ++chp) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 // We have numberSSCharacters sharp-s characters, but none of the other special characters. 618 // We have numberSSCharacters sharp-s characters, but none of the other special characters.
619 newImpl = createUninitialized(m_length + numberSharpSCharacters, data8); 619 newImpl = createUninitialized(m_length + numberSharpSCharacters, data8);
620 620
621 LChar* dest = data8; 621 LChar* dest = data8;
622 622
623 for (int32_t i = 0; i < length; ++i) { 623 for (int32_t i = 0; i < length; ++i) {
624 LChar c = characters8()[i]; 624 LChar c = characters8()[i];
625 if (c == smallLetterSharpSCharacter) { 625 if (c == smallLetterSharpSCharacter) {
626 *dest++ = 'S'; 626 *dest++ = 'S';
627 *dest++ = 'S'; 627 *dest++ = 'S';
628 } else 628 } else {
629 *dest++ = static_cast<LChar>(Unicode::toUpper(c)); 629 *dest++ = static_cast<LChar>(Unicode::toUpper(c));
630 }
630 } 631 }
631 632
632 return newImpl.release(); 633 return newImpl.release();
633 } 634 }
634 635
635 upconvert: 636 upconvert:
636 RefPtr<StringImpl> upconverted = upconvertedString(); 637 RefPtr<StringImpl> upconverted = upconvertedString();
637 const UChar* source16 = upconverted->characters16(); 638 const UChar* source16 = upconverted->characters16();
638 639
639 UChar* data16; 640 UChar* data16;
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 RELEASE_ASSERT((length() - lengthToReplace) < (numeric_limits<unsigned>::max () - lengthToInsert)); 1593 RELEASE_ASSERT((length() - lengthToReplace) < (numeric_limits<unsigned>::max () - lengthToInsert));
1593 1594
1594 if (is8Bit() && (!str || str->is8Bit())) { 1595 if (is8Bit() && (!str || str->is8Bit())) {
1595 LChar* data; 1596 LChar* data;
1596 RefPtr<StringImpl> newImpl = 1597 RefPtr<StringImpl> newImpl =
1597 createUninitialized(length() - lengthToReplace + lengthToInsert, data); 1598 createUninitialized(length() - lengthToReplace + lengthToInsert, data);
1598 memcpy(data, characters8(), position * sizeof(LChar)); 1599 memcpy(data, characters8(), position * sizeof(LChar));
1599 if (str) 1600 if (str)
1600 memcpy(data + position, str->characters8(), lengthToInsert * sizeof( LChar)); 1601 memcpy(data + position, str->characters8(), lengthToInsert * sizeof( LChar));
1601 memcpy(data + position + lengthToInsert, characters8() + position + leng thToReplace, 1602 memcpy(data + position + lengthToInsert, characters8() + position + leng thToReplace,
1602 (length() - position - lengthToReplace) * sizeof(LChar)); 1603 (length() - position - lengthToReplace) * sizeof(LChar));
1603 return newImpl.release(); 1604 return newImpl.release();
1604 } 1605 }
1605 UChar* data; 1606 UChar* data;
1606 RefPtr<StringImpl> newImpl = 1607 RefPtr<StringImpl> newImpl =
1607 createUninitialized(length() - lengthToReplace + lengthToInsert, data); 1608 createUninitialized(length() - lengthToReplace + lengthToInsert, data);
1608 if (is8Bit()) 1609 if (is8Bit())
1609 for (unsigned i = 0; i < position; ++i) 1610 for (unsigned i = 0; i < position; ++i)
1610 data[i] = characters8()[i]; 1611 data[i] = characters8()[i];
1611 else 1612 else
1612 memcpy(data, characters16(), position * sizeof(UChar)); 1613 memcpy(data, characters16(), position * sizeof(UChar));
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 } else if (localeIdMatchesLang(localeIdentifier, "lt")) { 2120 } else if (localeIdMatchesLang(localeIdentifier, "lt")) {
2120 // TODO(rob.buis) implement upper-casing rules for lt 2121 // TODO(rob.buis) implement upper-casing rules for lt
2121 // like in StringImpl::upper(locale). 2122 // like in StringImpl::upper(locale).
2122 } 2123 }
2123 } 2124 }
2124 2125
2125 return toUpper(c); 2126 return toUpper(c);
2126 } 2127 }
2127 2128
2128 } // namespace WTF 2129 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringImpl.h ('k') | third_party/WebKit/Source/wtf/text/TextCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698