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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // Turn LF into CRLF. | 144 // Turn LF into CRLF. |
145 *q++ = '\r'; | 145 *q++ = '\r'; |
146 *q++ = '\n'; | 146 *q++ = '\n'; |
147 } else { | 147 } else { |
148 // Leave other characters alone. | 148 // Leave other characters alone. |
149 *q++ = c; | 149 *q++ = c; |
150 } | 150 } |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 }; | 154 } // namespace; |
155 | 155 |
156 namespace blink { | 156 namespace blink { |
157 | 157 |
158 void normalizeLineEndingsToLF(const CString& from, Vector<char>& result) | 158 void normalizeLineEndingsToLF(const CString& from, Vector<char>& result) |
159 { | 159 { |
160 // Compute the new length. | 160 // Compute the new length. |
161 size_t newLen = 0; | 161 size_t newLen = 0; |
162 bool needFix = false; | 162 bool needFix = false; |
163 const char* p = from.data(); | 163 const char* p = from.data(); |
164 char fromEndingChar = '\r'; | 164 char fromEndingChar = '\r'; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 { | 219 { |
220 #if OS(WIN) | 220 #if OS(WIN) |
221 VectorCharAppendBuffer buffer(result); | 221 VectorCharAppendBuffer buffer(result); |
222 internalNormalizeLineEndingsToCRLF(from, buffer); | 222 internalNormalizeLineEndingsToCRLF(from, buffer); |
223 #else | 223 #else |
224 normalizeLineEndingsToLF(from, result); | 224 normalizeLineEndingsToLF(from, result); |
225 #endif | 225 #endif |
226 } | 226 } |
227 | 227 |
228 } // namespace blink | 228 } // namespace blink |
OLD | NEW |