OLD | NEW |
1 // Copyright 2012 Google Inc. All Rights Reserved. | 1 // Copyright 2012 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license | 3 // Use of this source code is governed by a BSD-style license |
4 // that can be found in the COPYING file in the root of the source | 4 // that can be found in the COPYING file in the root of the source |
5 // tree. An additional intellectual property rights grant can be found | 5 // tree. An additional intellectual property rights grant can be found |
6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
9 // | 9 // |
10 // Misc. common utility functions | 10 // Misc. common utility functions |
11 // | 11 // |
12 // Authors: Skal (pascal.massimino@gmail.com) | 12 // Authors: Skal (pascal.massimino@gmail.com) |
13 // Urvang (urvang@google.com) | 13 // Urvang (urvang@google.com) |
14 | 14 |
15 #ifndef WEBP_UTILS_UTILS_H_ | 15 #ifndef WEBP_UTILS_UTILS_H_ |
16 #define WEBP_UTILS_UTILS_H_ | 16 #define WEBP_UTILS_UTILS_H_ |
17 | 17 |
18 #include <assert.h> | 18 #include <assert.h> |
19 | 19 |
20 #include "../webp/types.h" | 20 #include "../webp/types.h" |
21 | 21 |
22 #if defined(__cplusplus) || defined(c_plusplus) | 22 #ifdef __cplusplus |
23 extern "C" { | 23 extern "C" { |
24 #endif | 24 #endif |
25 | 25 |
26 //------------------------------------------------------------------------------ | 26 //------------------------------------------------------------------------------ |
27 // Memory allocation | 27 // Memory allocation |
28 | 28 |
29 // This is the maximum memory amount that libwebp will ever try to allocate. | 29 // This is the maximum memory amount that libwebp will ever try to allocate. |
30 #define WEBP_MAX_ALLOCABLE_MEMORY (1ULL << 40) | 30 #define WEBP_MAX_ALLOCABLE_MEMORY (1ULL << 40) |
31 | 31 |
32 // size-checking safe malloc/calloc: verify that the requested size is not too | 32 // size-checking safe malloc/calloc: verify that the requested size is not too |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 data[2] = (val >> 16); | 69 data[2] = (val >> 16); |
70 } | 70 } |
71 | 71 |
72 static WEBP_INLINE void PutLE32(uint8_t* const data, uint32_t val) { | 72 static WEBP_INLINE void PutLE32(uint8_t* const data, uint32_t val) { |
73 PutLE16(data, (int)(val & 0xffff)); | 73 PutLE16(data, (int)(val & 0xffff)); |
74 PutLE16(data + 2, (int)(val >> 16)); | 74 PutLE16(data + 2, (int)(val >> 16)); |
75 } | 75 } |
76 | 76 |
77 //------------------------------------------------------------------------------ | 77 //------------------------------------------------------------------------------ |
78 | 78 |
79 #if defined(__cplusplus) || defined(c_plusplus) | 79 #ifdef __cplusplus |
80 } // extern "C" | 80 } // extern "C" |
81 #endif | 81 #endif |
82 | 82 |
83 #endif /* WEBP_UTILS_UTILS_H_ */ | 83 #endif /* WEBP_UTILS_UTILS_H_ */ |
OLD | NEW |