From 3d55933aba1935c6b4c6fc93fe0dde6e359ead63 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 11 Jan 2010 21:10:57 +0100 Subject: Fixing gcc / linux compilation --- contrib/paq.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'contrib/paq.cpp') diff --git a/contrib/paq.cpp b/contrib/paq.cpp index 433e2bb..3e820a0 100644 --- a/contrib/paq.cpp +++ b/contrib/paq.cpp @@ -14,7 +14,7 @@ #ifdef _WIN32 #define DIR_SEPARATOR "\\" #else - #define DIR_SEPARTOR "/" + #define DIR_SEPARATOR "/" #endif using namespace std; @@ -26,7 +26,8 @@ private: public: my_exception(const string& cause) : cause(cause) { } - virtual const char* what() const { return cause.c_str(); } + ~my_exception() throw () { } + virtual const char* what() const throw() { return cause.c_str(); } }; struct index_entry @@ -52,7 +53,7 @@ private: unsigned int fname_size = static_cast(v[i++]); if (fname_size) { - if (i + fname_size + 6 > v.size()) throw exception("Unexpected end of PAQ file"); + if (i + fname_size + 6 > v.size()) throw my_exception("Unexpected end of PAQ file"); index.push_back(index_entry(string(&v[i], &v[i + fname_size]), v[i + fname_size + 4])); if (index.back().is_dir) ++depth; @@ -70,7 +71,7 @@ private: files.assign(v.begin() + i, v.end()); for(list::iterator i_it = index.begin(); i_it != index.end(); i_it++) i += i_it->file_size; - if (i < v.size()) throw exception("Unexpected end of PAQ file"); + if (i < v.size()) throw my_exception("Unexpected end of PAQ file"); } void extract_r(string path, list::iterator& i_it, vector::iterator& f_it) @@ -119,14 +120,14 @@ public: paq.read(&v[0], file_size); paq.close(); - if (*reinterpret_cast(&v[0]) != 0x5141504E) throw exception("No valid signature found in PAQ file"); + if (*reinterpret_cast(&v[0]) != 0x5141504E) throw my_exception("No valid signature found in PAQ file"); process(v); } - void extract_to(const char* path) { extract_r(string(path), index.begin(), files.begin()); } + void extract_to(const char* path) { list::iterator ib = index.begin(); vector::iterator fb = files.begin(); extract_r(string(path), ib, fb); } - void print_index() { print_r(string(), index.begin()); } + void print_index() { list::iterator b = index.begin(); print_r(string(), b); } }; class paq_builder @@ -226,7 +227,7 @@ void process_command_line(int argc, char** argv) return; } - throw exception("Syntax error in the command line, use --help option for any help"); + throw my_exception("Syntax error in the command line, use --help option for any help"); } int main(int argc, char** argv) -- cgit v1.2.3