author | peter1138 |
Sun, 03 Aug 2008 17:35:08 +0000 | |
changeset 9834 | 7474149531c1 |
parent 9703 | 30117a5205f4 |
permissions | -rw-r--r-- |
9581
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
1 |
/* $Id$ */ |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
2 |
|
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
3 |
#ifndef TAR_TYPE_H |
9591
6b54f7b28d0f
(svn r13631) -Fix (r13618): forgot #define avoiding multiple inclusions
smatz
parents:
9581
diff
changeset
|
4 |
#define TAR_TYPE_H |
9581
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
5 |
|
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
6 |
/** @file tar_type.h Structs, typedefs and macros used for TAR file handling. */ |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
7 |
|
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
8 |
#include <map> |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
9 |
#include <string> |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
10 |
|
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
11 |
/** The define of a TarList. */ |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
12 |
struct TarListEntry { |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
13 |
const char *filename; |
9702
e69c01e76845
(svn r13810) -Fix: small memory leak when tar files would be found.
rubidium
parents:
9591
diff
changeset
|
14 |
|
9703
30117a5205f4
(svn r13814) -Fix (r13810): MSVC (as usual) does stupid things. This time it is copying around a struct it created itself, causing bad things to happen if you don't explicitly set all variables to something remotely sane in the constructor.
rubidium
parents:
9702
diff
changeset
|
15 |
/* MSVC goes copying around this struct after initialisation, so it tries |
30117a5205f4
(svn r13814) -Fix (r13810): MSVC (as usual) does stupid things. This time it is copying around a struct it created itself, causing bad things to happen if you don't explicitly set all variables to something remotely sane in the constructor.
rubidium
parents:
9702
diff
changeset
|
16 |
* to free filename, which isn't set at that moment... but because it |
30117a5205f4
(svn r13814) -Fix (r13810): MSVC (as usual) does stupid things. This time it is copying around a struct it created itself, causing bad things to happen if you don't explicitly set all variables to something remotely sane in the constructor.
rubidium
parents:
9702
diff
changeset
|
17 |
* initializes the variable with garbage, it's going to segfault. */ |
30117a5205f4
(svn r13814) -Fix (r13810): MSVC (as usual) does stupid things. This time it is copying around a struct it created itself, causing bad things to happen if you don't explicitly set all variables to something remotely sane in the constructor.
rubidium
parents:
9702
diff
changeset
|
18 |
TarListEntry() : filename(NULL) {} |
9702
e69c01e76845
(svn r13810) -Fix: small memory leak when tar files would be found.
rubidium
parents:
9591
diff
changeset
|
19 |
~TarListEntry() { free((void*)this->filename); } |
9581
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
20 |
}; |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
21 |
|
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
22 |
struct TarFileListEntry { |
9702
e69c01e76845
(svn r13810) -Fix: small memory leak when tar files would be found.
rubidium
parents:
9591
diff
changeset
|
23 |
const char *tar_filename; |
9581
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
24 |
size_t size; |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
25 |
size_t position; |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
26 |
}; |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
27 |
|
9702
e69c01e76845
(svn r13810) -Fix: small memory leak when tar files would be found.
rubidium
parents:
9591
diff
changeset
|
28 |
typedef std::map<std::string, TarListEntry> TarList; |
9581
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
29 |
typedef std::map<std::string, TarFileListEntry> TarFileList; |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
30 |
extern TarList _tar_list; |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
31 |
extern TarFileList _tar_filelist; |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
32 |
|
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
33 |
#define FOR_ALL_TARS(tar) for (tar = _tar_filelist.begin(); tar != _tar_filelist.end(); tar++) |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
34 |
|
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
35 |
typedef bool FioTarFileListCallback(const char *filename, int size, void *userdata); |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
36 |
FILE *FioTarFileList(const char *tar, const char *mode, size_t *filesize, FioTarFileListCallback *callback, void *userdata); |
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
37 |
|
0d8f232e1721
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz
parents:
diff
changeset
|
38 |
#endif /* TAR_TYPE_H */ |