Skip to content

Commit 6f26d02

Browse files
halx99minggo
authored andcommitted
Revert "Fix issue: cocos2d/cocos2d-x#20182 (#379)" (#380)
This reverts commit c28f67e.
1 parent c28f67e commit 6f26d02

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

unzip/ioapi_mem.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,7 @@ voidpf ZCALLBACK fopen_mem_func(voidpf opaque, ZIP_UNUSED const char *filename,
5656

5757
mem->cur_offset = 0;
5858

59-
/* pitfall: The builtin memfs management's behavior is not same with official minizip 1.2.0 */
60-
ourmemory_t* memfs = (ourmemory_t*)malloc(sizeof(ourmemory_t));
61-
if (memfs != nullptr) {
62-
memcpy(memfs, mem, sizeof(ourmemory_t));
63-
64-
return memfs;
65-
}
66-
return nullptr;
59+
return mem;
6760
}
6861

6962
voidpf ZCALLBACK fopendisk_mem_func(ZIP_UNUSED voidpf opaque, ZIP_UNUSED voidpf stream, ZIP_UNUSED uint32_t number_disk, ZIP_UNUSED int mode)
@@ -151,10 +144,6 @@ long ZCALLBACK fseek_mem_func(ZIP_UNUSED voidpf opaque, voidpf stream, uint32_t
151144
int ZCALLBACK fclose_mem_func(ZIP_UNUSED voidpf opaque, ZIP_UNUSED voidpf stream)
152145
{
153146
/* Even with grow = 1, caller must always free() memory */
154-
155-
/* pitfall: The builtin memfs management's behavior is not same with official minizip 1.2.0 */
156-
ourmemory_t* mem = (ourmemory_t*)stream;
157-
free(mem);
158147
return 0;
159148
}
160149

0 commit comments

Comments
 (0)