| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 void TextCodecLatin1::registerCodecs(TextCodecRegistrar registrar) | 112 void TextCodecLatin1::registerCodecs(TextCodecRegistrar registrar) |
| 113 { | 113 { |
| 114 registrar("windows-1252", newStreamingTextDecoderWindowsLatin1, 0); | 114 registrar("windows-1252", newStreamingTextDecoderWindowsLatin1, 0); |
| 115 | 115 |
| 116 // ASCII and Latin-1 both decode as Windows Latin-1 although they retain uni
que identities. | 116 // ASCII and Latin-1 both decode as Windows Latin-1 although they retain uni
que identities. |
| 117 registrar("ISO-8859-1", newStreamingTextDecoderWindowsLatin1, 0); | 117 registrar("ISO-8859-1", newStreamingTextDecoderWindowsLatin1, 0); |
| 118 registrar("US-ASCII", newStreamingTextDecoderWindowsLatin1, 0); | 118 registrar("US-ASCII", newStreamingTextDecoderWindowsLatin1, 0); |
| 119 } | 119 } |
| 120 | 120 |
| 121 String TextCodecLatin1::decode(const char* bytes, size_t length, bool, bool, boo
l&) | 121 String TextCodecLatin1::decode(const char* bytes, size_t length, FlushBehavior,
bool, bool&) |
| 122 { | 122 { |
| 123 LChar* characters; | 123 LChar* characters; |
| 124 if (!length) | 124 if (!length) |
| 125 return emptyString(); | 125 return emptyString(); |
| 126 String result = String::createUninitialized(length, characters); | 126 String result = String::createUninitialized(length, characters); |
| 127 | 127 |
| 128 const uint8_t* source = reinterpret_cast<const uint8_t*>(bytes); | 128 const uint8_t* source = reinterpret_cast<const uint8_t*>(bytes); |
| 129 const uint8_t* end = reinterpret_cast<const uint8_t*>(bytes + length); | 129 const uint8_t* end = reinterpret_cast<const uint8_t*>(bytes + length); |
| 130 const uint8_t* alignedEnd = alignToMachineWord(end); | 130 const uint8_t* alignedEnd = alignToMachineWord(end); |
| 131 LChar* destination = characters; | 131 LChar* destination = characters; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 { | 272 { |
| 273 return encodeCommon(characters, length, handling); | 273 return encodeCommon(characters, length, handling); |
| 274 } | 274 } |
| 275 | 275 |
| 276 CString TextCodecLatin1::encode(const LChar* characters, size_t length, Unencoda
bleHandling handling) | 276 CString TextCodecLatin1::encode(const LChar* characters, size_t length, Unencoda
bleHandling handling) |
| 277 { | 277 { |
| 278 return encodeCommon(characters, length, handling); | 278 return encodeCommon(characters, length, handling); |
| 279 } | 279 } |
| 280 | 280 |
| 281 } // namespace WTF | 281 } // namespace WTF |
| OLD | NEW |