- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在 LZMA 解压缩我之前使用 lzma e <infile> <outfile> -lc0 -lp2
压缩的资源文件从终端导入到我的项目中。但是,当应用于此文件时LzmaDec_DecodeToBuf
返回 1
在第一次迭代中,即 LZMA 数据错误。 (同时 inLen
始终为 5
, outLen
为 0
。)
这是为什么?
我的代码如下:
SRes static decompress(FILE *inFile, FILE *outFile)
{
// Position the inFile pointer at the start.
fseek(inFile, 0, SEEK_SET);
// Read in LZMA properties (5 bytes) and uncompressed size (8 bytes, little-endian) to header.
char unsigned header[LZMA_PROPS_SIZE+8];
fgets(header, sizeof(header), inFile);
CLzmaDec state;
LzmaDec_Construct(&state);
SRes res = LzmaDec_Allocate(&state, header, LZMA_PROPS_SIZE, &SzAllocForLzma);
if (res != SZ_OK) {
// Free all allocated structures.
LzmaDec_Free(&state, &SzAllocForLzma);
return res;
}
char unsigned inBuf[IN_BUF_SIZE];
char unsigned outBuf[OUT_BUF_SIZE];
LzmaDec_Init(&state);
ELzmaStatus status;
long unsigned outLen = sizeof(outBuf);
long unsigned inLen = sizeof(inBuf);
long unsigned inPos = ftell(inFile);
while (fgets(inBuf, sizeof(inBuf), inFile) != NULL) {
inLen = MIN(sizeof(inBuf), MAX(ftell(inFile)-inPos, 0));
outLen = sizeof(outBuf);
SRes res = LzmaDec_DecodeToBuf(&state,
outBuf,
&outLen,
inBuf,
&inLen,
LZMA_FINISH_ANY,
&status);
// continues...
最佳答案
这是一个相当旧的帖子要回复,但是我遇到了同样的问题。
问题是 header 不应该是您正在解压缩的数据的一部分。解决方案是在读取数据时从 sizeof(header) 而不是 0 开始,并且不要忘记通过 sizeof(标题)也。
关于objective-c - 以编程方式 LZMA 解压缩静态 LZMA 压缩文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9219693/
我正在 LZMA 解压缩我之前使用 lzma e -lc0 -lp2 压缩的资源文件从终端导入到我的项目中。但是,当应用于此文件时LzmaDec_DecodeToBuf返回 1在第一次迭代中,即
我正在尝试安装 docker-registry。在这之后我被卡住了: $ apt-get install python-pip python-dev $ pip install -r requirem
我有一个文件,是根据它的所有者LZMA压缩的。lzmadecode.exe(程序)解码它没有问题,所以文件没有损坏,看起来确实是 LZMA 编码的。 这是我将文件读取到缓冲区并调用 UnCompres
我真的需要知道每个lzma参数(mf,fb,lp,...)的含义。我在互联网上找不到任何好的文档。我需要此算法的详细信息。最详细的是: http://www.bugaco.com/7zip/MANUA
我在 7-zip 站点上找到了一个 LZMA 库,但是没有用。我没有使用文件,只是流式传输。对于某些原因,7-zip 站点上的库只是在流上写入 header 而不压缩流。 有些人遇到了一些问题?有一些
我需要了解有关 LZMA 压缩算法的详细信息。我知道它的一般概念,但我需要一些例子来详细解释它。谁能帮我获取更多信息? 谢谢。 最佳答案 试试 LZMA SDK .它“提供开发使用 LZMA 压缩的应
出现以下信息表示Python尚未安装完整。如果是!我必须安装“lzma”扩展吗? ModuleNotFoundError:没有模块名称“_lzma” 警告:Python lzma 扩展未编译。缺少 l
所以我有一个需要解压lzma的项目,所以我用Google搜索并找到了这个项目https://github.com/rainfiel/lua-lzma 经过一番摸索之后,我设法对其进行了编译,以发现它是
已关闭。此问题旨在寻求有关书籍、工具、软件库等的建议。不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以
所以尝试压缩一个 22gb 的文件,一切都适用于文件 nowPos64' 显示值为 4294958849 我知道这是一个 32 位无符号整数的最大值。我在 x64 中编译,所以这应该是个问题。 使用
此代码使用 Bzip2 写入 csv 文件压缩即时数据。 File.open('file.bz2', 'wb') do |f| writer = Bzip2::Writer.new f CSV
我有一个巨大的文件,我们称它为 one-csv-file.xz。它是一个 XZ 压缩的 CSV 文件。 如何在不首先将文件解压缩到磁盘的情况下打开并解析文件?例如,如果文件是 100 GB 怎么办?当
http://www.7-zip.org/sdk.html 我可以用它来压缩文件,但是找不到压缩文件夹的功能 最佳答案 您必须创建一个 .7z 存档,然后在其中包含该文件夹的所有文件。没有直接的“文件
在我的应用程序中,我使用 LZMA SDK 压缩了大约 400Mb 的数据。当然,这需要一些时间。即使在大量谷歌搜索之后,我也无法找到任何有关如何获取压缩过程实时进度信息的信息。这是通过一些回调函数还
7-Zip 声明使用 LZMA作为压缩算法。 然而,LZMA SDK带有两个可执行文件,7zr.exe 和 lzma.exe,它们具有不同的选项/开关,并产生不同的结果,这些结果不可互换,即使它们的大
我有一个代码可以工作,但我对结果并不完全满意,所以我想我可以在这里问一些问题。 这是我的两个函数: void compress(string nameSrc, string nameDst){
我正在尝试将 LZMA 流解码为流对象,这样我就可以从中读取数据而不会占用内存。 我的输入文件看起来像: some uncompressed data . . some lzma compressed
我知道如何创建 zip 存档: import java.io.*; import java.util.zip.*; public class ZipCreateExample{ public
我正在尝试使用 解压缩 .7z(或 .xz 或 .lzma)文件 在 Linux 平台上 boost 库 1.67.0 使用以下代码: vector readFromCompressedFil
我正在尝试使用 R 从从包含 JSON 文件的 API 下载的 LZMA 存档中提取文件。在我的计算机上,我可以在 Windows 资源管理器中手动提取文件,没有任何问题。 这是我当前的代码(已删除
我是一名优秀的程序员,十分优秀!