Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1218)

Side by Side Diff: third_party/libwebp/utils/utils.h

Issue 10832153: libwebp: update snapshot to v0.2.0-rc1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2012 Google Inc. All Rights Reserved.
2 //
3 // This code is licensed under the same terms as WebM:
4 // Software License Agreement: http://www.webmproject.org/license/software/
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 // -----------------------------------------------------------------------------
7 //
8 // Misc. common utility functions
9 //
10 // Author: Skal (pascal.massimino@gmail.com)
11
12 #ifndef WEBP_UTILS_UTILS_H_
13 #define WEBP_UTILS_UTILS_H_
14
15 #include "../webp/types.h"
16
17 #if defined(__cplusplus) || defined(c_plusplus)
18 extern "C" {
19 #endif
20
21 //------------------------------------------------------------------------------
22 // Memory allocation
23
24 // This is the maximum memory amount that libwebp will ever try to allocate.
25 #define WEBP_MAX_ALLOCABLE_MEMORY (1ULL << 40)
26
27 // size-checking safe malloc/calloc: verify that the requested size is not too
28 // large, or return NULL. You don't need to call these for constructs like
29 // malloc(sizeof(foo)), but only if there's picture-dependent size involved
30 // somewhere (like: malloc(num_pixels * sizeof(*something))). That's why this
31 // safe malloc() borrows the signature from calloc(), pointing at the dangerous
32 // underlying multiply involved.
33 void* WebPSafeMalloc(uint64_t nmemb, size_t size);
34 // Note that WebPSafeCalloc() expects the second argument type to be 'size_t'
35 // in order to favor the "calloc(num_foo, sizeof(foo))" pattern.
36 void* WebPSafeCalloc(uint64_t nmemb, size_t size);
37
38 //------------------------------------------------------------------------------
39
40 #if defined(__cplusplus) || defined(c_plusplus)
41 } // extern "C"
42 #endif
43
44 #endif /* WEBP_UTILS_UTILS_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698