Skip to content

Commit

Permalink
Revert "Fix issue: cocos2d/cocos2d-x#20182 (#379)" (#380)
Browse files Browse the repository at this point in the history
This reverts commit c28f67e.
  • Loading branch information
halx99 authored and minggo committed Oct 11, 2019
1 parent c28f67e commit 6f26d02
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions unzip/ioapi_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,7 @@ voidpf ZCALLBACK fopen_mem_func(voidpf opaque, ZIP_UNUSED const char *filename,

mem->cur_offset = 0;

/* pitfall: The builtin memfs management's behavior is not same with official minizip 1.2.0 */
ourmemory_t* memfs = (ourmemory_t*)malloc(sizeof(ourmemory_t));
if (memfs != nullptr) {
memcpy(memfs, mem, sizeof(ourmemory_t));

return memfs;
}
return nullptr;
return mem;
}

voidpf ZCALLBACK fopendisk_mem_func(ZIP_UNUSED voidpf opaque, ZIP_UNUSED voidpf stream, ZIP_UNUSED uint32_t number_disk, ZIP_UNUSED int mode)
Expand Down Expand Up @@ -151,10 +144,6 @@ long ZCALLBACK fseek_mem_func(ZIP_UNUSED voidpf opaque, voidpf stream, uint32_t
int ZCALLBACK fclose_mem_func(ZIP_UNUSED voidpf opaque, ZIP_UNUSED voidpf stream)
{
/* Even with grow = 1, caller must always free() memory */

/* pitfall: The builtin memfs management's behavior is not same with official minizip 1.2.0 */
ourmemory_t* mem = (ourmemory_t*)stream;
free(mem);
return 0;
}

Expand Down

0 comments on commit 6f26d02

Please sign in to comment.