summaryrefslogtreecommitdiff
path: root/contrib/paq.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/paq.cpp')
-rw-r--r--contrib/paq.cpp17
1 files changed, 9 insertions, 8 deletions
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<unsigned char>(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<index_entry>::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<index_entry>::iterator& i_it, vector<char>::iterator& f_it)
@@ -119,14 +120,14 @@ public:
paq.read(&v[0], file_size);
paq.close();
- if (*reinterpret_cast<unsigned int*>(&v[0]) != 0x5141504E) throw exception("No valid signature found in PAQ file");
+ if (*reinterpret_cast<unsigned int*>(&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<index_entry>::iterator ib = index.begin(); vector<char>::iterator fb = files.begin(); extract_r(string(path), ib, fb); }
- void print_index() { print_r(string(), index.begin()); }
+ void print_index() { list<index_entry>::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)