summaryrefslogtreecommitdiffstats
path: root/file_index.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 15:35:17 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 15:35:17 +0000
commit54eb7a34be819b408b6751cdea2e0efe8f54ad2d (patch)
tree4ab337444e4b984fd7efe3a7c6ee4453797f84a6 /file_index.cc
parentAdding upstream version 1.0. (diff)
downloadplzip-54eb7a34be819b408b6751cdea2e0efe8f54ad2d.tar.xz
plzip-54eb7a34be819b408b6751cdea2e0efe8f54ad2d.zip
Adding upstream version 1.1~pre1.upstream/1.1_pre1
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'file_index.cc')
-rw-r--r--file_index.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/file_index.cc b/file_index.cc
index 5cdba46..452d0ab 100644
--- a/file_index.cc
+++ b/file_index.cc
@@ -1,4 +1,4 @@
-/* Plzip - A parallel compressor compatible with lzip
+/* Plzip - Parallel compressor compatible with lzip
Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify
@@ -68,23 +68,23 @@ File_index::File_index( const int infd ) : retval_( 0 )
{ error_ = "Input file is not seekable :";
error_ += std::strerror( errno ); retval_ = 1; return; }
if( isize > INT64_MAX )
- { error_ = "Input file is too long (2^63 bytes or more).";
+ { error_ = "Input file is too long (2^63 bytes or more)";
retval_ = 2; return; }
long long pos = isize; // always points to a header or EOF
File_header header;
File_trailer trailer;
if( isize < min_member_size )
- { error_ = "Input file is too short."; retval_ = 2; return; }
+ { error_ = "Input file is too short"; retval_ = 2; return; }
if( seek_read( infd, header.data, File_header::size, 0 ) != File_header::size )
{ error_ = "Error reading member header :";
error_ += std::strerror( errno ); retval_ = 1; return; }
if( !header.verify_magic() )
- { error_ = "Bad magic number (file not in lzip format).";
+ { error_ = "Bad magic number (file not in lzip format)";
retval_ = 2; return; }
if( !header.verify_version() )
{ error_ = "Version "; error_ += format_num( header.version() );
- error_ += "member format not supported."; retval_ = 2; return; }
+ error_ += "member format not supported"; retval_ = 2; return; }
while( pos >= min_member_size )
{
@@ -114,9 +114,9 @@ File_index::File_index( const int infd ) : retval_( 0 )
if( member_vector.size() == 0 && isize - pos > File_header::size &&
seek_read( infd, header.data, File_header::size, pos ) == File_header::size &&
header.verify_magic() && header.verify_version() )
- { // last trailer is corrupt
- error_ = "Member size in trailer is corrupt at pos ";
- error_ += format_num( isize - 8 ); retval_ = 2; break;
+ {
+ error_ = "Last member in input file is truncated or corrupt";
+ retval_ = 2; break;
}
pos -= member_size;
member_vector.push_back( Member( 0, trailer.data_size(),
@@ -125,7 +125,7 @@ File_index::File_index( const int infd ) : retval_( 0 )
if( pos != 0 || member_vector.size() == 0 )
{
member_vector.clear();
- if( retval_ == 0 ) { error_ = "Can't create file index."; retval_ = 2; }
+ if( retval_ == 0 ) { error_ = "Can't create file index"; retval_ = 2; }
return;
}
std::reverse( member_vector.begin(), member_vector.end() );
@@ -135,7 +135,7 @@ File_index::File_index( const int infd ) : retval_( 0 )
if( end < 0 || end > INT64_MAX )
{
member_vector.clear();
- error_ = "Data in input file is too long (2^63 bytes or more).";
+ error_ = "Data in input file is too long (2^63 bytes or more)";
retval_ = 2; return;
}
member_vector[i+1].dblock.pos( end );