blob: 7b30dbe1b436cd3b07ce13fd2e4543bd4a0c39e8 [file] [log] [blame]
James Zern061263a2012-05-11 16:00:57 -07001// 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)
17extern "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().
23int ExUtilReadFile(const char* const file_name,
24 const uint8_t** data, size_t* data_size);
25
Urvang Joshie9a15a32012-11-07 14:41:15 -080026// Write a data segment into a file named 'file_name'. Returns true if ok.
27int ExUtilWriteFile(const char* const file_name,
28 const uint8_t* data, size_t data_size);
29
James Zern061263a2012-05-11 16:00:57 -070030#if defined(__cplusplus) || defined(c_plusplus)
31} // extern "C"
32#endif
33
34#endif // WEBP_EXAMPLES_EXAMPLE_UTIL_H_