summaryrefslogtreecommitdiffstats
path: root/plzip.h
diff options
context:
space:
mode:
Diffstat (limited to 'plzip.h')
-rw-r--r--plzip.h39
1 files changed, 22 insertions, 17 deletions
diff --git a/plzip.h b/plzip.h
index 572e814..b12bbbd 100644
--- a/plzip.h
+++ b/plzip.h
@@ -1,6 +1,6 @@
/* Plzip - A parallel compressor compatible with lzip
Copyright (C) 2009 Laszlo Ersek.
- Copyright (C) 2009, 2010 Antonio Diaz Diaz.
+ Copyright (C) 2009, 2010, 2011, 2012 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ class Pretty_print
mutable bool first_post;
public:
- Pretty_print( const std::vector< std::string > & filenames )
+ explicit Pretty_print( const std::vector< std::string > & filenames )
: stdin_name( "(stdin)" ), longest_name( 0 ), first_post( false )
{
const unsigned int stdin_name_len = std::strlen( stdin_name );
@@ -52,13 +52,15 @@ public:
/*--------------------- Defined in compress.cc ---------------------*/
-void xinit( pthread_cond_t * cond, pthread_mutex_t * mutex );
-void xdestroy( pthread_cond_t * cond, pthread_mutex_t * mutex );
-void xlock( pthread_mutex_t * mutex );
-void xunlock( pthread_mutex_t * mutex );
-void xwait( pthread_cond_t * cond, pthread_mutex_t * mutex );
-void xsignal( pthread_cond_t * cond );
-void xbroadcast( pthread_cond_t * cond );
+void xinit( pthread_mutex_t * const mutex );
+void xinit( pthread_cond_t * const cond );
+void xdestroy( pthread_mutex_t * const mutex );
+void xdestroy( pthread_cond_t * const cond );
+void xlock( pthread_mutex_t * const mutex );
+void xunlock( pthread_mutex_t * const mutex );
+void xwait( pthread_cond_t * const cond, pthread_mutex_t * const mutex );
+void xsignal( pthread_cond_t * const cond );
+void xbroadcast( pthread_cond_t * const cond );
class Slot_tally
@@ -72,13 +74,16 @@ private:
pthread_mutex_t mutex;
pthread_cond_t slot_av; // free slot available
+ Slot_tally( const Slot_tally & ); // declared as private
+ void operator=( const Slot_tally & ); // declared as private
+
public:
- Slot_tally( const int slots )
+ explicit Slot_tally( const int slots )
: check_counter( 0 ), wait_counter( 0 ),
num_slots( slots ), num_free( slots )
- { xinit( &slot_av, &mutex ); }
+ { xinit( &mutex ); xinit( &slot_av ); }
- ~Slot_tally() { xdestroy( &slot_av, &mutex ); }
+ ~Slot_tally() { xdestroy( &slot_av ); xdestroy( &mutex ); }
bool all_free() { return ( num_free == num_slots ); }
@@ -103,15 +108,15 @@ public:
int compress( const int data_size, const int dictionary_size,
const int match_len_limit, const int num_workers,
- const int num_slots, const int infd, const int outfd,
+ const int infd, const int outfd,
const Pretty_print & pp, const int debug_level );
/*-------------------- Defined in decompress.cc --------------------*/
-int decompress( const int num_workers, const int num_slots,
- const int infd, const int outfd, const Pretty_print & pp,
- const int debug_level, const bool testing );
+int decompress( const int num_workers, const int infd, const int outfd,
+ const Pretty_print & pp, const int debug_level,
+ const bool testing );
/*----------------------- Defined in main.cc -----------------------*/
@@ -121,6 +126,6 @@ extern int verbosity;
void fatal(); // terminate the program
void show_error( const char * const msg, const int errcode = 0, const bool help = false ) throw();
-void internal_error( const char * const msg );
+void internal_error( const char * const msg ) throw();
int readblock( const int fd, uint8_t * const buf, const int size ) throw();
int writeblock( const int fd, const uint8_t * const buf, const int size ) throw();