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

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

Issue 261013007: Prevent direct use of "replacement" text encoding. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: MSVC fix Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/wtf/text/TextEncodingRegistry.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2007-2009 Torch Mobile, Inc. 3 * Copyright (C) 2007-2009 Torch Mobile, Inc.
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // Shift_JIS_X0213-2000 is not the same encoding as Shift_JIS on Mac. We nee d to register both of them. 262 // Shift_JIS_X0213-2000 is not the same encoding as Shift_JIS on Mac. We nee d to register both of them.
263 addEncodingName(nonBackslashEncodings, "Shift_JIS"); 263 addEncodingName(nonBackslashEncodings, "Shift_JIS");
264 addEncodingName(nonBackslashEncodings, "Shift_JIS_X0213-2000"); 264 addEncodingName(nonBackslashEncodings, "Shift_JIS_X0213-2000");
265 } 265 }
266 266
267 bool isJapaneseEncoding(const char* canonicalEncodingName) 267 bool isJapaneseEncoding(const char* canonicalEncodingName)
268 { 268 {
269 return canonicalEncodingName && japaneseEncodings && japaneseEncodings->cont ains(canonicalEncodingName); 269 return canonicalEncodingName && japaneseEncodings && japaneseEncodings->cont ains(canonicalEncodingName);
270 } 270 }
271 271
272 bool isReplacementEncoding(const char* alias)
273 {
274 return alias && !strcasecmp(alias, "replacement");
275 }
276
277 bool isReplacementEncoding(const String& alias)
278 {
279 return alias == "replacement";
280 }
281
272 bool shouldShowBackslashAsCurrencySymbolIn(const char* canonicalEncodingName) 282 bool shouldShowBackslashAsCurrencySymbolIn(const char* canonicalEncodingName)
273 { 283 {
274 return canonicalEncodingName && nonBackslashEncodings && nonBackslashEncodin gs->contains(canonicalEncodingName); 284 return canonicalEncodingName && nonBackslashEncodings && nonBackslashEncodin gs->contains(canonicalEncodingName);
275 } 285 }
276 286
277 static void extendTextCodecMaps() 287 static void extendTextCodecMaps()
278 { 288 {
279 TextCodecReplacement::registerEncodingNames(addToTextEncodingNameMap); 289 TextCodecReplacement::registerEncodingNames(addToTextEncodingNameMap);
280 TextCodecReplacement::registerCodecs(addToTextCodecMap); 290 TextCodecReplacement::registerCodecs(addToTextCodecMap);
281 291
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 MutexLocker lock(encodingRegistryMutex()); 365 MutexLocker lock(encodingRegistryMutex());
356 366
357 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin(); 367 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin();
358 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end(); 368 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end();
359 for (; it != end; ++it) 369 for (; it != end; ++it)
360 fprintf(stderr, "'%s' => '%s'\n", it->key, it->value); 370 fprintf(stderr, "'%s' => '%s'\n", it->key, it->value);
361 } 371 }
362 #endif 372 #endif
363 373
364 } // namespace WTF 374 } // namespace WTF
OLDNEW
« no previous file with comments | « Source/wtf/text/TextEncodingRegistry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698