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

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

Issue 20300002: Fix trailing whitespace in .cpp, .h, and .idl files (ex. Source/core) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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/TextEncoding.h ('k') | Source/wtf/text/TextEncodingRegistry.h » ('j') | 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.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "config.h" 28 #include "config.h"
29 #include "wtf/text/TextEncoding.h" 29 #include "wtf/text/TextEncoding.h"
30 30
31 #include "wtf/text/TextCodec.h" 31 #include "wtf/text/TextCodec.h"
32 #include "wtf/text/TextEncodingRegistry.h" 32 #include "wtf/text/TextEncodingRegistry.h"
33 #include <unicode/unorm.h> 33 #include <unicode/unorm.h>
34 #include "wtf/OwnPtr.h" 34 #include "wtf/OwnPtr.h"
35 #include "wtf/StdLibExtras.h" 35 #include "wtf/StdLibExtras.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 119
120 return newTextCodec(*this)->encode(source, length, handling); 120 return newTextCodec(*this)->encode(source, length, handling);
121 } 121 }
122 122
123 const char* TextEncoding::domName() const 123 const char* TextEncoding::domName() const
124 { 124 {
125 if (noExtendedTextEncodingNameUsed()) 125 if (noExtendedTextEncodingNameUsed())
126 return m_name; 126 return m_name;
127 127
128 // We treat EUC-KR as windows-949 (its superset), but need to expose 128 // We treat EUC-KR as windows-949 (its superset), but need to expose
129 // the name 'EUC-KR' because the name 'windows-949' is not recognized by 129 // the name 'EUC-KR' because the name 'windows-949' is not recognized by
130 // most Korean web servers even though they do use the encoding 130 // most Korean web servers even though they do use the encoding
131 // 'windows-949' with the name 'EUC-KR'. 131 // 'windows-949' with the name 'EUC-KR'.
132 // FIXME: This is not thread-safe. At the moment, this function is 132 // FIXME: This is not thread-safe. At the moment, this function is
133 // only accessed in a single thread, but eventually has to be made 133 // only accessed in a single thread, but eventually has to be made
134 // thread-safe along with usesVisualOrdering(). 134 // thread-safe along with usesVisualOrdering().
135 static const char* const a = atomicCanonicalTextEncodingName("windows-949"); 135 static const char* const a = atomicCanonicalTextEncodingName("windows-949");
136 if (m_name == a) 136 if (m_name == a)
137 return "EUC-KR"; 137 return "EUC-KR";
138 return m_name; 138 return m_name;
139 } 139 }
140 140
141 bool TextEncoding::usesVisualOrdering() const 141 bool TextEncoding::usesVisualOrdering() const
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 if (noExtendedTextEncodingNameUsed()) 175 if (noExtendedTextEncodingNameUsed())
176 return false; 176 return false;
177 177
178 return *this == UTF7Encoding(); 178 return *this == UTF7Encoding();
179 } 179 }
180 180
181 const TextEncoding& TextEncoding::closestByteBasedEquivalent() const 181 const TextEncoding& TextEncoding::closestByteBasedEquivalent() const
182 { 182 {
183 if (isNonByteBasedEncoding()) 183 if (isNonByteBasedEncoding())
184 return UTF8Encoding(); 184 return UTF8Encoding();
185 return *this; 185 return *this;
186 } 186 }
187 187
188 // HTML5 specifies that UTF-8 be used in form submission when a form is 188 // HTML5 specifies that UTF-8 be used in form submission when a form is
189 // is a part of a document in UTF-16 probably because UTF-16 is not a 189 // is a part of a document in UTF-16 probably because UTF-16 is not a
190 // byte-based encoding and can contain 0x00. By extension, the same 190 // byte-based encoding and can contain 0x00. By extension, the same
191 // should be done for UTF-32. In case of UTF-7, it is a byte-based encoding, 191 // should be done for UTF-32. In case of UTF-7, it is a byte-based encoding,
192 // but it's fraught with problems and we'd rather steer clear of it. 192 // but it's fraught with problems and we'd rather steer clear of it.
193 const TextEncoding& TextEncoding::encodingForFormSubmission() const 193 const TextEncoding& TextEncoding::encodingForFormSubmission() const
194 { 194 {
195 if (isNonByteBasedEncoding() || isUTF7Encoding()) 195 if (isNonByteBasedEncoding() || isUTF7Encoding())
196 return UTF8Encoding(); 196 return UTF8Encoding();
197 return *this; 197 return *this;
198 } 198 }
199 199
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 return globalUTF8Encoding; 240 return globalUTF8Encoding;
241 } 241 }
242 242
243 const TextEncoding& WindowsLatin1Encoding() 243 const TextEncoding& WindowsLatin1Encoding()
244 { 244 {
245 static TextEncoding globalWindowsLatin1Encoding("WinLatin1"); 245 static TextEncoding globalWindowsLatin1Encoding("WinLatin1");
246 return globalWindowsLatin1Encoding; 246 return globalWindowsLatin1Encoding;
247 } 247 }
248 248
249 } // namespace WTF 249 } // namespace WTF
OLDNEW
« no previous file with comments | « Source/wtf/text/TextEncoding.h ('k') | Source/wtf/text/TextEncodingRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698