From 5e4b1548315976918cd755eca72ec47a53096be4 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Fri, 8 Mar 2019 16:29:20 +0100 Subject: Fix description of cc4group.setEntryData and remove wrong description of cc4group.createFile --- src/cc4group.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/cc4group.h') diff --git a/src/cc4group.h b/src/cc4group.h index 82eddf6..9c5625b 100644 --- a/src/cc4group.h +++ b/src/cc4group.h @@ -65,8 +65,8 @@ typedef struct { struct { int Take; // cc4group will free the data when its not needed anymore; e.g. in the destructor or when setting the file's data again - int Copy; // cc4group will copy the data to use it - int Reference; // cc4group will use the data as is (i.e. store the pointer and use it); the caller must guarantee it's validity throughout the groups lifetime (or until the file's data is set to a new pointer) + int Copy; // cc4group will copy the data to use it; the original data is untouched and needs to be freed by the caller whenever desired + int Reference; // cc4group will use the data as is (i.e. store the pointer and use it); the caller must guarantee it's validity throughout the groups lifetime (or until the file's data is set to a new pointer) and needs to take care of freeing it afterwards } const MemoryManagement; void (*setTmpMemoryStrategy)(const CC4Group_TmpMemoryStrategy strategy); @@ -85,10 +85,9 @@ typedef struct { bool (*renameEntry)(CC4Group* const this, const char* const oldPath, const char* const newPath); bool (*createDirectory)(CC4Group* const this, const char* const path); - // ownership of the data is taken by the group bool (*createFile)(CC4Group* const this, const char* const path); - // ownership of the data is taken by the group if freeData is true - // if freeData is false, the caller must guarantee that the pointer is valid as long as it is used in the group (i.e. until the pointer is changed through another call to setEntryData or the group is destructed) + + // see the description of MemoryManagement to know if and when data has to be freed by the caller bool (*setEntryData)(CC4Group* const this, const char* const entryPath, const void* const data, size_t const size, int const memoryManagementMode); } const CC4Group_API; -- cgit v1.2.3-54-g00ecf