|
cocos2d for iPhone 1.0.0
2D engine for iOS and OS X
|
00001 /* cocos2d for iPhone 00002 * 00003 * http://www.cocos2d-iphone.org 00004 * 00005 * 00006 * inflateMemory_ based on zlib example code 00007 * http://www.zlib.net 00008 * 00009 * Some ideas were taken from: 00010 * http://themanaworld.org/ 00011 * from the mapreader.cpp file 00012 * 00013 */ 00014 00015 #ifndef __CC_ZIP_UTILS_H 00016 #define __CC_ZIP_UTILS_H 00017 00018 #import <stdint.h> 00019 00020 #ifdef __cplusplus 00021 extern "C" { 00022 #endif 00023 00024 /* XXX: pragma pack ??? */ 00027 struct CCZHeader { 00028 uint8_t sig[4]; // signature. Should be 'CCZ!' 4 bytes 00029 uint16_t compression_type; // should 0 00030 uint16_t version; // should be 2 (although version type==1 is also supported) 00031 uint32_t reserved; // Reserverd for users. 00032 uint32_t len; // size of the uncompressed file 00033 }; 00034 00035 enum { 00036 CCZ_COMPRESSION_ZLIB, // zlib format. 00037 CCZ_COMPRESSION_BZIP2, // bzip2 format (not supported yet) 00038 CCZ_COMPRESSION_GZIP, // gzip format (not supported yet) 00039 CCZ_COMPRESSION_NONE, // plain (not supported yet) 00040 }; 00041 00055 int ccInflateMemory(unsigned char *in, unsigned int inLength, unsigned char **out); 00056 00067 int ccInflateMemoryWithHint(unsigned char *in, unsigned int inLength, unsigned char **out, unsigned int outLenghtHint ); 00068 00069 00076 int ccInflateGZipFile(const char *filename, unsigned char **out); 00077 00084 int ccInflateCCZFile(const char *filename, unsigned char **out); 00085 00086 00087 #ifdef __cplusplus 00088 } 00089 #endif 00090 00091 #endif // __CC_ZIP_UTILS_H