summaryrefslogtreecommitdiffstats
path: root/main.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 /main.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 '')
-rw-r--r--main.cc27
1 files changed, 13 insertions, 14 deletions
diff --git a/main.cc b/main.cc
index 598731b..1cf940c 100644
--- a/main.cc
+++ b/main.cc
@@ -143,7 +143,7 @@ void show_help( const long num_online )
void show_version()
{
- std::printf( "%s %s\n", Program_name, PROGVERSION );
+ std::printf( "%s %s\n", program_name, PROGVERSION );
std::printf( "Copyright (C) 2009 Laszlo Ersek.\n"
"Copyright (C) %s Antonio Diaz Diaz.\n", program_year );
std::printf( "Using Lzlib %s\n", LZ_version() );
@@ -245,8 +245,7 @@ int open_instream( const char * const name, struct stat * const in_statsp,
}
else
{
- do infd = open( name, O_RDONLY | O_BINARY );
- while( infd < 0 && errno == EINTR );
+ infd = open( name, O_RDONLY | O_BINARY );
if( infd < 0 )
{
if( verbosity >= 0 )
@@ -308,8 +307,7 @@ bool open_outstream( const bool force )
int flags = O_CREAT | O_WRONLY | O_BINARY;
if( force ) flags |= O_TRUNC; else flags |= O_EXCL;
- do outfd = open( output_filename.c_str(), flags, outfd_mode );
- while( outfd < 0 && errno == EINTR );
+ outfd = open( output_filename.c_str(), flags, outfd_mode );
if( outfd < 0 && verbosity >= 0 )
{
if( errno == EEXIST )
@@ -402,7 +400,7 @@ void Pretty_print::operator()( const char * const msg ) const
std::fprintf( stderr, " " );
if( !msg ) std::fflush( stderr );
}
- if( msg ) std::fprintf( stderr, "%s.\n", msg );
+ if( msg ) std::fprintf( stderr, "%s\n", msg );
}
}
@@ -415,7 +413,7 @@ void show_error( const char * const msg, const int errcode, const bool help )
{
std::fprintf( stderr, "%s: %s", program_name, msg );
if( errcode > 0 )
- std::fprintf( stderr, ": %s", std::strerror( errcode ) );
+ std::fprintf( stderr, ": %s.", std::strerror( errcode ) );
std::fprintf( stderr, "\n" );
}
if( help )
@@ -428,7 +426,7 @@ void show_error( const char * const msg, const int errcode, const bool help )
void internal_error( const char * const msg )
{
if( verbosity >= 0 )
- std::fprintf( stderr, "%s: internal error: %s.\n", program_name, msg );
+ std::fprintf( stderr, "%s: internal error: %s\n", program_name, msg );
std::exit( 3 );
}
@@ -467,7 +465,7 @@ void show_progress( const int packet_size,
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
if( p ) // initialize static vars
- { csize = cfile_size; pos = 0; pp = p; return; }
+ { csize = cfile_size; pos = 0; pp = p; }
if( pp )
{
xlock( &mutex );
@@ -513,7 +511,7 @@ int main( const int argc, const char * const argv[] )
invocation_name = argv[0];
if( LZ_version()[0] != LZ_version_string[0] )
- internal_error( "bad library version" );
+ internal_error( "bad library version." );
const long num_online = std::max( 1L, sysconf( _SC_NPROCESSORS_ONLN ) );
long max_workers = sysconf( _SC_THREAD_THREADS_MAX );
@@ -589,7 +587,7 @@ int main( const int argc, const char * const argv[] )
case 't': program_mode = m_test; break;
case 'v': if( verbosity < 4 ) ++verbosity; break;
case 'V': show_version(); return 0;
- default : internal_error( "uncaught option" );
+ default : internal_error( "uncaught option." );
}
} // end process options
@@ -604,7 +602,8 @@ int main( const int argc, const char * const argv[] )
if( data_size <= 0 )
data_size = 2 * std::max( 65536, encoder_options.dictionary_size );
else if( data_size < encoder_options.dictionary_size )
- encoder_options.dictionary_size = std::max( data_size, LZ_min_dictionary_size() );
+ encoder_options.dictionary_size =
+ std::max( data_size, LZ_min_dictionary_size() );
if( num_workers <= 0 )
num_workers = std::min( num_online, max_workers );
@@ -629,13 +628,13 @@ int main( const int argc, const char * const argv[] )
struct stat in_stats;
output_filename.clear();
- if( !filenames[i].size() || filenames[i] == "-" )
+ if( filenames[i].empty() || filenames[i] == "-" )
{
input_filename.clear();
infd = STDIN_FILENO;
if( program_mode != m_test )
{
- if( to_stdout || !default_output_filename.size() )
+ if( to_stdout || default_output_filename.empty() )
outfd = STDOUT_FILENO;
else
{