diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cc4group.c | 18 | ||||
| -rw-r--r-- | src/cc4group.h | 4 | ||||
| -rw-r--r-- | src/cppc4group.cpp | 4 |
3 files changed, 13 insertions, 13 deletions
diff --git a/src/cc4group.c b/src/cc4group.c index ca5d0db..14d35ab 100644 --- a/src/cc4group.c +++ b/src/cc4group.c @@ -382,7 +382,7 @@ static bool cc4group_inflateFillOutput(z_stream* const strm, CC4Group_ReadCallba } size_t readSize = 0; - *eof = callback(lastData, &readSize, callbackArg); + *eof = callback((const void**)lastData, &readSize, callbackArg); if(readSize == 0) { @@ -447,7 +447,7 @@ static bool cc4group_uncompressGroup(CC4Group* const this, CC4Group_ReadCallback readData = NULL; readSize = 0; - eof = callback(&readData, &readSize, callbackArg); + eof = callback((const void**)&readData, &readSize, callbackArg); if(readSize == 0) { @@ -672,11 +672,11 @@ ret: } typedef struct { - const uint8_t* data; + const void* data; size_t size; } CompleteDataReadCallbackArg; -static bool cc4group_completeDataReadCallback(const uint8_t** const data, size_t* const size, void* callbackArg) +static bool cc4group_completeDataReadCallback(const void** const data, size_t* const size, void* callbackArg) { CompleteDataReadCallbackArg* argData = callbackArg; *data = argData->data; @@ -684,10 +684,10 @@ static bool cc4group_completeDataReadCallback(const uint8_t** const data, size_t return true; } -static bool cc4group_readFdReadCallback(const uint8_t** const data, size_t* const size, void* callbackArg) +static bool cc4group_readFdReadCallback(const void** const data, size_t* const size, void* callbackArg) { #define CHUNK_SIZE 1000*1000 - uint8_t* readData = malloc(CHUNK_SIZE); + void* readData = malloc(CHUNK_SIZE); if(data == NULL) { return true; @@ -705,10 +705,10 @@ static bool cc4group_readFdReadCallback(const uint8_t** const data, size_t* cons #undef CHUNK_SIZE } -static bool cc4group_readFilePointerReadCallback(const uint8_t** const data, size_t* const size, void* callbackArg) +static bool cc4group_readFilePointerReadCallback(const void** const data, size_t* const size, void* callbackArg) { #define CHUNK_SIZE 1000*1000 - uint8_t* readData = malloc(CHUNK_SIZE); + void* readData = malloc(CHUNK_SIZE); if(data == NULL) { return true; @@ -726,7 +726,7 @@ static bool cc4group_readFilePointerReadCallback(const uint8_t** const data, siz #undef CHUNK_SIZE } -static bool cc4group_openMemory(CC4Group* const this, const uint8_t* const compressedData, size_t const size, int const memoryManagement) +static bool cc4group_openMemory(CC4Group* const this, const void* const compressedData, size_t const size, int const memoryManagement) { assert(this); assert(compressedData); diff --git a/src/cc4group.h b/src/cc4group.h index a63d995..5031e95 100644 --- a/src/cc4group.h +++ b/src/cc4group.h @@ -35,7 +35,7 @@ typedef void* (*CC4Group_TmpMemoryStrategy)(CC4Group* const this, const size_t s // the callback has to store a pointer to the newly read data in data, as well as the amount of read data in size // the callback must return true if the end of data is reached or any read error happens and false otherwise // the pointer passed in will be handled as specified with the corresponding MemoryManagement -typedef bool (*CC4Group_ReadCallback)(const uint8_t** const data, size_t* const size, void* const arg); +typedef bool (*CC4Group_ReadCallback)(const void** const data, size_t* const size, void* const arg); typedef struct { CC4Group* (*new)(void); @@ -50,7 +50,7 @@ typedef struct { // only open an in-memory group on a frehsly created group object // see the description of MemoryManagement to know if and when data has to be freed by the caller // if the lazy mode is not used, the data can be freed immediately after this function returns - bool (*openMemory)(CC4Group* const this, const uint8_t* const groupData, size_t const size, int const memoryManagement); + bool (*openMemory)(CC4Group* const this, const void* const groupData, size_t const size, int const memoryManagement); // opens a group through a file descriptor // the file descriptor must have been opened with read access diff --git a/src/cppc4group.cpp b/src/cppc4group.cpp index 2768afd..b76e220 100644 --- a/src/cppc4group.cpp +++ b/src/cppc4group.cpp @@ -88,12 +88,12 @@ bool CppC4Group::openFilePointer(FILE* file) bool CppC4Group::openMemory(const void* const data, const size_t size, const MemoryManagement management) { - return cc4group.openMemory(p->g, reinterpret_cast<const uint8_t* const>(data), size, convertMemoryManagement(management)); + return cc4group.openMemory(p->g, data, size, convertMemoryManagement(management)); } bool CppC4Group::openWithReadCallback(const ReadCallback callback, void* const callbackArg, const MemoryManagement management) { - return cc4group.openWithReadCallback(p->g, reinterpret_cast<CC4Group_ReadCallback>(callback), callbackArg, convertMemoryManagement(management)); + return cc4group.openWithReadCallback(p->g, callback, callbackArg, convertMemoryManagement(management)); } bool CppC4Group::save(const std::string& path, const bool overwrite) |
