| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 continue; | 258 continue; |
| 259 } | 259 } |
| 260 | 260 |
| 261 m_partialSequenceSize -= count; | 261 m_partialSequenceSize -= count; |
| 262 destination = appendCharacter(destination, character); | 262 destination = appendCharacter(destination, character); |
| 263 } while (m_partialSequenceSize); | 263 } while (m_partialSequenceSize); |
| 264 | 264 |
| 265 return false; | 265 return false; |
| 266 } | 266 } |
| 267 | 267 |
| 268 String TextCodecUTF8::decode(const char* bytes, size_t length, bool flush, bool
stopOnError, bool& sawError) | 268 String TextCodecUTF8::decode(const char* bytes, size_t length, FlushBehavior flu
sh, bool stopOnError, bool& sawError) |
| 269 { | 269 { |
| 270 // Each input byte might turn into a character. | 270 // Each input byte might turn into a character. |
| 271 // That includes all bytes in the partial-sequence buffer because | 271 // That includes all bytes in the partial-sequence buffer because |
| 272 // each byte in an invalid sequence will turn into a replacement character. | 272 // each byte in an invalid sequence will turn into a replacement character. |
| 273 StringBuffer<LChar> buffer(m_partialSequenceSize + length); | 273 StringBuffer<LChar> buffer(m_partialSequenceSize + length); |
| 274 | 274 |
| 275 const uint8_t* source = reinterpret_cast<const uint8_t*>(bytes); | 275 const uint8_t* source = reinterpret_cast<const uint8_t*>(bytes); |
| 276 const uint8_t* end = source + length; | 276 const uint8_t* end = source + length; |
| 277 const uint8_t* alignedEnd = alignToMachineWord(end); | 277 const uint8_t* alignedEnd = alignToMachineWord(end); |
| 278 LChar* destination = buffer.characters(); | 278 LChar* destination = buffer.characters(); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 { | 454 { |
| 455 return encodeCommon(characters, length); | 455 return encodeCommon(characters, length); |
| 456 } | 456 } |
| 457 | 457 |
| 458 CString TextCodecUTF8::encode(const LChar* characters, size_t length, Unencodabl
eHandling) | 458 CString TextCodecUTF8::encode(const LChar* characters, size_t length, Unencodabl
eHandling) |
| 459 { | 459 { |
| 460 return encodeCommon(characters, length); | 460 return encodeCommon(characters, length); |
| 461 } | 461 } |
| 462 | 462 |
| 463 } // namespace WTF | 463 } // namespace WTF |
| OLD | NEW |