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

Side by Side Diff: Source/platform/text/LineEnding.cpp

Issue 26960002: Don't crash by form submission in a document with null encoding. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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 | « LayoutTests/fast/forms/form-submit-in-image-document-expected.txt ('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) 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 *q++ = toEndingChar; 195 *q++ = toEndingChar;
196 } else { 196 } else {
197 // Leave other characters alone. 197 // Leave other characters alone.
198 *q++ = c; 198 *q++ = c;
199 } 199 }
200 } 200 }
201 } 201 }
202 202
203 CString normalizeLineEndingsToCRLF(const CString& from) 203 CString normalizeLineEndingsToCRLF(const CString& from)
204 { 204 {
205 if (!from.length())
206 return from;
205 CString result; 207 CString result;
206 CStringBuffer buffer(result); 208 CStringBuffer buffer(result);
207 internalNormalizeLineEndingsToCRLF(from, buffer); 209 internalNormalizeLineEndingsToCRLF(from, buffer);
208 return buffer.buffer(); 210 return buffer.buffer();
209 } 211 }
210 212
211 void normalizeLineEndingsToCR(const CString& from, Vector<char>& result) 213 void normalizeLineEndingsToCR(const CString& from, Vector<char>& result)
212 { 214 {
213 normalizeToCROrLF(from, result, true); 215 normalizeToCROrLF(from, result, true);
214 } 216 }
215 217
216 void normalizeLineEndingsToLF(const CString& from, Vector<char>& result) 218 void normalizeLineEndingsToLF(const CString& from, Vector<char>& result)
217 { 219 {
218 normalizeToCROrLF(from, result, false); 220 normalizeToCROrLF(from, result, false);
219 } 221 }
220 222
221 void normalizeLineEndingsToNative(const CString& from, Vector<char>& result) 223 void normalizeLineEndingsToNative(const CString& from, Vector<char>& result)
222 { 224 {
223 #if OS(WIN) 225 #if OS(WIN)
224 VectorCharAppendBuffer buffer(result); 226 VectorCharAppendBuffer buffer(result);
225 internalNormalizeLineEndingsToCRLF(from, buffer); 227 internalNormalizeLineEndingsToCRLF(from, buffer);
226 #else 228 #else
227 normalizeLineEndingsToLF(from, result); 229 normalizeLineEndingsToLF(from, result);
228 #endif 230 #endif
229 } 231 }
230 232
231 } // namespace WebCore 233 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/form-submit-in-image-document-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698