diff options
| author | Markus Mittendrein <git@maxmitti.tk> | 2019-03-16 15:57:50 +0100 |
|---|---|---|
| committer | Markus Mittendrein <git@maxmitti.tk> | 2019-03-16 15:57:50 +0100 |
| commit | 58bc74b6fdd58e870e2bbb1503148f79f0726306 (patch) | |
| tree | ec51a3806d0709551c3933d2934a8a152351470b /src/cc4group.h | |
| parent | 673a447f292c07ad5399211f823ec45771bea07b (diff) | |
| download | cc4group-58bc74b6fdd58e870e2bbb1503148f79f0726306.tar.gz cc4group-58bc74b6fdd58e870e2bbb1503148f79f0726306.zip | |
Add initCallback and deinitCallback for openWithReadCallback
Diffstat (limited to 'src/cc4group.h')
| -rw-r--r-- | src/cc4group.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cc4group.h b/src/cc4group.h index cc04a4f..76a0970 100644 --- a/src/cc4group.h +++ b/src/cc4group.h @@ -37,6 +37,10 @@ typedef void* (*CC4Group_TmpMemoryStrategy)(CC4Group* const this, const size_t s // the pointer passed in will be handled as specified with the corresponding MemoryManagement typedef bool (*CC4Group_ReadCallback)(const void** const data, size_t* const size, void* const arg); +// can be used as initialization before and deinitialization after all necessary calls to a read callback are made; for instance for buffer allocation and deletion +// the callback should return true on success and false on failure +typedef bool (*CC4Group_ReadSetupCallback)(void* const arg); + typedef struct { CC4Group* (*new)(void); bool (*create)(CC4Group* const this); @@ -60,8 +64,8 @@ typedef struct { // the file must have been opened with read access; also be aware that the file must be opened with binary mode on windows bool (*openFilePointer)(CC4Group* const this, FILE* fd); - // opens a group and calls the callback to get the group data - bool (*openWithReadCallback)(CC4Group* const this, CC4Group_ReadCallback const callback, void* const callbackArg, int const memoryManagement); + // opens a group and calls the callback to get the group data; initCallback is called before readCallback is called and deinitCallback is called after all read operations are done; initCallback and deinitCallback may be NULL if they should not be used + bool (*openWithReadCallback)(CC4Group* const this, CC4Group_ReadCallback const readCallback, void* const callbackArg, int const memoryManagement, CC4Group_ReadSetupCallback const initCallback, CC4Group_ReadSetupCallback const deinitCallback); bool (*save)(CC4Group* const this, const char* const path); bool (*saveOverwrite)(CC4Group* const this, const char* const path); |
