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

Side by Side Diff: net/base/escape.cc

Issue 7057053: Escaping file names correctly. Also fixed a crush in chromeos debug build while saving a web page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Missed fix. Created 9 years, 6 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
« no previous file with comments | « net/base/escape.h ('k') | net/base/escape_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/escape.h" 5 #include "net/base/escape.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 std::string EscapePath(const std::string& path) { 205 std::string EscapePath(const std::string& path) {
206 return Escape(path, kPathCharmap, false); 206 return Escape(path, kPathCharmap, false);
207 } 207 }
208 208
209 // non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|} 209 // non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|}
210 static const Charmap kUrlEscape( 210 static const Charmap kUrlEscape(
211 0xffffffffL, 0xf80008fdL, 0x78000001L, 0xb8000001L, 211 0xffffffffL, 0xf80008fdL, 0x78000001L, 0xb8000001L,
212 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL 212 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL
213 ); 213 );
214 214
215 std::string EscapeUrlEncodedData(const std::string& path) { 215 std::string EscapeUrlEncodedData(const std::string& path,
216 return Escape(path, kUrlEscape, true); 216 bool use_plus) {
217 return Escape(path, kUrlEscape, use_plus);
217 } 218 }
218 219
219 // non-7bit 220 // non-7bit
220 static const Charmap kNonASCIICharmap( 221 static const Charmap kNonASCIICharmap(
221 0x00000000L, 0x00000000L, 0x00000000L, 0x00000000L, 222 0x00000000L, 0x00000000L, 0x00000000L, 0x00000000L,
222 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL); 223 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL);
223 224
224 std::string EscapeNonASCII(const std::string& input) { 225 std::string EscapeNonASCII(const std::string& input) {
225 return Escape(input, kNonASCIICharmap, false); 226 return Escape(input, kNonASCIICharmap, false);
226 } 227 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 return; 380 return;
380 } 381 }
381 if (offset <= (location + 2)) { 382 if (offset <= (location + 2)) {
382 offset = string16::npos; 383 offset = string16::npos;
383 return; 384 return;
384 } 385 }
385 adjusted_offset -= 2; 386 adjusted_offset -= 2;
386 } 387 }
387 offset = adjusted_offset; 388 offset = adjusted_offset;
388 } 389 }
OLDNEW
« no previous file with comments | « net/base/escape.h ('k') | net/base/escape_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698