124 file_list[i].
next = 0;
125 file_list[i].
prev = 0;
143 if (!file_list[i].
free)
148 file_list[i].
next = 0;
149 file_list[i].
prev = 0;
170 INFO_PRINT((
"BEGIN: MHEG5storageWrite - File [%.*s], Length [0x%x].\n", fn.
len, fn.
data, len));
175 DEBUG_PRINT((
"ERROR: MHEG5storageWrite - File [%.*s] too big [0x%x].\n", fn.
len, fn.
data, len));
185 INFO_PRINT((
"WARNING: MHEG5storageWrite - Found duplicate file name [%.*s] in list.\n", fn.
len, fn.
data));
192 if (file_list[i].
prev != 0)
197 if (file_list[i].
next != 0)
202 if (file_list_top == &file_list[i])
204 file_list_top = file_list[i].
next;
207 file_list[i].
prev = 0;
208 file_list[i].
next = 0;
216 (file_list_top != 0))
218 INFO_PRINT((
"WARNING: MHEG5storageWrite - Not enough space in list, deleting files.\n"));
219 temp_file = file_list_top;
222 DEBUG_PRINT((
"ERROR: MHEG5storageWrite - Cannot remove from empty list.\n"));
226 while (temp_file->
next != 0)
228 temp_file = temp_file->
next;
237 if (temp_file->
prev != 0)
242 if (file_list_top == temp_file)
260 DEBUG_PRINT((
"ERROR: MHEG5storageWrite - No empty slot in list.\n"));
268 DEBUG_PRINT((
"ERROR: MHEG5storageWrite - Unable to allocate memory for file.\n"));
274 memcpy(file_list[i].
data.
data, buf, len);
277 file_list[i].
next = file_list_top;
278 if (file_list[i].
next != 0)
280 file_list[i].
next->
prev = &file_list[i];
282 file_list[i].
prev = 0;
283 file_list_top = &file_list[i];
285 INFO_PRINT((
"SUCCESS: MHEG5storageWrite - File [%.*s] added to list.\n", fn.
len, fn.
data));
302 if (buf == 0 || len == 0)
304 DEBUG_PRINT((
"ERROR: MHEG5storageRead - Bad data variable pointer passed.\n"));
314 INFO_PRINT((
"SUCCESS: MHEG5storageRead - Found file [%.*s] in list.\n", fn.
len, fn.
data));
318 INFO_PRINT((
"WARNING: MHEG5storageRead - Unable to find file [%.*s] in list.\n", fn.
len, fn.
data));
MHEG5Bool MHEG5storageWrite(MHEG5String fn, void *buf, MHEG5Int len)
Write a file to the persistent store.
MHEG5Bool MHEG5stringEqual(MHEG5String *s1, MHEG5String *s2)
Compare two Strings (case sensitive!)
#define MHEG5STORAGE_MEMSIZE
unsigned char * STR_DataAlloc(unsigned int size)
MHEG5String MHEG5stringCopy(MHEG5String source)
<Function description>="">
void MHEG5InitStore(void)
Initialise Persistent Storage.
void MHEG5stringDestruct(MHEG5String *item)
Destruct a MHEG5String.
void MHEG5ResetStore(void)
destroy Persistent Storage - only really useful on platform like WINDOWS
MHEG5Bool MHEG5storageRead(MHEG5String fn, void **buf, MHEG5Int *len)
Read a file from the persistent store.
This file defines the profile for the MHEG engine.
Mheg5 logging and debug printing.
Persistent storage module. The engine provides a persistent storage for 1024 bytes of data...
struct sRamFile MHEG5RamFile