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

Side by Side Diff: Source/wtf/text/WTFString.cpp

Issue 1119663002: Making Unicode character names consistent (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code changes to correct Test Expectation Created 5 years, 7 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 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007-2009 Torch Mobile, Inc. 4 * Copyright (C) 2007-2009 Torch Mobile, Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 while (characters < charactersEnd) { 793 while (characters < charactersEnd) {
794 // Use strict conversion to detect unpaired surrogates. 794 // Use strict conversion to detect unpaired surrogates.
795 ConversionResult result = convertUTF16ToUTF8(&characters, charac tersEnd, &buffer, bufferEnd, true); 795 ConversionResult result = convertUTF16ToUTF8(&characters, charac tersEnd, &buffer, bufferEnd, true);
796 ASSERT(result != targetExhausted); 796 ASSERT(result != targetExhausted);
797 // Conversion fails when there is an unpaired surrogate. 797 // Conversion fails when there is an unpaired surrogate.
798 // Put replacement character (U+FFFD) instead of the unpaired su rrogate. 798 // Put replacement character (U+FFFD) instead of the unpaired su rrogate.
799 if (result != conversionOK) { 799 if (result != conversionOK) {
800 ASSERT((0xD800 <= *characters && *characters <= 0xDFFF)); 800 ASSERT((0xD800 <= *characters && *characters <= 0xDFFF));
801 // There should be room left, since one UChar hasn't been co nverted. 801 // There should be room left, since one UChar hasn't been co nverted.
802 ASSERT((buffer + 3) <= bufferEnd); 802 ASSERT((buffer + 3) <= bufferEnd);
803 putUTF8Triple(buffer, replacementCharacter); 803 putUTF8Triple(buffer, characterReplacement);
804 ++characters; 804 ++characters;
805 } 805 }
806 } 806 }
807 } else { 807 } else {
808 bool strict = mode == StrictUTF8Conversion; 808 bool strict = mode == StrictUTF8Conversion;
809 ConversionResult result = convertUTF16ToUTF8(&characters, characters + length, &buffer, buffer + bufferVector.size(), strict); 809 ConversionResult result = convertUTF16ToUTF8(&characters, characters + length, &buffer, buffer + bufferVector.size(), strict);
810 ASSERT(result != targetExhausted); // (length * 3) should be suffici ent for any conversion 810 ASSERT(result != targetExhausted); // (length * 3) should be suffici ent for any conversion
811 811
812 // Only produced from strict conversion. 812 // Only produced from strict conversion.
813 if (result == sourceIllegal) { 813 if (result == sourceIllegal) {
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 buffer.append('\0'); 1216 buffer.append('\0');
1217 return buffer; 1217 return buffer;
1218 } 1218 }
1219 1219
1220 Vector<char> asciiDebug(String& string) 1220 Vector<char> asciiDebug(String& string)
1221 { 1221 {
1222 return asciiDebug(string.impl()); 1222 return asciiDebug(string.impl());
1223 } 1223 }
1224 1224
1225 #endif 1225 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698