(C++) 解压缩 0 字节的文件时出现错误 ZR_FLATE。解压源:“Zip Utils -干净、优雅......”
我正在使用来自此来源的 unzip.h 和 .cpp: http://www.codeproject.com/KB/files/zip_utils.aspx
正如标题所说 - 当我解压一个 0 字节的文件时,我得到 ZR_FALTE。我已经搜索了这个错误并没有找到任何答案。我还为作者发布了关于 codeproject 的问题 codeproject 帖子 但之前也有人问过同样的问题,但没有答案。
我的问题是是否有人以前使用过该源并知道如何修复它。或者在其他条件下可能会发生错误。
目前我缩小错误范围并忽略它的方法是:
ZENTRY zEntry;
ZRESULT zRes;
// uncompress...
if (zRes == ZR_FLATE && zEntry.comp_size == 0 && zEntry.unc_size == 0)
{
// No error
}
源中错误的定义是: “去/通货膨胀代码中存在内部错误”
谢谢
I am using unzip.h and .cpp from this source:
http://www.codeproject.com/KB/files/zip_utils.aspx
As the title says - when I unzip a file with 0 bytes I get ZR_FALTE. I have searched for this error all over and not found any answer. I have also posted a question on codeproject for the author codeproject post but the same question have been asked there before without answers.
My question is if anyone have worked with that source before and knows how to fix it. Or during which other conditions the error can occurr.
The current way I narrow the error down and ignore it is:
ZENTRY zEntry;
ZRESULT zRes;
// uncompress...
if (zRes == ZR_FLATE && zEntry.comp_size == 0 && zEntry.unc_size == 0)
{
// No error
}
The definition for the error in the source is:
"an internal error in the de/inflation code"
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是函数 unzReadCurrentFile(...) 中的错误。您可以通过添加以下行来修复它(在 unzip.cpp 行:3486 中):
如您所见,对于零大小的文件,EOF 检测被破坏,我猜这是因为后来添加的缓冲区大小检查。
This is an error in function: unzReadCurrentFile(...). You can fix it by adding the following lines (in unzip.cpp line:3486):
As you can see, the EOF detection is broken for zero-sized files, I guess that's because of buffer size checks, that were added later.