OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008, 2010 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 registrar("Unicode", "UTF-16LE"); | 46 registrar("Unicode", "UTF-16LE"); |
47 registrar("csUnicode", "UTF-16LE"); | 47 registrar("csUnicode", "UTF-16LE"); |
48 registrar("unicodeFEFF", "UTF-16LE"); | 48 registrar("unicodeFEFF", "UTF-16LE"); |
49 | 49 |
50 registrar("unicodeFFFE", "UTF-16BE"); | 50 registrar("unicodeFFFE", "UTF-16BE"); |
51 } | 51 } |
52 | 52 |
53 static std::unique_ptr<TextCodec> newStreamingTextDecoderUTF16LE( | 53 static std::unique_ptr<TextCodec> newStreamingTextDecoderUTF16LE( |
54 const TextEncoding&, | 54 const TextEncoding&, |
55 const void*) { | 55 const void*) { |
56 return makeUnique<TextCodecUTF16>(true); | 56 return WTF::makeUnique<TextCodecUTF16>(true); |
57 } | 57 } |
58 | 58 |
59 static std::unique_ptr<TextCodec> newStreamingTextDecoderUTF16BE( | 59 static std::unique_ptr<TextCodec> newStreamingTextDecoderUTF16BE( |
60 const TextEncoding&, | 60 const TextEncoding&, |
61 const void*) { | 61 const void*) { |
62 return makeUnique<TextCodecUTF16>(false); | 62 return WTF::makeUnique<TextCodecUTF16>(false); |
63 } | 63 } |
64 | 64 |
65 void TextCodecUTF16::registerCodecs(TextCodecRegistrar registrar) { | 65 void TextCodecUTF16::registerCodecs(TextCodecRegistrar registrar) { |
66 registrar("UTF-16LE", newStreamingTextDecoderUTF16LE, 0); | 66 registrar("UTF-16LE", newStreamingTextDecoderUTF16LE, 0); |
67 registrar("UTF-16BE", newStreamingTextDecoderUTF16BE, 0); | 67 registrar("UTF-16BE", newStreamingTextDecoderUTF16BE, 0); |
68 } | 68 } |
69 | 69 |
70 String TextCodecUTF16::decode(const char* bytes, | 70 String TextCodecUTF16::decode(const char* bytes, |
71 size_t length, | 71 size_t length, |
72 FlushBehavior flush, | 72 FlushBehavior flush, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 for (size_t i = 0; i < length; ++i) { | 203 for (size_t i = 0; i < length; ++i) { |
204 bytes[i * 2] = 0; | 204 bytes[i * 2] = 0; |
205 bytes[i * 2 + 1] = characters[i]; | 205 bytes[i * 2 + 1] = characters[i]; |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 return result; | 209 return result; |
210 } | 210 } |
211 | 211 |
212 } // namespace WTF | 212 } // namespace WTF |
OLD | NEW |