| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |