From 17de8a048854f9272bf932214ae6e4b3d7bfba4f Mon Sep 17 00:00:00 2001 From: stan Date: Mon, 7 Apr 2003 11:16:34 +0000 Subject: [PATCH] Corrected warnings. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@451 e3e1d417-86f3-4887-817a-d78f3d33393f --- src/zm_debug.c | 9 +++------ src/zm_monitor.cpp | 6 +++--- src/zm_monitor.h | 6 +++--- src/zma.cpp | 3 --- src/zms.cpp | 2 +- src/zmu.cpp | 10 ++++------ 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/zm_debug.c b/src/zm_debug.c index de1647ae3..f04b9442f 100644 --- a/src/zm_debug.c +++ b/src/zm_debug.c @@ -143,8 +143,6 @@ int zmGetDebugEnv( const char * const command ) int zmDebugInitialise() { - char *prev_file = (char*)NULL; - FILE *tmp_fp; int status; @@ -197,12 +195,12 @@ int zmDebugInitialise() if ( sigaction( SIGUSR1, &action, &old_action ) < 0 ) { - Error(("%s(), error = %s",sigaction,strerror(errno))); + Error(("sigaction(), error = %s",strerror(errno))); return(ZM_DBG_ERROR); } if ( sigaction( SIGUSR2, &action, &old_action ) < 0) { - Error(("%s(), error = %s",sigaction,strerror(errno))); + Error(("sigaction(), error = %s",strerror(errno))); return(ZM_DBG_ERROR); } } @@ -290,7 +288,6 @@ int zmDbgOutput( const char *fstring, ... ) int log_code; struct timeval tp; struct timezone tzp; - static int count = 0; zm_temp_dbg_string[0] = '\0'; va_start(arg_ptr,fstring); @@ -302,7 +299,7 @@ int zmDbgOutput( const char *fstring, ... ) { zmDbgSubtractTime( &tp, &zm_dbg_start ); - sprintf( time_string, "%d.%03ld", tp.tv_sec, tp.tv_usec/1000 ); + sprintf( time_string, "%ld.%03ld", tp.tv_sec, tp.tv_usec/1000 ); } else { diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 0f6d23577..b03f29708 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -26,7 +26,7 @@ #include "zm_local_camera.h" #include "zm_remote_camera.h" -Monitor::Monitor( int p_id, char *p_name, int p_function, int p_device, int p_channel, int p_format, int p_width, int p_height, int p_colours, bool p_capture, char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, int p_n_zones, Zone *p_zones[] ) : id( p_id ), function( (Function)p_function ), image( p_width, p_height, p_colours ), ref_image( p_width, p_height, p_colours ), label_coord( p_label_coord ), image_buffer_count( p_image_buffer_count ), warmup_count( p_warmup_count ), pre_event_count( p_pre_event_count ), post_event_count( p_post_event_count ), capture_delay( p_capture_delay ), fps_report_interval( p_fps_report_interval ), ref_blend_perc( p_ref_blend_perc ), n_zones( p_n_zones ), zones( p_zones ) +Monitor::Monitor( int p_id, char *p_name, int p_function, int p_device, int p_channel, int p_format, int p_width, int p_height, int p_colours, bool p_capture, char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, int p_n_zones, Zone *p_zones[] ) : id( p_id ), function( (Function)p_function ), label_coord( p_label_coord ), image_buffer_count( p_image_buffer_count ), warmup_count( p_warmup_count ), pre_event_count( p_pre_event_count ), post_event_count( p_post_event_count ), capture_delay( p_capture_delay ), fps_report_interval( p_fps_report_interval ), ref_blend_perc( p_ref_blend_perc ), image( p_width, p_height, p_colours ), ref_image( p_width, p_height, p_colours ), n_zones( p_n_zones ), zones( p_zones ) { name = new char[strlen(p_name)+1]; strcpy( name, p_name ); @@ -131,7 +131,7 @@ Monitor::Monitor( int p_id, char *p_name, int p_function, int p_device, int p_ch record_event_stats = ZM_RECORD_EVENT_STATS; } -Monitor::Monitor( int p_id, char *p_name, int p_function, const char *p_host, const char *p_port, const char *p_path, int p_width, int p_height, int p_colours, bool p_capture, char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, int p_n_zones, Zone *p_zones[] ) : id( p_id ), function( (Function)p_function ), image( p_width, p_height, p_colours ), ref_image( p_width, p_height, p_colours ), label_coord( p_label_coord ), image_buffer_count( p_image_buffer_count ), warmup_count( p_warmup_count ), pre_event_count( p_pre_event_count ), post_event_count( p_post_event_count ), capture_delay( p_capture_delay ), fps_report_interval( p_fps_report_interval ), ref_blend_perc( p_ref_blend_perc ), n_zones( p_n_zones ), zones( p_zones ) +Monitor::Monitor( int p_id, char *p_name, int p_function, const char *p_host, const char *p_port, const char *p_path, int p_width, int p_height, int p_colours, bool p_capture, char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, int p_n_zones, Zone *p_zones[] ) : id( p_id ), function( (Function)p_function ), label_coord( p_label_coord ), image_buffer_count( p_image_buffer_count ), warmup_count( p_warmup_count ), pre_event_count( p_pre_event_count ), post_event_count( p_post_event_count ), capture_delay( p_capture_delay ), fps_report_interval( p_fps_report_interval ), ref_blend_perc( p_ref_blend_perc ), image( p_width, p_height, p_colours ), ref_image( p_width, p_height, p_colours ), n_zones( p_n_zones ), zones( p_zones ) { name = new char[strlen(p_name)+1]; strcpy( name, p_name ); @@ -665,7 +665,7 @@ Monitor *Monitor::Load( int id, bool load_zones ) return( monitor ); } -void Monitor::StreamImages( unsigned long idle, unsigned long refresh, FILE *fd, unsigned int ttl ) +void Monitor::StreamImages( unsigned long idle, unsigned long refresh, FILE *fd, time_t ttl ) { time_t start_time, now; diff --git a/src/zm_monitor.h b/src/zm_monitor.h index 0d315018e..4f6dd3718 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -50,17 +50,17 @@ protected: // These are read from the DB and thereafter remain unchanged int id; char *name; + Function function; char label_format[64]; // The format of the timestamp on the images Coord label_coord; // The coordinates of the timestamp on the images + int image_buffer_count; // Size of circular image buffer, at least twice the size of the pre_event_count int warmup_count; // How many images to process before looking for events int pre_event_count; // How many images to hold and prepend to an alarm event int post_event_count; // How many unalarmed images must occur before the alarm state is reset - int image_buffer_count; // Size of circular image buffer, at least twice the size of the pre_event_count int capture_delay; // How long we wait between capture frames int fps_report_interval;// How many images should be captured/processed between reporting the current FPS int ref_blend_perc; // Percentage of new image going into reference image. - Function function; double fps; Image image; Image ref_image; @@ -212,7 +212,7 @@ public: static int Load( int device, Monitor **&monitors, bool capture=true ); static int Load( const char *host, const char*port, const char*path, Monitor **&monitors, bool capture=true ); static Monitor *Load( int id, bool load_zones=false ); - void StreamImages( unsigned long idle=5000, unsigned long refresh=50, FILE *fd=stdout, unsigned int ttl=0 ); + void StreamImages( unsigned long idle=5000, unsigned long refresh=50, FILE *fd=stdout, time_t ttl=0 ); }; #endif // ZM_MONITOR_H diff --git a/src/zma.cpp b/src/zma.cpp index fada26095..a8784394c 100644 --- a/src/zma.cpp +++ b/src/zma.cpp @@ -57,9 +57,7 @@ int main( int argc, char *argv[] ) while (1) { - int this_option_optind = optind ? optind : 1; int option_index = 0; - int opterr = 1; int c = getopt_long (argc, argv, "m:h", long_options, &option_index); if (c == -1) @@ -130,7 +128,6 @@ int main( int argc, char *argv[] ) while( 1 ) { // Process the next image - bool result = false; sigprocmask( SIG_BLOCK, &block_set, 0 ); if ( !monitor->Analyse() ) { diff --git a/src/zms.cpp b/src/zms.cpp index 6d99f7314..eff460768 100644 --- a/src/zms.cpp +++ b/src/zms.cpp @@ -38,7 +38,7 @@ int main( int argc, const char *argv[] ) char *q_ptr = temp_query; char *parms[8]; // Shouldn't be more than this int parm_no = 0; - while( parms[parm_no] = strtok( q_ptr, "&" ) ) + while( (parms[parm_no] = strtok( q_ptr, "&" )) ) { parm_no++; q_ptr = NULL; diff --git a/src/zmu.cpp b/src/zmu.cpp index 4ec357de9..18b520d51 100644 --- a/src/zmu.cpp +++ b/src/zmu.cpp @@ -97,9 +97,7 @@ int main( int argc, char *argv[] ) int image_idx = -1; while (1) { - int this_option_optind = optind ? optind : 1; int option_index = 0; - int opterr = 1; int c = getopt_long (argc, argv, "d:m:vsrwie::t::fzacqh", long_options, &option_index); if (c == -1) @@ -237,14 +235,14 @@ int main( int argc, char *argv[] ) if ( timestamp.tv_sec ) strftime( timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", localtime( ×tamp.tv_sec ) ); if ( image_idx == -1 ) - printf( "Time of last image capture: %s.%02d\n", timestamp_str, timestamp.tv_usec/10000 ); + printf( "Time of last image capture: %s.%02ld\n", timestamp_str, timestamp.tv_usec/10000 ); else - printf( "Time of image %d capture: %s.%02d\n", image_idx, timestamp_str, timestamp.tv_usec/10000 ); + printf( "Time of image %d capture: %s.%02ld\n", image_idx, timestamp_str, timestamp.tv_usec/10000 ); } else { if ( have_output ) printf( "%c", separator ); - printf( "%d.%02d", timestamp.tv_sec, timestamp.tv_usec/10000 ); + printf( "%ld.%02ld", timestamp.tv_sec, timestamp.tv_usec/10000 ); have_output = true; } } @@ -284,7 +282,7 @@ int main( int argc, char *argv[] ) if ( function & FPS ) { if ( verbose ) - printf( "Current capture rate: %.2f frames per second\n", monitor->GetLastEvent() ); + printf( "Current capture rate: %.2f frames per second\n", monitor->GetFPS() ); else { if ( have_output ) printf( "%c", separator );