summaryrefslogtreecommitdiffstats
path: root/decompress.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 15:37:35 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 15:37:35 +0000
commit06821cd88178d7d9a1fbcb4027a2bf939dd42cd1 (patch)
treed545383354b3edeb26edcba1fd6e52d0e9b68e0d /decompress.cc
parentAdding debian version 1.2~pre1-2. (diff)
downloadplzip-06821cd88178d7d9a1fbcb4027a2bf939dd42cd1.tar.xz
plzip-06821cd88178d7d9a1fbcb4027a2bf939dd42cd1.zip
Merging upstream version 1.2~rc1.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'decompress.cc')
-rw-r--r--decompress.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/decompress.cc b/decompress.cc
index b174bcd..38b3869 100644
--- a/decompress.cc
+++ b/decompress.cc
@@ -50,7 +50,7 @@ int preadblock( const int fd, uint8_t * const buf, const int size,
const int n = pread( fd, buf + size - rest, rest, pos + size - rest );
if( n > 0 ) rest -= n;
else if( n == 0 ) break; // EOF
- else if( errno != EINTR && errno != EAGAIN ) break;
+ else if( errno != EINTR ) break;
errno = 0;
}
return size - rest;
@@ -69,7 +69,7 @@ int pwriteblock( const int fd, const uint8_t * const buf, const int size,
{
const int n = pwrite( fd, buf + size - rest, rest, pos + size - rest );
if( n > 0 ) rest -= n;
- else if( n < 0 && errno != EINTR && errno != EAGAIN ) break;
+ else if( n < 0 && errno != EINTR ) break;
errno = 0;
}
return size - rest;
@@ -122,9 +122,9 @@ extern "C" void * dworker( void * arg )
LZ_Decoder * const decoder = LZ_decompress_open();
if( !ibuffer || !obuffer || !decoder ||
LZ_decompress_errno( decoder ) != LZ_ok )
- { pp( "Not enough memory" ); cleanup_and_fail(); }
+ { pp( "Not enough memory." ); cleanup_and_fail(); }
- for( int i = worker_id; i < file_index.members(); i += num_workers )
+ for( long i = worker_id; i < file_index.members(); i += num_workers )
{
long long data_pos = file_index.dblock( i ).pos();
long long data_rest = file_index.dblock( i ).size();
@@ -144,7 +144,7 @@ extern "C" void * dworker( void * arg )
member_pos += size;
member_rest -= size;
if( LZ_decompress_write( decoder, ibuffer, size ) != size )
- internal_error( "library error (LZ_decompress_write)" );
+ internal_error( "library error (LZ_decompress_write)." );
}
if( member_rest <= 0 ) { LZ_decompress_finish( decoder ); break; }
}
@@ -160,7 +160,7 @@ extern "C" void * dworker( void * arg )
{
pp();
if( verbosity >= 0 )
- std::fprintf( stderr, "Write error in worker %d: %s\n",
+ std::fprintf( stderr, "Write error in worker %d: %s.\n",
worker_id, std::strerror( errno ) );
cleanup_and_fail();
}
@@ -173,7 +173,7 @@ extern "C" void * dworker( void * arg )
if( LZ_decompress_finished( decoder ) == 1 )
{
if( data_rest != 0 )
- internal_error( "final data_rest != 0" );
+ internal_error( "final data_rest is not zero." );
LZ_decompress_reset( decoder ); // prepare for new member
break;
}
@@ -184,9 +184,9 @@ extern "C" void * dworker( void * arg )
delete[] obuffer; delete[] ibuffer;
if( LZ_decompress_member_position( decoder ) != 0 )
- { pp( "Error, some data remains in decoder" ); cleanup_and_fail(); }
+ { pp( "Error, some data remains in decoder." ); cleanup_and_fail(); }
if( LZ_decompress_close( decoder ) < 0 )
- { pp( "LZ_decompress_close failed" ); cleanup_and_fail(); }
+ { pp( "LZ_decompress_close failed." ); cleanup_and_fail(); }
return 0;
}
@@ -224,7 +224,7 @@ int decompress( int num_workers, const int infd, const int outfd,
Worker_arg * worker_args = new( std::nothrow ) Worker_arg[num_workers];
pthread_t * worker_threads = new( std::nothrow ) pthread_t[num_workers];
if( !worker_args || !worker_threads )
- { pp( "Not enough memory" ); cleanup_and_fail(); }
+ { pp( "Not enough memory." ); cleanup_and_fail(); }
for( int i = 0; i < num_workers; ++i )
{
worker_args[i].file_index = &file_index;