Skip to content

Commit 8577abf

Browse files
committed
Corrected some typos
Converted tabs to spaces Added some comments
1 parent b109342 commit 8577abf

File tree

2 files changed

+257
-229
lines changed

2 files changed

+257
-229
lines changed

cocos2d/Support/ZipUtils.h

+44-41
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
* http://themanaworld.org/
1111
* from the mapreader.cpp file
1212
*
13+
* Some modifications were taken from:
14+
* https://www.codeandweb.com/texturepacker/contentprotection
15+
*
1316
*/
14-
17+
1518
#ifndef __CC_ZIP_UTILS_H
1619
#define __CC_ZIP_UTILS_H
1720

@@ -20,69 +23,69 @@
2023
#ifdef __cplusplus
2124
extern "C" {
2225
#endif
23-
24-
/**
25-
* Set the TexturePacker encryption key
26-
*
27-
* If your key used to encrypt the pvr.ccz file is
28-
* aaaaaaaabbbbbbbbccccccccdddddddd
29-
* you have to call this function 4 times:
30-
* caw_setkey_part(0, 0xaaaaaaaa);
31-
* caw_setkey_part(1, 0xbbbbbbbb);
32-
* caw_setkey_part(2, 0xcccccccc);
33-
* caw_setkey_part(3, 0xdddddddd);
34-
*
35-
* Distribute the call accross some files but make sure
36-
* to call all of the parts *before* loading the first
37-
* spritesheet.
38-
*
39-
* @param index part of the key [0..3]
40-
* @param value value of the key part
41-
*/
42-
void caw_setkey_part(int index, uint32_t value);
4326

44-
/* XXX: pragma pack ??? */
45-
/** @struct CCZHeader
46-
*/
47-
struct CCZHeader {
48-
uint8_t sig[4]; // signature. Should be 'CCZ!' 4 bytes
49-
uint16_t compression_type; // should 0
50-
uint16_t version; // should be 2 (although version type==1 is also supported)
51-
uint32_t reserved; // Reserverd for users.
52-
uint32_t len; // size of the uncompressed file
53-
};
27+
/**
28+
* Set the TexturePacker encryption key
29+
*
30+
* If your key used to encrypt the pvr.ccz file is
31+
* aaaaaaaabbbbbbbbccccccccdddddddd
32+
* you have to call this function 4 times:
33+
* caw_setkey_part(0, 0xaaaaaaaa);
34+
* caw_setkey_part(1, 0xbbbbbbbb);
35+
* caw_setkey_part(2, 0xcccccccc);
36+
* caw_setkey_part(3, 0xdddddddd);
37+
*
38+
* Distribute the call accross some files but make sure
39+
* to call all of the parts *before* loading the first
40+
* spritesheet.
41+
*
42+
* @param index part of the key [0..3]
43+
* @param value value of the key part
44+
*/
45+
void caw_setkey_part(int index, uint32_t value);
46+
47+
/* XXX: pragma pack ??? */
48+
/** @struct CCZHeader
49+
*/
50+
struct CCZHeader {
51+
uint8_t sig[4]; // signature. Should be 'CCZ!' 4 bytes
52+
uint16_t compression_type; // should 0
53+
uint16_t version; // should be 2 (although version type==1 is also supported)
54+
uint32_t reserved; // Reserverd for users.
55+
uint32_t len; // size of the uncompressed file
56+
};
5457

55-
enum {
56-
CCZ_COMPRESSION_ZLIB, // zlib format.
57-
CCZ_COMPRESSION_BZIP2, // bzip2 format (not supported yet)
58-
CCZ_COMPRESSION_GZIP, // gzip format (not supported yet)
59-
CCZ_COMPRESSION_NONE, // plain (not supported yet)
60-
};
58+
enum {
59+
CCZ_COMPRESSION_ZLIB, // zlib format.
60+
CCZ_COMPRESSION_BZIP2, // bzip2 format (not supported yet)
61+
CCZ_COMPRESSION_GZIP, // gzip format (not supported yet)
62+
CCZ_COMPRESSION_NONE, // plain (not supported yet)
63+
};
6164

6265
/** @file
6366
* Zip helper functions
6467
*/
65-
68+
6669
/**
6770
* Inflates either zlib or gzip deflated memory. The inflated memory is
6871
* expected to be freed by the caller.
6972
*
7073
* It will allocate 256k for the destination buffer. If it is not enought it will multiply the previous buffer size per 2, until there is enough memory.
7174
* @returns the length of the deflated buffer
7275
*
73-
@since v0.8.1
76+
@since v0.8.1
7477
*/
7578
int ccInflateMemory(unsigned char *in, unsigned int inLength, unsigned char **out);
7679

7780
/**
7881
* Inflates either zlib or gzip deflated memory. The inflated memory is
7982
* expected to be freed by the caller.
8083
*
81-
* outLenghtHint is assumed to be the needed room to allocate the inflated buffer.
84+
* outLengthHint is assumed to be the needed room to allocate the inflated buffer.
8285
*
8386
* @returns the length of the deflated buffer
8487
*
85-
@since v1.0.0
88+
@since v1.0.0
8689
*/
8790
int ccInflateMemoryWithHint(unsigned char *in, unsigned int inLength, unsigned char **out, unsigned int outLengthHint );
8891

0 commit comments

Comments
 (0)