int ZipUtils::ccInflateMemoryWithHint(unsigned char *in, unsigned int inLength, unsigned char **out, unsigned int outLengthHint) { unsigned int outLength = 0; int err = ccInflateMemoryWithHint(in, inLength, out, &outLength, outLengthHint); if (err != Z_OK || *out == NULL) { if (err == Z_MEM_ERROR) { CCLOG("cocos2d: ZipUtils: Out of memory while decompressing map data!"); } else if (err == Z_VERSION_ERROR) { CCLOG("cocos2d: ZipUtils: Incompatible zlib version!"); } else if (err == Z_DATA_ERROR) { CCLOG("cocos2d: ZipUtils: Incorrect zlib compressed data!"); } else { CCLOG("cocos2d: ZipUtils: Unknown error while decompressing map data!"); } delete[] *out; *out = NULL; outLength = 0; } return outLength; }
KDint ZipUtils::ccInflateMemoryWithHint ( KDubyte* pSrc, KDuint uLenSrc, KDubyte** ppDst, KDuint uLenHintDst ) { KDuint uLenDst = 0; KDint nErr = ccInflateMemoryWithHint ( pSrc, uLenSrc, ppDst, &uLenDst, uLenHintDst ); if ( nErr != Z_OK || *ppDst == KD_NULL ) { if ( nErr == Z_MEM_ERROR ) { CCLOG ( "XMCocos2D : ZipUtils - Out of memory while decompressing map data!"); } else if ( nErr == Z_VERSION_ERROR ) { CCLOG ( "XMCocos2D : ZipUtils - Incompatible zlib version!"); } else if ( nErr == Z_DATA_ERROR ) { CCLOG ( "XMCocos2D : ZipUtils - Incorrect zlib compressed data!" ); } else { CCLOG ( "XMCocos2D : ZipUtils - Unknown error while decompressing map data!" ); } CC_SAFE_DELETE_ARRAY ( *ppDst ); uLenDst = 0; } return uLenDst; }
int ZipUtils::ccInflateMemory(unsigned char *in, unsigned int inLength, unsigned char **out) { // 256k for hint return ccInflateMemoryWithHint(in, inLength, out, 256 * 1024); }
KDint ZipUtils::ccInflateMemory ( KDubyte* pSrc, KDuint uLenSrc, KDubyte** ppDst ) { // 256k for hint return ccInflateMemoryWithHint ( pSrc, uLenSrc, ppDst, 256 * 1024 ); }