如何用zlib压缩内存数据压缩

//在工程根目录放入文件zlib.hzlib.libzconf.h(这3个文件,zlib官方下载编译成的,觉得麻烦向我索要)
//加载Zlib相应的函数以及库#include "zlib.h"#pragma comment(lib,"zlib.lib")
对于已知数组b 以及数组长度Count
//压缩BYTE *com=new BYTE[Count];unsigned long mScompress(com,&mSize,b,Count);
//解压缩unsigned long nSBYTE *target=new BYTE[Count];uncompress(target,&nSize,com,mSize);
//使用完释放指针delete [Count]
阅读(...) 评论()A Massively Spiffy Yet Delicately Unobtrusive Compression Library
(Also Free, Not to Mention Unencumbered by Patents)
(Not Related to the Linux zlibc Compressing File-I/O Library)
Welcome to the zlib home page, web pages originally created by
Greg Roelofs
and maintained by .
If this page seems suspiciously similar to the
, rest assured
that the similarity is completely coincidental.
No, really.
zlib was written by
(compression) and
(decompression).
Current release:
zlib 1.2.11
January 15, 2017
Version 1.2.11 has these key improvements over 1.2.10:
Fix deflate stored bug when pulling last block from window
Permit immediate deflateParams changes before any deflate input
Due to the bug fixes, any installations of 1.2.9 or 1.2.10 should be immediately replaced with 1.2.11.
Version 1.2.10 has these key improvements over 1.2.9:
Fix bug in deflate_stored() for zero-length input
Fix bug in gzwrite.c that produced corrupt gzip files
Version 1.2.9 has these key improvements over 1.2.8:
Improve compress() and uncompress() to support large lengths
Allow building zlib outside of the source directory
Fix bug when level 0 used with Z_HUFFMAN or Z_RLE
Fix bugs in creating a very large gzip header
Add uncompress2() function, which returns the input size used
Dramatically speed up deflation for level 0 (storing)
Add gzfread() and gzfwrite(),
duplicating the interfaces of fread() and fwrite()
Add crc32_z() and adler32_z() functions with size_t lengths
Many portability improvements
You can also look at the complete .
Canonical URL:
zlib is designed to be a ,
general-purpose, legally unencumbered -- that is, not covered by any patents
-- lossless data-compression library for use on virtually any computer hardware
and operating system.
The zlib data format is itself portable across
platforms.
Unlike the LZW compression method used in Unix compress(1)
and in the GIF image format, the compression method currently used in zlib
essentially never expands the data.
(LZW can double or triple the file size in
extreme cases.)
zlib's memory footprint is also independent of the input data
and can be reduced, if necessary, at some cost in compression.
A more precise,
technical discussion of both points is available on .
zlib was written by
(compression) and
(decompression).
Jean-loup is also the primary author of
(1), the author of the
the former maintainer of '
Mark is also the author of gzip's and
decompression routines and was the original author of Zip.
Not surprisingly,
the compression algorithm used in zlib is essentially the same as that in
gzip and Zip, namely, the `deflate' method that originated in
's PKZIP 2.x.
Mark and Jean-loup can be reached by e-mail at
Please read the
before asking
us for help. We are getting too many questions which already have an
answer in the zlib documentation.
The deflate and zlib specifications both achieved official Internet RFC status in May 1996,
and zlib itself was adopted in version 1.1 of the Java Development Kit (JDK), both as a
and as a component of the .
The lovely zlib-vise image above was provided courtesy of Bruce Gardner, art
director of .
appears in Mark Nelson's article in the January 1997 issue (see below).
The current release is publicly available here:
zlib source code, version 1.2.11, tar.gz format (593K,
SHA-256 hash c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca):
zlib source code, version 1.2.11, tar.xz format (457K,
SHA-256 hash 4fface0d4d203e3483be9dbc9daea0a6):
zlib source code, version 1.2.11, zipfile format (730K,
SHA-256 hash d18b7d0cad197a089c0a2cd4d6df05feee738b178d):
Note that zlib is an integral part of
has been tested extensively as part of many
zlib Information
New versions of zlib are announced on this list.
Please do not send questions or comments about zlib to
this mailing list. Send those directly to the authors at
after checking the FAQ and
the manual, of course.
The zlib-devel list is for the development of
zlib&members are contributors to and testers of new versions of zlib.
zlib-related specifications:
infgen.c produces a readable description of a gzip, zlib, or
raw deflate stream.
CRC (Cyclic Redundancy Check) Bonus Information
Code to generate any CRC, with a list of CRC
descriptions. crcany.c can take a description of a CRC and
compute that CRC efficiently.
It includes bit-wise, table-driven
byte-wise, and table-driven word-wise CRC algorithms.
Code to modify a message so that it generates the
desired CRC. spoof.c takes an abbreviated description of
the CRC, the exclusive-or of the current CRC of the message and the
desired CRC, the length of the message, and a list of bit locations in
a message, and tells you which of those bits should be inverted in the
message to get the desired CRC.
Note that it does not need the message
itself, due to the linearity property of CRCs.
ZIP File Processing Bonus Software
Code to read a zip file as a stream and extract
its contents.
sunzip.c will read a zip file from stdin
and extract the files therein that use compression methods 0, 8, 9, or
12 (stored, deflate, deflate64, or bzip2).
It accepts Zip64 input.
Code to merge multiple zip files into a single
zip file. zipknit.c accepts Zip64 input files, and will
create Zip64 output if the combined size of the merged zip file
warrants it. All compression formats are permitted, since no
decompression or recompression is performed.
Encrypted entries are
permitted, and pass through unscathed.
Related External Links
zlib for Linux, both
(RPM format, many
architectures)
(alternate)
zlib for macOS (Mac OS X): zlib is already included as part of macOS
(DLL version, plus related utilities)
(DLL and static version)
zip file manipulation for .NET, and more (including replacements for the
buggy Microsoft GZipStream and DeflateStream classes)
(January 1997)
for the gz* functions.
in an iostream framework.
(C++ source and binaries for use with Visual Basic&4.x or
Delphi&2.0)
(unsupported
also available)
(includes compiled object files and corresponding C++ Builder 5
project files)
( look for Compress-Zlib*.tar.gz)
( part of the standard library as of
Python&1.5)
(see also )
(not tested by us, but looks like a good alternative to
java.util.zip)
(with source code) (December 1997)
's zlib-based
(see also Info-ZIP's ,
which optionally can be compiled with zlib)
's zlib-based
(second edition includes a section on zlib)
Markus Oberhumer's
(not tested by us, but looks like a good alternative if you need
more speed and less compression)
(not tested by us, but looks like an even better alternative if you need
more speed and less compression)
(not tested by us, but appears to be a better alternative to zlib
in both dimensions of compression and speed, as well as
decompression speed)
(not tested by us, but looks like a good alternative if you need
more compression and less speed)
(RFC 1979)
Send comments or questions about zlib to the authors at
after checking
Please report broken links to
This page last updated December 15th, 2017.
Web page copyright ©
Greg Roelofs,
zlib software copyright ©
zlib.org domain name donated by Andrew Green.使用zlib开源库解压时内存崩溃问题解决
最近一个项目中用到了解压缩,打算使用zlib开源库封装quazip在qt中开发,但是在解压缩过程中遇到了内存崩溃现象,错误指向了inflate_fast里面的汇编模块。最后经过分析发现是编译zlibwapi.dll的时候使用汇编模块造成的bug。
解决方法用c编译方式取代汇编方式,在zlib源码的zlibvc工程属性-预处理器定义里面去掉 ASMINF 定义,这样就可以屏蔽掉汇编模块了。
但是只这样还是不行的,编译时会提示inflate_fast重复定义,那是因为在汇编文件里面这个函数已经被定义了,解决方法是打开zlib-1.2.11\contrib\masmx86下面的汇编文件inffas32.asm,将里面_inflate_fast全部替换成其他任意函数名,再次编译ok。
zlib库可以在官网上下载编译,但是下载下来的源码是有上述bug的,大家可以根据我的解决方案修改,也可下载下面我已经修改后并且编译好的版本,还有封装成quazip的源码以及简单的压缩解压缩工程,开发环境是qt5.7。
下载链接 http://download.csdn.net/download/u188996
没有更多推荐了,&>&zlib内存解压代码
zlib内存解压代码
上传大小:11.31MB
解压用zlib压缩的内存数据,完整源码与编译出来的工具
综合评分:2
{%username%}回复{%com_username%}{%time%}\
/*点击出现回复框*/
$(".respond_btn").on("click", function (e) {
$(this).parents(".rightLi").children(".respond_box").show();
e.stopPropagation();
$(".cancel_res").on("click", function (e) {
$(this).parents(".res_b").siblings(".res_area").val("");
$(this).parents(".respond_box").hide();
e.stopPropagation();
/*删除评论*/
$(".del_comment_c").on("click", function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_invalid/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parents(".conLi").remove();
alert(data.msg);
$(".res_btn").click(function (e) {
var parentWrap = $(this).parents(".respond_box"),
q = parentWrap.find(".form1").serializeArray(),
resStr = $.trim(parentWrap.find(".res_area_r").val());
console.log(q);
//var res_area_r = $.trim($(".res_area_r").val());
if (resStr == '') {
$(".res_text").css({color: "red"});
$.post("/index.php/comment/do_comment_reply/", q,
function (data) {
if (data.succ == 1) {
var $target,
evt = e || window.
$target = $(evt.target || evt.srcElement);
var $dd = $target.parents('dd');
var $wrapReply = $dd.find('.respond_box');
console.log($wrapReply);
//var mess = $(".res_area_r").val();
var mess = resS
var str = str.replace(/{%header%}/g, data.header)
.replace(/{%href%}/g, 'http://' + window.location.host + '/user/' + data.username)
.replace(/{%username%}/g, data.username)
.replace(/{%com_username%}/g, data.com_username)
.replace(/{%time%}/g, data.time)
.replace(/{%id%}/g, data.id)
.replace(/{%mess%}/g, mess);
$dd.after(str);
$(".respond_box").hide();
$(".res_area_r").val("");
$(".res_area").val("");
$wrapReply.hide();
alert(data.msg);
}, "json");
/*删除回复*/
$(".rightLi").on("click", '.del_comment_r', function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_comment_del/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parent().parent().parent().parent().parent().remove();
$(e.target).parents('.res_list').remove()
alert(data.msg);
//填充回复
function KeyP(v) {
var parentWrap = $(v).parents(".respond_box");
parentWrap.find(".res_area_r").val($.trim(parentWrap.find(".res_area").val()));
评论共有1条
资料不是很全,可以简单实用。
VIP会员动态
CSDN下载频道资源及相关规则调整公告V11.10
下载频道用户反馈专区
下载频道积分规则调整V1710.18
spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip
资源所需积分/C币
当前拥有积分
当前拥有C币
输入下载码
为了良好体验,不建议使用迅雷下载
zlib内存解压代码
会员到期时间:
剩余下载个数:
剩余积分:0
为了良好体验,不建议使用迅雷下载
积分不足!
资源所需积分/C币
当前拥有积分
您可以选择
程序员的必选
绿色安全资源
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
您的积分不足,将扣除 10 C币
为了良好体验,不建议使用迅雷下载
无法举报自己的资源
你当前的下载分为234。
你还不是VIP会员
开通VIP会员权限,免积分下载
你下载资源过于频繁,请输入验证码
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
若举报审核通过,可返还被扣除的积分
被举报人:
chengfeng0_0
举报的资源分:
请选择类型
资源无法下载 ( 404页面、下载失败、资源本身问题)
资源无法使用 (文件损坏、内容缺失、题文不符)
侵犯版权资源 (侵犯公司或个人版权)
虚假资源 (恶意欺诈、刷分资源)
含色情、危害国家安全内容
含广告、木马病毒资源
*详细原因:
zlib内存解压代码

我要回帖

更多关于 zlib 解压到内存 的文章

 

随机推荐