Corrected warnings.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@451 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2003-04-07 11:16:34 +00:00
parent 94390d39e3
commit 17de8a0488
6 changed files with 14 additions and 22 deletions

View File

@ -143,8 +143,6 @@ int zmGetDebugEnv( const char * const command )
int zmDebugInitialise() int zmDebugInitialise()
{ {
char *prev_file = (char*)NULL;
FILE *tmp_fp; FILE *tmp_fp;
int status; int status;
@ -197,12 +195,12 @@ int zmDebugInitialise()
if ( sigaction( SIGUSR1, &action, &old_action ) < 0 ) if ( sigaction( SIGUSR1, &action, &old_action ) < 0 )
{ {
Error(("%s(), error = %s",sigaction,strerror(errno))); Error(("sigaction(), error = %s",strerror(errno)));
return(ZM_DBG_ERROR); return(ZM_DBG_ERROR);
} }
if ( sigaction( SIGUSR2, &action, &old_action ) < 0) if ( sigaction( SIGUSR2, &action, &old_action ) < 0)
{ {
Error(("%s(), error = %s",sigaction,strerror(errno))); Error(("sigaction(), error = %s",strerror(errno)));
return(ZM_DBG_ERROR); return(ZM_DBG_ERROR);
} }
} }
@ -290,7 +288,6 @@ int zmDbgOutput( const char *fstring, ... )
int log_code; int log_code;
struct timeval tp; struct timeval tp;
struct timezone tzp; struct timezone tzp;
static int count = 0;
zm_temp_dbg_string[0] = '\0'; zm_temp_dbg_string[0] = '\0';
va_start(arg_ptr,fstring); va_start(arg_ptr,fstring);
@ -302,7 +299,7 @@ int zmDbgOutput( const char *fstring, ... )
{ {
zmDbgSubtractTime( &tp, &zm_dbg_start ); 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 else
{ {

View File

@ -26,7 +26,7 @@
#include "zm_local_camera.h" #include "zm_local_camera.h"
#include "zm_remote_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]; name = new char[strlen(p_name)+1];
strcpy( name, p_name ); 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; 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]; name = new char[strlen(p_name)+1];
strcpy( name, p_name ); strcpy( name, p_name );
@ -665,7 +665,7 @@ Monitor *Monitor::Load( int id, bool load_zones )
return( monitor ); 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; time_t start_time, now;

View File

@ -50,17 +50,17 @@ protected:
// These are read from the DB and thereafter remain unchanged // These are read from the DB and thereafter remain unchanged
int id; int id;
char *name; char *name;
Function function;
char label_format[64]; // The format of the timestamp on the images char label_format[64]; // The format of the timestamp on the images
Coord label_coord; // The coordinates 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 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 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 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 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 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. int ref_blend_perc; // Percentage of new image going into reference image.
Function function;
double fps; double fps;
Image image; Image image;
Image ref_image; Image ref_image;
@ -212,7 +212,7 @@ public:
static int Load( int device, Monitor **&monitors, bool capture=true ); 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 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 ); 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 #endif // ZM_MONITOR_H

View File

@ -57,9 +57,7 @@ int main( int argc, char *argv[] )
while (1) while (1)
{ {
int this_option_optind = optind ? optind : 1;
int option_index = 0; int option_index = 0;
int opterr = 1;
int c = getopt_long (argc, argv, "m:h", long_options, &option_index); int c = getopt_long (argc, argv, "m:h", long_options, &option_index);
if (c == -1) if (c == -1)
@ -130,7 +128,6 @@ int main( int argc, char *argv[] )
while( 1 ) while( 1 )
{ {
// Process the next image // Process the next image
bool result = false;
sigprocmask( SIG_BLOCK, &block_set, 0 ); sigprocmask( SIG_BLOCK, &block_set, 0 );
if ( !monitor->Analyse() ) if ( !monitor->Analyse() )
{ {

View File

@ -38,7 +38,7 @@ int main( int argc, const char *argv[] )
char *q_ptr = temp_query; char *q_ptr = temp_query;
char *parms[8]; // Shouldn't be more than this char *parms[8]; // Shouldn't be more than this
int parm_no = 0; int parm_no = 0;
while( parms[parm_no] = strtok( q_ptr, "&" ) ) while( (parms[parm_no] = strtok( q_ptr, "&" )) )
{ {
parm_no++; parm_no++;
q_ptr = NULL; q_ptr = NULL;

View File

@ -97,9 +97,7 @@ int main( int argc, char *argv[] )
int image_idx = -1; int image_idx = -1;
while (1) while (1)
{ {
int this_option_optind = optind ? optind : 1;
int option_index = 0; int option_index = 0;
int opterr = 1;
int c = getopt_long (argc, argv, "d:m:vsrwie::t::fzacqh", long_options, &option_index); int c = getopt_long (argc, argv, "d:m:vsrwie::t::fzacqh", long_options, &option_index);
if (c == -1) if (c == -1)
@ -237,14 +235,14 @@ int main( int argc, char *argv[] )
if ( timestamp.tv_sec ) if ( timestamp.tv_sec )
strftime( timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", localtime( &timestamp.tv_sec ) ); strftime( timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", localtime( &timestamp.tv_sec ) );
if ( image_idx == -1 ) 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 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 else
{ {
if ( have_output ) printf( "%c", separator ); 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; have_output = true;
} }
} }
@ -284,7 +282,7 @@ int main( int argc, char *argv[] )
if ( function & FPS ) if ( function & FPS )
{ {
if ( verbose ) 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 else
{ {
if ( have_output ) printf( "%c", separator ); if ( have_output ) printf( "%c", separator );