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

Side by Side Diff: Source/core/platform/text/DecodeEscapeSequences.h

Issue 23464095: WTF::notFound looks too much like a local variable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All Rights Reserved. 2 * Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All Rights Reserved.
3 * Copyright (c) 2012 Google, inc. All Rights Reserved. 3 * Copyright (c) 2012 Google, inc. All Rights Reserved.
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 }; 123 };
124 124
125 template<typename EscapeSequence> 125 template<typename EscapeSequence>
126 String decodeEscapeSequences(const String& string, const WTF::TextEncoding& enco ding) 126 String decodeEscapeSequences(const String& string, const WTF::TextEncoding& enco ding)
127 { 127 {
128 StringBuilder result; 128 StringBuilder result;
129 size_t length = string.length(); 129 size_t length = string.length();
130 size_t decodedPosition = 0; 130 size_t decodedPosition = 0;
131 size_t searchPosition = 0; 131 size_t searchPosition = 0;
132 size_t encodedRunPosition; 132 size_t encodedRunPosition;
133 while ((encodedRunPosition = EscapeSequence::findInString(string, searchPosi tion)) != notFound) { 133 while ((encodedRunPosition = EscapeSequence::findInString(string, searchPosi tion)) != kNotFound) {
134 size_t encodedRunEnd = EscapeSequence::findEndOfRun(string, encodedRunPo sition, length); 134 size_t encodedRunEnd = EscapeSequence::findEndOfRun(string, encodedRunPo sition, length);
135 searchPosition = encodedRunEnd; 135 searchPosition = encodedRunEnd;
136 if (encodedRunEnd == encodedRunPosition) { 136 if (encodedRunEnd == encodedRunPosition) {
137 ++searchPosition; 137 ++searchPosition;
138 continue; 138 continue;
139 } 139 }
140 140
141 String decoded = string.is8Bit() ? 141 String decoded = string.is8Bit() ?
142 EscapeSequence::decodeRun(string.characters8() + encodedRunPosition, encodedRunEnd - encodedRunPosition, encoding) : 142 EscapeSequence::decodeRun(string.characters8() + encodedRunPosition, encodedRunEnd - encodedRunPosition, encoding) :
143 EscapeSequence::decodeRun(string.characters16() + encodedRunPosition , encodedRunEnd - encodedRunPosition, encoding); 143 EscapeSequence::decodeRun(string.characters16() + encodedRunPosition , encodedRunEnd - encodedRunPosition, encoding);
144 144
145 if (decoded.isEmpty()) 145 if (decoded.isEmpty())
146 continue; 146 continue;
147 147
148 result.append(string, decodedPosition, encodedRunPosition - decodedPosit ion); 148 result.append(string, decodedPosition, encodedRunPosition - decodedPosit ion);
149 result.append(decoded); 149 result.append(decoded);
150 decodedPosition = encodedRunEnd; 150 decodedPosition = encodedRunEnd;
151 } 151 }
152 result.append(string, decodedPosition, length - decodedPosition); 152 result.append(string, decodedPosition, length - decodedPosition);
153 return result.toString(); 153 return result.toString();
154 } 154 }
155 155
156 } // namespace WebCore 156 } // namespace WebCore
157 157
158 #endif // DecodeEscapeSequences_h 158 #endif // DecodeEscapeSequences_h
OLDNEW
« no previous file with comments | « Source/core/platform/text/DateTimeFormat.cpp ('k') | Source/core/platform/text/LocaleToScriptMappingDefault.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698