资源简介
通过json格式传入字符串实现多文件或目录的zip压缩或解压缩。详情阅读readme.txt
代码片段和文件信息
/*
Copyright (c) 2009 Dave Gamble
Permission is hereby granted free of charge to any person obtaining a copy
of this software and associated documentation files (the “Software“) to deal
in the Software without restriction including without limitation the rights
to use copy modify merge publish distribute sublicense and/or sell
copies of the Software and to permit persons to whom the Software is
furnished to do so subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* cJSON */
/* JSON parser in C. */
#include
#include
#include
#include
#include
#include
#include
#include “cJSON.h“
static const char *ep;
const char *cJSON_GetErrorPtr(void) {return ep;}
static int cJSON_strcasecmp(const char *s1const char *s2)
{
if (!s1) return (s1==s2)?0:1;if (!s2) return 1;
for(; tolower(*s1) == tolower(*s2); ++s1 ++s2) if(*s1 == 0) return 0;
return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
}
static void *(*cJSON_malloc)(size_t sz) = malloc;
static void (*cJSON_free)(void *ptr) = free;
static char* cJSON_strdup(const char* str)
{
size_t len;
char* copy;
len = strlen(str) + 1;
if (!(copy = (char*)cJSON_malloc(len))) return 0;
memcpy(copystrlen);
return copy;
}
void cJSON_InitHooks(cJSON_Hooks* hooks)
{
if (!hooks) { /* Reset hooks */
cJSON_malloc = malloc;
cJSON_free = free;
return;
}
cJSON_malloc = (hooks->malloc_fn)?hooks->malloc_fn:malloc;
cJSON_free = (hooks->free_fn)?hooks->free_fn:free;
}
/* Internal constructor. */
static cJSON *cJSON_New_Item(void)
{
cJSON* node = (cJSON*)cJSON_malloc(sizeof(cJSON));
if (node) memset(node0sizeof(cJSON));
return node;
}
/* Delete a cJSON structure. */
void cJSON_Delete(cJSON *c)
{
cJSON *next;
while (c)
{
next=c->next;
if (!(c->type&cJSON_IsReference) && c->child) cJSON_Delete(c->child);
if (!(c->type&cJSON_IsReference) && c->valuestring) cJSON_free(c->valuestring);
if (!(c->type&cJSON_StringIsConst) && c->string) cJSON_free(c->string);
cJSON_free(c);
c=next;
}
}
/* Parse the input text to generate a number and populate the result into item. */
static const char *parse_number(cJSON *itemconst char *num)
{
double n=0sign=1scale=0;int subscale=0signsubscale=1;
if (*num==‘-‘) sign=-1num++; /* Ha
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 19456 2018-04-10 16:10 ZIP_UNZIP.suo
文件 27790 2018-03-21 15:56 ZIP_UNZIP\cJSON.c
文件 7526 2015-02-13 18:53 ZIP_UNZIP\cJSON.h
文件 2054 2018-04-09 17:03 ZIP_UNZIP\ReadMe.txt
文件 392 2018-04-09 17:03 ZIP_UNZIP\Resource.h
文件 214 2018-04-09 17:03 ZIP_UNZIP\stdafx.cpp
文件 818 2018-04-09 17:03 ZIP_UNZIP\stdafx.h
文件 236 2018-04-09 17:03 ZIP_UNZIP\targetver.h
文件 149343 2005-07-28 09:36 ZIP_UNZIP\unzip.cpp
文件 10118 2005-07-28 01:21 ZIP_UNZIP\unzip.h
文件 115697 2005-07-27 18:17 ZIP_UNZIP\zip.cpp
文件 10044 2005-07-28 01:09 ZIP_UNZIP\zip.h
文件 9439 2018-04-10 16:05 ZIP_UNZIP\ZIP_UNZIP.cpp
文件 39 2018-04-09 17:03 ZIP_UNZIP\ZIP_UNZIP.h
文件 2640 2018-04-09 17:03 ZIP_UNZIP\ZIP_UNZIP.rc
文件 4825 2018-04-09 17:13 ZIP_UNZIP\ZIP_UNZIP.vcxproj
文件 2154 2018-04-09 17:11 ZIP_UNZIP\ZIP_UNZIP.vcxproj.filters
文件 143 2018-04-09 17:03 ZIP_UNZIP\ZIP_UNZIP.vcxproj.user
文件 500 2018-04-10 15:45 readme.txt
文件 894 2018-04-09 17:03 ZIP_UNZIP.sln
目录 0 2018-04-10 15:22 ZIP_UNZIP
----------- --------- ---------- ----- ----
364322 21
相关资源
- 颜色识别形状识别STM103嵌入式代码
- 新编Windows API参考大全.doc
- windows hook 框架(detours )
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- windows网络编程_文件传输
- c++ 画图(14Qt-XPS)
- c++多边形交并差运算
- VC++基于OpenGL模拟的一个3维空间模型
- c++ 虚拟摄像头
- hook,捕获所有案件,查找所有窗口,
- C语言课设计算器
- Windows扩展命令程序(源码)
- c++ 简易贪吃蛇源码
- 高精度加法(c++代码)
- C++调用百度地图案例
- LabwindowsCVI 串口编程及事例.docx
- 北京化工大学计算方法(C/C++)讲义
- diy写字机grbl v1.1源代码
- 基于VC++的SolidWorks二次开发SolidWorks
- c++ 模拟鼠标按键
- OFD编辑器
- Beginning C++17 From Novice to Professional
- C++ STL实现
- opencv手部轮廓识别以及轨迹识别
- 百度C++编码规范
- C++ sql2008 WebServer通讯.docx
- c++ 定时关机程序源码
评论
共有 条评论