forked from greenheartgames/greenworks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCUnzip.h
94 lines (75 loc) · 2.18 KB
/
CUnzip.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
ported from:
miniunz.c
Version 1.1, February 14h, 2010
sample part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
Modifications of Unzip for Zip64
Copyright (C) 2007-2008 Even Rouault
Modifications for Zip64 support on both zip and unzip
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
Porting for Greenworks integration of both zip and unzip by Francesco Abbattista
Copyright (C) 2014 Greenheart Games ( http://greenheartgames.com )
*/
#ifndef UNZIP_H
#define UNZIP_H
#ifndef _WIN32
#ifndef __USE_FILE_OFFSET64
#define __USE_FILE_OFFSET64
#endif
#ifndef __USE_LARGEFILE64
#define __USE_LARGEFILE64
#endif
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#ifndef _FILE_OFFSET_BIT
#define _FILE_OFFSET_BIT 64
#endif
#define off64_t off_t
#define fopen64 fopen
#define fseeko64 fseeko
#define ftello64 ftello
#endif
#include "Includes.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#ifndef USE_FILE32API
#define USE_FILE32API
#endif
#ifdef _WIN32
#include <direct.h>
#include <io.h>
#else
#include <unistd.h>
#include <utime.h>
#include <sys/stat.h>
#endif
#include "minizip/unzip.h"
#define CASESENSITIVITY (0)
#define WRITEBUFFERSIZE (8192)
#define MAXFILENAME (256)
#ifdef _WIN32
#define USEWIN32IOAPI
#include "minizip/iowin32.h"
#endif
using namespace std;
class CUnzip
{
private:
void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date);
int mymkdir(const char* dirname);
int makedir(const char *newdir);
void Display64BitsSize(ZPOS64_T n, int size_char);
int do_list(unzFile uf);
int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password);
int do_extract(unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password);
int do_extract_onefile(unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, const char* password);
public:
int unzip(const char *zipfilename, const char *dirname, const char *password);
};
#endif