summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/Handle.h2
-rw-r--r--includes/Input.h1
-rw-r--r--includes/Output.h3
-rw-r--r--includes/String.h4
-rw-r--r--includes/cdutils.h62
-rw-r--r--includes/generic.h23
-rw-r--r--includes/lzss.h5
7 files changed, 53 insertions, 47 deletions
diff --git a/includes/Handle.h b/includes/Handle.h
index 3836f3e..368ec40 100644
--- a/includes/Handle.h
+++ b/includes/Handle.h
@@ -25,7 +25,7 @@ class Handle : public Base {
virtual bool CanRead();
virtual bool CanWrite();
virtual bool CanSeek();
- virtual off_t seek(off_t, int) throw (GeneralException);
+ virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException);
virtual off_t tell();
virtual String GetName();
virtual ssize_t GetSize();
diff --git a/includes/Input.h b/includes/Input.h
index 8741ebc..8e3e84e 100644
--- a/includes/Input.h
+++ b/includes/Input.h
@@ -16,7 +16,6 @@ class Input : public Handle {
virtual bool CanRead();
virtual bool CanSeek();
virtual off_t seek(off_t, int) throw (GeneralException);
- virtual off_t tell();
virtual String GetName();
virtual ssize_t GetSize();
virtual time_t GetModif();
diff --git a/includes/Output.h b/includes/Output.h
index b7c8fb8..bce4160 100644
--- a/includes/Output.h
+++ b/includes/Output.h
@@ -9,14 +9,13 @@
class Output : public Handle {
public:
- Output(String = "", int trunc = 1) throw (GeneralException);
+ Output(String = "", int create = 1, int trunc = 1) throw (GeneralException);
Output(const Output &);
virtual ~Output() {}
virtual bool CanWrite();
virtual bool CanRead();
virtual bool CanSeek();
virtual off_t seek(off_t, int) throw (GeneralException);
- virtual off_t tell();
virtual String GetName();
protected:
diff --git a/includes/String.h b/includes/String.h
index 1fd6183..7b5fdc4 100644
--- a/includes/String.h
+++ b/includes/String.h
@@ -9,7 +9,7 @@
class String : public Base {
public:
String(const String &);
- String(const char * = "");
+ String(const char * = "", ...);
String(char);
String(int);
String(unsigned int);
@@ -61,6 +61,8 @@ class String : public Base {
std::ostream & operator<<(std::ostream &, const String &);
std::istream & operator>>(std::istream &, String &);
+String operator+(const char *, const String &);
+
#else
#error This only works with a C++ compiler
#endif
diff --git a/includes/cdutils.h b/includes/cdutils.h
index 3dcf7ac..fa44ca6 100644
--- a/includes/cdutils.h
+++ b/includes/cdutils.h
@@ -23,6 +23,8 @@
#include "yazedc.h"
#include "generic.h"
+#include "Handle.h"
+
#define GUESS 5
struct DirEntry {
@@ -40,8 +42,8 @@ struct DirEntry {
unsigned char Second;
unsigned char Offset;
unsigned char Flags;
- unsigned char FileUnit;
- unsigned char FileGap;
+ unsigned char HandleUnit;
+ unsigned char HandleGap;
unsigned short VolSeq;
unsigned short BEVolSeq;
unsigned char N;
@@ -52,48 +54,30 @@ extern struct DirEntry rootDir;
extern long sec_sizes[];
extern long sec_offsts[];
-extern char * sec_modes[];
+extern String sec_modes[];
-FILE * open_ppf(char * ppf, FILE * iso, char * comment);
-FILE * open_ppf(char * ppf, int iso, char * comment);
+Handle * open_ppf(String ppf, Handle * iso, char * comment);
unsigned short int swap_word(unsigned short int i);
unsigned long int swap_dword(unsigned long int i);
-int guess_type(FILE * f_iso, int number);
-int guess_type(int f_iso, int number);
-void sector_seek(FILE * f_iso, long sector);
-void sector_seek(int f_iso, long sector);
-long read_sector(FILE * f_iso, unsigned char * buffer, char type, int number = -1);
-long read_sector(int f_iso, unsigned char * buffer, char type, int number = -1);
-void read_datas(FILE * f_iso, unsigned char * buffer, int type, int number, long size);
-void read_datas(int f_iso, unsigned char * buffer, int type, int number, long size);
-void read_file(FILE * f_iso, FILE * file, char type, int number, long size);
-void read_file(int f_iso, int file, char type, int number, long size);
-void write_sector(FILE * f_iso_r, FILE * f_iso_w, unsigned char * buffer, char type, int number = -1);
-void write_sector(int f_iso_r, int f_iso_w, unsigned char * buffer, char type, int number = -1);
-void write_datas(FILE * f_iso_r, FILE * f_iso_w, unsigned char * buffer, char type, int number, long size);
-void write_datas(int f_iso_r, int f_iso_w, unsigned char * buffer, char type, int number, long size);
-void write_file(FILE * f_iso_r, FILE * f_iso_w, FILE * file, char type, int number = -1);
-void write_file(int f_iso_r, int f_iso_w, int file, char type, int number = -1);
-int get_iso_infos(FILE * h);
-int get_iso_infos(int h);
-int show_iso_infos(FILE * h);
-int show_iso_infos(int h);
-int get_pt_infos(FILE * h);
-int get_pt_infos(int h);
-int show_pt_infos(FILE * h);
-int show_pt_infos(int h);
-struct DirEntry find_path(FILE * h, char * path);
-struct DirEntry find_path(int h, char * path);
-struct DirEntry find_parent(FILE * h, char * path);
-struct DirEntry find_parent(int h, char * path);
+int guess_type(Handle * f_iso, int number);
+void sector_seek(Handle * f_iso, long sector);
+long read_sector(Handle * f_iso, Byte * buffer, int type, int number = -1);
+void read_datas(Handle * f_iso, Byte * buffer, int type, int number, long size);
+void read_Handle(Handle * f_iso, Handle * Handle, int type, int number, long size);
+void write_sector(Handle * f_iso_r, Handle * f_iso_w, Byte * buffer, int type, int number = -1);
+void write_datas(Handle * f_iso_r, Handle * f_iso_w, Byte * buffer, int type, int number, long size);
+void write_file(Handle * f_iso_r, Handle * f_iso_w, Handle * Handle, int type, int number = -1);
+int get_iso_infos(Handle * h);
+int show_iso_infos(Handle * h);
+int get_pt_infos(Handle * h);
+int show_pt_infos(Handle * h);
+struct DirEntry find_path(Handle * h, String path);
+struct DirEntry find_parent(Handle * h, String path);
void show_head_entry(void);
int show_entry(struct DirEntry * dir);
-int show_dir(FILE * h, struct DirEntry * dir);
-int show_dir(int h, struct DirEntry * dir);
-struct DirEntry find_dir_entry(FILE * h, struct DirEntry * dir, char * name);
-struct DirEntry find_dir_entry(int h, struct DirEntry * dir, char * name);
-struct DirEntry * find_dir_entry(FILE * h, unsigned char ** buffer, struct DirEntry * dir, char * name);
-struct DirEntry * find_dir_entry(int h, unsigned char ** buffer, struct DirEntry * dir, char * name);
+int show_dir(Handle * h, struct DirEntry * dir);
+struct DirEntry find_dir_entry(Handle * h, struct DirEntry * dir, String name);
+struct DirEntry * find_dir_entry(Handle * h, Byte ** buffer, struct DirEntry * dir, String name);
unsigned char from_BCD(unsigned char x);
unsigned char to_BCD(unsigned char x);
int is_valid_BCD(unsigned char x);
diff --git a/includes/generic.h b/includes/generic.h
index 5abb92b..41f3a5f 100644
--- a/includes/generic.h
+++ b/includes/generic.h
@@ -74,9 +74,28 @@ typedef Uint32 DWord;
#endif
extern char verbosity;
-void printm(int level, char * fmt, ...);
char ** split(char * s, char t);
+#ifdef __cplusplus
+class String;
+void printm(int level, String fmt, ...);
+#include "String.h"
+
+#ifndef MAX
+template<class T>
+inline T MAX(T a, T b) {
+ return a < b ? b : a;
+}
+#endif
+
+#ifndef MIN
+template<class T>
+inline T MIN(T a, T b) {
+ return a > b ? b : a;
+}
+#endif
+
+#else
#ifndef MAX
#define MAX(__a,__b) ((__a)<(__b)?(__b):(__a))
#endif
@@ -86,3 +105,5 @@ char ** split(char * s, char t);
#endif
#endif
+
+#endif
diff --git a/includes/lzss.h b/includes/lzss.h
index 127a494..5bfa68a 100644
--- a/includes/lzss.h
+++ b/includes/lzss.h
@@ -22,6 +22,7 @@
#include <stdio.h>
#include "generic.h"
+#include "Handle.h"
#define LZSS_VERSION "3.0.0-pre1"
#define LZSS_NAME "lzss"
@@ -55,8 +56,8 @@ extern scheme_t scheme, schemes[];
extern int tolerate, blockb;
extern long blk, bitmap_count;
-unsigned long lzss_decomp(FILE * f_source, FILE * f_cible, long true_length = -1);
-void lzss_comp(FILE * f_source, FILE * f_cible, long * delta = NULL);
+unsigned long lzss_decomp(Handle * f_source, Handle * f_cible, long true_length = -1);
+void lzss_comp(Handle * f_source, Handle * f_cible, long * delta = NULL);
char swap_bits(char);