summaryrefslogtreecommitdiffabout
path: root/src/eyetil.cc
Unidiff
Diffstat (limited to 'src/eyetil.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--src/eyetil.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/eyetil.cc b/src/eyetil.cc
index fba8724..5bceec7 100644
--- a/src/eyetil.cc
+++ b/src/eyetil.cc
@@ -143,31 +143,31 @@ tmpdir_t::~tmpdir_t() {
143 } 143 }
144} 144}
145 145
146std::string tmpdir_t::get_file(const std::string& f) { 146std::string tmpdir_t::get_file(const std::string& f) {
147 std::string::size_type ls = f.rfind('/'); 147 std::string::size_type ls = f.rfind('/');
148 return dir+'/'+( 148 return dir+'/'+(
149 (ls==std::string::npos) 149 (ls==std::string::npos)
150 ? f 150 ? f
151 : f.substr(ls+1) 151 : f.substr(ls+1)
152 ); 152 );
153} 153}
154 154
155tarchive_t::tarchive_t(void *p,size_t s) : a(archive_read_new()), e(0) { 155tarchive_t::tarchive_t(const char *fn) : a(archive_read_new()), e(0) {
156 if(!a) throw std::runtime_error("failed to archive_read_new()"); 156 if(!a) throw std::runtime_error("failed to archive_read_new()");
157 if(archive_read_support_format_tar(a)) { 157 if(archive_read_support_format_tar(a)) {
158 archive_read_finish(a); 158 archive_read_finish(a);
159 throw std::runtime_error("failed to archive_read_support_format_tar()"); 159 throw std::runtime_error("failed to archive_read_support_format_tar()");
160 } 160 }
161 if(archive_read_open_memory(a,p,s)) { 161 if(archive_read_open_filename(a,fn,16384)) {
162 archive_read_finish(a); 162 archive_read_finish(a);
163 throw std::runtime_error("failed to archive_read_open_memory()"); 163 throw std::runtime_error("failed to archive_read_open_memory()");
164 } 164 }
165} 165}
166tarchive_t::~tarchive_t() { 166tarchive_t::~tarchive_t() {
167 assert(a); 167 assert(a);
168 archive_read_finish(a); 168 archive_read_finish(a);
169} 169}
170 170
171bool tarchive_t::read_next_header() { 171bool tarchive_t::read_next_header() {
172 assert(a); 172 assert(a);
173 return archive_read_next_header(a,&e)==ARCHIVE_OK; 173 return archive_read_next_header(a,&e)==ARCHIVE_OK;