OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
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 | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "wtf/text/TextEncodingRegistry.h" | 28 #include "wtf/text/TextEncodingRegistry.h" |
29 | 29 |
30 #include "wtf/ASCIICType.h" | 30 #include "wtf/ASCIICType.h" |
31 #include "wtf/CurrentTime.h" | 31 #include "wtf/CurrentTime.h" |
32 #include "wtf/HashMap.h" | 32 #include "wtf/HashMap.h" |
33 #include "wtf/HashSet.h" | 33 #include "wtf/HashSet.h" |
34 #include "wtf/MainThread.h" | 34 #include "wtf/MainThread.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 unsigned h = WTF::stringHashingStartValue; | 78 unsigned h = WTF::stringHashingStartValue; |
79 for (;;) { | 79 for (;;) { |
80 char c = *s++; | 80 char c = *s++; |
81 if (!c) { | 81 if (!c) { |
82 h += (h << 3); | 82 h += (h << 3); |
83 h ^= (h >> 11); | 83 h ^= (h >> 11); |
84 h += (h << 15); | 84 h += (h << 15); |
85 return h; | 85 return h; |
86 } | 86 } |
87 h += toASCIILower(c); | 87 h += toASCIILower(c); |
88 h += (h << 10); | 88 h += (h << 10); |
89 h ^= (h >> 6); | 89 h ^= (h >> 6); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 static const bool safeToCompareToEmptyOrDeleted = false; | 93 static const bool safeToCompareToEmptyOrDeleted = false; |
94 }; | 94 }; |
95 | 95 |
96 struct TextCodecFactory { | 96 struct TextCodecFactory { |
97 NewTextCodecFunction function; | 97 NewTextCodecFunction function; |
98 const void* additionalData; | 98 const void* additionalData; |
99 TextCodecFactory(NewTextCodecFunction f = 0, const void* d = 0) : function(f
), additionalData(d) { } | 99 TextCodecFactory(NewTextCodecFunction f = 0, const void* d = 0) : function(f
), additionalData(d) { } |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 MutexLocker lock(encodingRegistryMutex()); | 352 MutexLocker lock(encodingRegistryMutex()); |
353 | 353 |
354 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin(); | 354 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin(); |
355 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end(); | 355 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end(); |
356 for (; it != end; ++it) | 356 for (; it != end; ++it) |
357 fprintf(stderr, "'%s' => '%s'\n", it->key, it->value); | 357 fprintf(stderr, "'%s' => '%s'\n", it->key, it->value); |
358 } | 358 } |
359 #endif | 359 #endif |
360 | 360 |
361 } // namespace WTF | 361 } // namespace WTF |
OLD | NEW |