有用过zlib解压的么?
我调用uncompress在IPhone4上都没问题
在IPhone3GS (ios4.2)上就不行,总是解压失败 看返回值-5,看意思是说目标内存不够,我设的内存已比需要大很多也还是报这个错,有没有人碰到过这样的啊?
------解决方案--------------------
-5应该是buf错误:
Z_BUF_ERROR
const char * const z_errmsg[10] = {
"need dictionary", /* Z_NEED_DICT 2 */
"stream end", /* Z_STREAM_END 1 */
"", /* Z_OK 0 */
"file error", /* Z_ERRNO (-1) */
"stream error", /* Z_STREAM_ERROR (-2) */
"data error", /* Z_DATA_ERROR (-3) */
"insufficient memory", /* Z_MEM_ERROR (-4) */
"buffer error", /* Z_BUF_ERROR (-5) */
"incompatible version",/* Z_VERSION_ERROR (-6) */
""};
所以,你应该检查buf设置的是否正确。
------解决方案--------------------
截取代码注释部分:
if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible
(for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
fatal, and deflate() can be called again with more input and more output
space to continue compressing.
可能是buf不够了。
------解决方案--------------------
源代码中搜索Z_BUF_ERROR也可能得到错误的原因