New comit of SDL2
[supertux.git] / src / SDL2 / external / libwebp-0.3.0 / examples / example_util.h
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 //  Utility functions used by the example programs.
9 //
10
11 #ifndef WEBP_EXAMPLES_EXAMPLE_UTIL_H_
12 #define WEBP_EXAMPLES_EXAMPLE_UTIL_H_
13
14 #include "webp/types.h"
15
16 #if defined(__cplusplus) || defined(c_plusplus)
17 extern "C" {
18 #endif
19
20 // Allocates storage for entire file 'file_name' and returns contents and size
21 // in 'data' and 'data_size'. Returns 1 on success, 0 otherwise. '*data' should
22 // be deleted using free().
23 int ExUtilReadFile(const char* const file_name,
24                    const uint8_t** data, size_t* data_size);
25
26 // Write a data segment into a file named 'file_name'. Returns true if ok.
27 int ExUtilWriteFile(const char* const file_name,
28                     const uint8_t* data, size_t data_size);
29
30 #if defined(__cplusplus) || defined(c_plusplus)
31 }    // extern "C"
32 #endif
33
34 #endif  // WEBP_EXAMPLES_EXAMPLE_UTIL_H_