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

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

Issue 23532016: Handle odd data lengths in UTF-16 decoder (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Simplify Created 6 years, 9 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/TextCodecUserDefined.cpp ('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) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> 3 * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
4 * Copyright (C) 2007-2009 Torch Mobile, Inc. 4 * Copyright (C) 2007-2009 Torch Mobile, Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 : m_name(atomicCanonicalTextEncodingName(name)) 53 : m_name(atomicCanonicalTextEncodingName(name))
54 , m_backslashAsCurrencySymbol(backslashAsCurrencySymbol()) 54 , m_backslashAsCurrencySymbol(backslashAsCurrencySymbol())
55 { 55 {
56 } 56 }
57 57
58 String TextEncoding::decode(const char* data, size_t length, bool stopOnError, b ool& sawError) const 58 String TextEncoding::decode(const char* data, size_t length, bool stopOnError, b ool& sawError) const
59 { 59 {
60 if (!m_name) 60 if (!m_name)
61 return String(); 61 return String();
62 62
63 return newTextCodec(*this)->decode(data, length, true, stopOnError, sawError ); 63 return newTextCodec(*this)->decode(data, length, DataEOF, stopOnError, sawEr ror);
64 } 64 }
65 65
66 CString TextEncoding::encode(const String& string, UnencodableHandling handling) const 66 CString TextEncoding::encode(const String& string, UnencodableHandling handling) const
67 { 67 {
68 if (!m_name) 68 if (!m_name)
69 return CString(); 69 return CString();
70 70
71 if (string.isEmpty()) 71 if (string.isEmpty())
72 return ""; 72 return "";
73 73
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 return globalUTF8Encoding; 216 return globalUTF8Encoding;
217 } 217 }
218 218
219 const TextEncoding& WindowsLatin1Encoding() 219 const TextEncoding& WindowsLatin1Encoding()
220 { 220 {
221 static TextEncoding globalWindowsLatin1Encoding("WinLatin1"); 221 static TextEncoding globalWindowsLatin1Encoding("WinLatin1");
222 return globalWindowsLatin1Encoding; 222 return globalWindowsLatin1Encoding;
223 } 223 }
224 224
225 } // namespace WTF 225 } // namespace WTF
OLDNEW
« no previous file with comments | « Source/wtf/text/TextCodecUserDefined.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698