OLD | NEW |
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 /* Provides checked integers, detecting integer overflow and divide-by-0. */ | 6 /* Provides checked integers, detecting integer overflow and divide-by-0. */ |
7 | 7 |
8 // Necessary modifications are made to the original CheckedInt.h file when | 8 // Necessary modifications are made to the original CheckedInt.h file when |
9 // incorporating it into WebKit: | 9 // incorporating it into WebKit: |
10 // 1) Comment out #define MOZ_CHECKEDINT_ENABLE_MOZ_ASSERTS | 10 // 1) Comment out #define MOZ_CHECKEDINT_ENABLE_MOZ_ASSERTS |
11 // 2) Comment out #include "mozilla/StandardInteger.h" | 11 // 2) Comment out #include "mozilla/StandardInteger.h" |
12 // 3) Define MOZ_DELETE | 12 // 3) Define MOZ_DELETE |
13 // 4) Change namespace mozilla to namespace WebCore | 13 // 4) Change namespace mozilla to namespace blink |
14 | 14 |
15 #ifndef mozilla_CheckedInt_h_ | 15 #ifndef mozilla_CheckedInt_h_ |
16 #define mozilla_CheckedInt_h_ | 16 #define mozilla_CheckedInt_h_ |
17 | 17 |
18 /* | 18 /* |
19 * Build options. Comment out these #defines to disable the corresponding | 19 * Build options. Comment out these #defines to disable the corresponding |
20 * optional feature. Disabling features may be useful for code using | 20 * optional feature. Disabling features may be useful for code using |
21 * CheckedInt outside of Mozilla (e.g. WebKit) | 21 * CheckedInt outside of Mozilla (e.g. WebKit) |
22 */ | 22 */ |
23 | 23 |
(...skipping 16 matching lines...) Expand all Loading... |
40 #endif | 40 #endif |
41 | 41 |
42 // #include "mozilla/StandardInteger.h" | 42 // #include "mozilla/StandardInteger.h" |
43 | 43 |
44 #ifndef MOZ_DELETE | 44 #ifndef MOZ_DELETE |
45 #define MOZ_DELETE | 45 #define MOZ_DELETE |
46 #endif | 46 #endif |
47 | 47 |
48 #include <climits> | 48 #include <climits> |
49 | 49 |
50 namespace WebCore { | 50 namespace blink { |
51 | 51 |
52 namespace detail { | 52 namespace detail { |
53 | 53 |
54 /* | 54 /* |
55 * Step 1: manually record supported types | 55 * Step 1: manually record supported types |
56 * | 56 * |
57 * What's nontrivial here is that there are different families of integer | 57 * What's nontrivial here is that there are different families of integer |
58 * types: basic integer types and stdint types. It is merrily undefined which | 58 * types: basic integer types and stdint types. It is merrily undefined which |
59 * types from one family may be just typedefs for a type from another family. | 59 * types from one family may be just typedefs for a type from another family. |
60 * | 60 * |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 // Convenience typedefs. | 806 // Convenience typedefs. |
807 typedef CheckedInt<int8_t> CheckedInt8; | 807 typedef CheckedInt<int8_t> CheckedInt8; |
808 typedef CheckedInt<uint8_t> CheckedUint8; | 808 typedef CheckedInt<uint8_t> CheckedUint8; |
809 typedef CheckedInt<int16_t> CheckedInt16; | 809 typedef CheckedInt<int16_t> CheckedInt16; |
810 typedef CheckedInt<uint16_t> CheckedUint16; | 810 typedef CheckedInt<uint16_t> CheckedUint16; |
811 typedef CheckedInt<int32_t> CheckedInt32; | 811 typedef CheckedInt<int32_t> CheckedInt32; |
812 typedef CheckedInt<uint32_t> CheckedUint32; | 812 typedef CheckedInt<uint32_t> CheckedUint32; |
813 typedef CheckedInt<int64_t> CheckedInt64; | 813 typedef CheckedInt<int64_t> CheckedInt64; |
814 typedef CheckedInt<uint64_t> CheckedUint64; | 814 typedef CheckedInt<uint64_t> CheckedUint64; |
815 | 815 |
816 } // namespace WebCore | 816 } // namespace blink |
817 | 817 |
818 #endif /* mozilla_CheckedInt_h_ */ | 818 #endif /* mozilla_CheckedInt_h_ */ |
OLD | NEW |