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

Side by Side Diff: third_party/WebKit/Source/platform/text/UnicodeUtilities.cpp

Issue 1845363003: String replaceWithLiteral should just use strlen, also rename to replace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another NUL fix. Created 4 years, 8 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
3 * Copyright (C) 2005 Alexey Proskuryakov. 3 * Copyright (C) 2005 Alexey Proskuryakov.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void foldQuoteMarksAndSoftHyphens(String& s) 70 void foldQuoteMarksAndSoftHyphens(String& s)
71 { 71 {
72 s.replace(hebrewPunctuationGereshCharacter, '\''); 72 s.replace(hebrewPunctuationGereshCharacter, '\'');
73 s.replace(hebrewPunctuationGershayimCharacter, '"'); 73 s.replace(hebrewPunctuationGershayimCharacter, '"');
74 s.replace(leftDoubleQuotationMarkCharacter, '"'); 74 s.replace(leftDoubleQuotationMarkCharacter, '"');
75 s.replace(leftSingleQuotationMarkCharacter, '\''); 75 s.replace(leftSingleQuotationMarkCharacter, '\'');
76 s.replace(rightDoubleQuotationMarkCharacter, '"'); 76 s.replace(rightDoubleQuotationMarkCharacter, '"');
77 s.replace(rightSingleQuotationMarkCharacter, '\''); 77 s.replace(rightSingleQuotationMarkCharacter, '\'');
78 // Replace soft hyphen with an ignorable character so that their presence or absence will 78 // Replace soft hyphen with an ignorable character so that their presence or absence will
79 // not affect string comparison. 79 // not affect string comparison.
80 s.replace(softHyphenCharacter, 0); 80 s.replace(softHyphenCharacter, static_cast<UChar>('\0'));
81 } 81 }
82 82
83 static bool isNonLatin1Separator(UChar32 character) 83 static bool isNonLatin1Separator(UChar32 character)
84 { 84 {
85 DCHECK_GE(character, 256); 85 DCHECK_GE(character, 256);
86 return U_GET_GC_MASK(character) & (U_GC_S_MASK | U_GC_P_MASK | U_GC_Z_MASK | U_GC_CF_MASK); 86 return U_GET_GC_MASK(character) & (U_GC_S_MASK | U_GC_P_MASK | U_GC_Z_MASK | U_GC_CF_MASK);
87 } 87 }
88 88
89 bool isSeparator(UChar32 character) 89 bool isSeparator(UChar32 character)
90 { 90 {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (offset == kNotFound) 404 if (offset == kNotFound)
405 return false; 405 return false;
406 406
407 // Update values of |a| and |b| after comparing. 407 // Update values of |a| and |b| after comparing.
408 a += offset; 408 a += offset;
409 b += offset; 409 b += offset;
410 } 410 }
411 } 411 }
412 412
413 } // namespace blink 413 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/LocaleWinTest.cpp ('k') | third_party/WebKit/Source/wtf/text/WTFString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698