Mercurial > otakunoraifu
annotate system/file_impl.h @ 50:35ce1a30f3f9
* Added va_end where there is a va_start
* Used NULL instead of 0 (so it works on 64b)
author | thib |
---|---|
date | Fri, 17 Apr 2009 18:38:06 +0000 |
parents | 5f548e5957a8 |
children | 15a18fbe6f21 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (c) 2004 Kazunori "jagarl" Ueno | |
3 * All rights reserved. | |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions | |
7 * are met: | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright | |
11 * notice, this list of conditions and the following disclaimer in the | |
12 * documentation and/or other materials provided with the distribution. | |
13 * 3. The name of the author may not be used to endorse or promote products | |
14 * derived from this software without specific prior written permission. | |
15 * | |
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 */ | |
27 | |
28 | |
29 | |
30 #ifndef __FILE_IMPL_H__ | |
31 #define __FILE_IMPL_H__ | |
32 | |
33 #include<vector> | |
34 | |
35 struct ARCFILE_ATOM { | |
36 char* filename; | |
37 char* filename_lower; | |
38 off_t offset; | |
39 int arcsize; | |
40 int filesize; | |
41 int private_data; | |
42 bool operator <(const ARCFILE_ATOM& to) const { | |
43 return strcmp(filename_lower, to.filename_lower) < 0; | |
44 } | |
45 bool operator <(char* const to) const { | |
46 return strcmp(filename_lower, to) < 0; | |
47 } | |
48 }; | |
49 | |
50 class ARCFILE { | |
51 protected: | |
52 char* arcname; | |
53 char* filenames_orig; | |
54 int list_point; | |
55 std::vector<ARCFILE_ATOM> arc_atom; | |
56 typedef std::vector<ARCFILE_ATOM>::iterator iterator; | |
57 ARCFILE* next; /* FILESEARCH ¤Î°ì¤Ä¤Î·¿¤¬Ê£¿ô¤Î ARCFILE ¤ò»ý¤Ä¤È¤¡¢¥ê¥¹¥È¤ò¤Ä¤¯¤ë */ | |
58 /* arcname ¤Ë»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¡¿¥Ç¥£¥ì¥¯¥È¥ê¤ÎÆâÍÆ¥Á¥§¥Ã¥¯ */ | |
59 virtual int CheckFileDeal(void); | |
60 virtual void ListupFiles(int fname_len); | |
61 virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM&); | |
62 iterator SearchName(const char* f, const char* ext=0); | |
63 public: | |
47
5f548e5957a8
* get rid of the "deprecated conversion from string constant to ‘char*’" warnings
thib
parents:
0
diff
changeset
|
64 ARCFILE(const char* fname); |
50 | 65 void SetNext(ARCFILE* _next) { delete next; next = _next;} |
0 | 66 ARCFILE* Next(void) { return next; } |
67 void Init(void); | |
68 virtual ~ARCFILE(); | |
69 /* ¥Õ¥¡¥¤¥ë¸¡º÷ */ | |
70 class ARCINFO* Find(const char* fname, const char* ext); | |
71 /* ¥Õ¥¡¥¤¥ë¥ê¥¹¥È¤Î½ÐÎÏ */ | |
72 int Deal(void) { Init(); return arc_atom.size(); } | |
73 void ListFiles(FILE* out); | |
74 void InitList(void); | |
75 char* ListItem(void); | |
76 }; | |
77 | |
78 class SCN2kFILE : public ARCFILE { | |
79 protected: | |
80 virtual int CheckFileDeal(void); | |
81 virtual void ListupFiles(int fname_len); | |
82 virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom); | |
83 public: | |
84 SCN2kFILE(char* fname) : ARCFILE(fname) {} | |
85 virtual ~SCN2kFILE() {} | |
86 }; | |
87 | |
88 class CattleyaFILE : public ARCFILE { | |
89 bool is_compress; | |
90 /* header ¤Î Huffman ÌÚ¹½ÃÛÍÑ */ | |
91 char* bitbuf; | |
92 char* bitbuf_end; | |
93 int ltree[0x400]; | |
94 int rtree[0x400]; | |
95 int treecnt; | |
96 int bitcnt; | |
97 int GetBit(void); | |
98 int GetCh(void); | |
99 void SetBuf(char* buf, int len); | |
100 int MakeTree(void); | |
101 int Decode(int seed); | |
102 | |
103 protected: | |
104 virtual int CheckFileDeal(void); | |
105 virtual void ListupFiles(int fname_len); | |
106 virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom); | |
107 public: | |
108 CattleyaFILE(char* fname) : ARCFILE(fname) {is_compress = false;} | |
109 virtual ~CattleyaFILE() {} | |
110 }; | |
111 | |
112 class NULFILE : public ARCFILE { | |
113 protected: | |
114 virtual int CheckFileDeal(void); | |
115 virtual void ListupFiles(int fname_len); | |
116 virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom); | |
117 public: | |
118 NULFILE() : ARCFILE("") {} | |
119 virtual ~NULFILE() {} | |
120 }; | |
121 class DIRFILE : public ARCFILE { | |
122 protected: | |
123 virtual int CheckFileDeal(void); | |
124 virtual void ListupFiles(int fname_len); | |
125 virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom); | |
126 public: | |
127 DIRFILE(char* fname) : ARCFILE(fname) {} | |
128 virtual ~DIRFILE() {} | |
129 FILE* Open(const char* fname); /* FILE* ¤ò³«¤¯ */ | |
130 char* SearchFile(const char* dirname); /* ¥Õ¥¡¥¤¥ë¸¡º÷ */ | |
131 }; | |
132 class ARCINFO_AVG32 : public ARCINFO { | |
133 ARCINFO_AVG32(const char* name, ARCFILE_ATOM& atom) : ARCINFO(name, atom) { | |
134 } | |
135 virtual bool ExecExtract(void); | |
136 friend class ARCFILE; | |
137 }; | |
138 class ARCINFO2k : public ARCINFO { | |
139 static char decode_seed[256]; | |
140 static char decode_seed2[16]; | |
141 protected: | |
142 ARCINFO2k(const char* name, ARCFILE_ATOM& atom) : ARCINFO(name,atom) { | |
143 } | |
144 virtual bool ExecExtract(void); | |
145 friend class SCN2kFILE; | |
146 }; | |
147 | |
148 class ARCINFOZ : public ARCINFO { | |
149 protected: | |
150 ARCINFOZ(const char* name, ARCFILE_ATOM& atom) : ARCINFO(name, atom) { | |
151 } | |
152 virtual bool ExecExtract(void); | |
153 friend class DaemonBaneFILE; | |
154 friend class CattleyaFILE; | |
155 }; | |
156 | |
157 #endif /* __FILE_IMPL_H__ */ |