3 Copyright 2011 David Robillard <http://drobilla.net>
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
8 1. Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
11 2. Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
15 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
18 AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24 THE POSSIBILITY OF SUCH DAMAGE.
34 # define PACKED __attribute__((__packed__))
43 typedef struct _RDFF* RDFF;
47 RDFF_STATUS_UNKNOWN_ERROR = 1,
49 RDFF_STATUS_CORRUPT = 3
53 Generic RIFF chunk header.
67 } PACKED RDFFURIChunk;
77 } PACKED RDFFValueChunk;
80 Open/Create a new RDFF file.
83 rdff_open(const char* path, bool write);
86 Write a URI ID to @a file.
89 rdff_write_uri(RDFF file,
95 Write a key/value record to @a file.
98 rdff_write_value(RDFF file,
105 Read a chunk from @a file.
107 @param buf MUST point to an RDFFChunk dynamically allocated with malloc.
108 The @a size field (i.e. (*buf)->size) MUST be set to the amount of available
109 memory in the chunk (not including the header). If this is insufficient,
110 *buf will be resized using realloc.
113 rdff_read_chunk(RDFF file,
118 After this call, @a file is invalid.
121 rdff_close(RDFF file);
127 #endif /* RDFF_RDFF_H */