1 // Copyright 2012 Google Inc. All Rights Reserved.
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 // -----------------------------------------------------------------------------
8 // Utility functions used by the example programs.
11 #ifndef WEBP_EXAMPLES_EXAMPLE_UTIL_H_
12 #define WEBP_EXAMPLES_EXAMPLE_UTIL_H_
14 #include "webp/types.h"
16 #if defined(__cplusplus) || defined(c_plusplus)
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);
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);
30 #if defined(__cplusplus) || defined(c_plusplus)
34 #endif // WEBP_EXAMPLES_EXAMPLE_UTIL_H_