From 7d9924f7029d8a65ad8b5f4eb88cd3608b963329 Mon Sep 17 00:00:00 2001 From: stan Date: Tue, 15 Apr 2003 09:04:38 +0000 Subject: [PATCH] Removed extraneous line ends from Error and Debug. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@486 e3e1d417-86f3-4887-817a-d78f3d33393f --- src/zm_event.cpp | 16 +++---- src/zm_image.cpp | 4 +- src/zm_local_camera.cpp | 94 ++++++++++++++++++++--------------------- src/zm_monitor.cpp | 4 +- src/zm_zone.cpp | 2 +- src/zmfix.cpp | 14 +++--- 6 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index b87168104..005974bfc 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -31,7 +31,7 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time ) : monitor( p_mon sprintf( sql, "insert into Events set MonitorId=%d, Name='Event', StartTime='%s'", monitor->Id(), start_time_str ); if ( mysql_query( &dbconn, sql ) ) { - Error(( "Can't insert event: %s\n", mysql_error( &dbconn ) )); + Error(( "Can't insert event: %s", mysql_error( &dbconn ) )); exit( mysql_errno( &dbconn ) ); } id = mysql_insert_id( &dbconn ); @@ -52,7 +52,7 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time ) : monitor( p_mon { if ( mkdir( path, 0755 ) ) { - Error(( "Can't make %s: %s\n", path, strerror(errno))); + Error(( "Can't make %s: %s", path, strerror(errno))); } } } @@ -70,7 +70,7 @@ Event::~Event() sprintf( sql, "update Events set Name='Event-%d', EndTime = '%s', Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", id, end_time_str, delta_time.positive?"":"-", delta_time.tv_sec, delta_time.tv_usec/10000, frames, alarm_frames, tot_score, (int)(tot_score/alarm_frames), max_score, id ); if ( mysql_query( &dbconn, sql ) ) { - Error(( "Can't update event: %s\n", mysql_error( &dbconn ) )); + Error(( "Can't update event: %s", mysql_error( &dbconn ) )); exit( mysql_errno( &dbconn ) ); } } @@ -90,7 +90,7 @@ void Event::AddFrame( struct timeval timestamp, const Image *image, const Image sprintf( sql, "insert into Frames set EventId=%d, FrameId=%d, AlarmFrame=%d, ImagePath='%s', Delta=%s%ld.%02ld, Score=%d", id, frames, alarm_image!=0, event_file, delta_time.positive?"":"-", delta_time.tv_sec, delta_time.tv_usec/10000, score ); if ( mysql_query( &dbconn, sql ) ) { - Error(( "Can't insert frame: %s\n", mysql_error( &dbconn ) )); + Error(( "Can't insert frame: %s", mysql_error( &dbconn ) )); exit( mysql_errno( &dbconn ) ); } end_frame_id = mysql_insert_id( &dbconn ); @@ -116,14 +116,14 @@ void Event::StreamEvent( const char *path, int event_id, unsigned long refresh, sprintf( sql, "select Id, EventId, ImagePath, TimeStamp from Frames where EventId = %d order by Id", event_id ); if ( mysql_query( &dbconn, sql ) ) { - Error(( "Can't run query: %s\n", mysql_error( &dbconn ) )); + Error(( "Can't run query: %s", mysql_error( &dbconn ) )); exit( mysql_errno( &dbconn ) ); } MYSQL_RES *result = mysql_store_result( &dbconn ); if ( !result ) { - Error(( "Can't use query result: %s\n", mysql_error( &dbconn ) )); + Error(( "Can't use query result: %s", mysql_error( &dbconn ) )); exit( mysql_errno( &dbconn ) ); } @@ -136,7 +136,7 @@ void Event::StreamEvent( const char *path, int event_id, unsigned long refresh, fprintf( fd, "--ZoneMinderFrame\r\n" ); int n_frames = mysql_num_rows( result ); - Info(( "Got %d frames\n", n_frames )); + Info(( "Got %d frames", n_frames )); FILE *fdj = NULL; int n_bytes = 0; static unsigned char buffer[0x10000]; @@ -162,7 +162,7 @@ void Event::StreamEvent( const char *path, int event_id, unsigned long refresh, } if ( mysql_errno( &dbconn ) ) { - Error(( "Can't fetch row: %s\n", mysql_error( &dbconn ) )); + Error(( "Can't fetch row: %s", mysql_error( &dbconn ) )); exit( mysql_errno( &dbconn ) ); } // Yadda yadda diff --git a/src/zm_image.cpp b/src/zm_image.cpp index 86e7e3e15..c588581a1 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -63,7 +63,7 @@ void Image::ReadJpeg( const char *filename ) FILE * infile; if ((infile = fopen(filename, "rb" )) == NULL) { - Error(( "Can't open %s: %s\n", filename, strerror(errno))); + Error(( "Can't open %s: %s", filename, strerror(errno))); exit(1); } jpeg_stdio_src(&cinfo, infile); @@ -114,7 +114,7 @@ void Image::WriteJpeg( const char *filename ) const FILE *outfile; if ((outfile = fopen(filename, "wb" )) == NULL) { - Error(( "Can't open %s: %s\n", filename, strerror(errno))); + Error(( "Can't open %s: %s", filename, strerror(errno))); exit(1); } jpeg_stdio_dest(&cinfo, outfile); diff --git a/src/zm_local_camera.cpp b/src/zm_local_camera.cpp index a704c6943..b31d229b7 100644 --- a/src/zm_local_camera.cpp +++ b/src/zm_local_camera.cpp @@ -57,21 +57,21 @@ void LocalCamera::Initialise() sprintf( device_path, "/dev/video%d", device ); if( (m_videohandle=open(device_path, O_RDONLY)) <=0 ) { - Error(( "Failed to open video device %s: %s\n", device_path, strerror(errno) )); + Error(( "Failed to open video device %s: %s", device_path, strerror(errno) )); exit(-1); } struct video_window vid_win; if( !ioctl( m_videohandle, VIDIOCGWIN, &vid_win)) { - Info(( "X:%d\n", vid_win.x )); - Info(( "Y:%d\n", vid_win.y )); - Info(( "W:%d\n", vid_win.width )); - Info(( "H:%d\n", vid_win.height )); + Info(( "X:%d", vid_win.x )); + Info(( "Y:%d", vid_win.y )); + Info(( "W:%d", vid_win.width )); + Info(( "H:%d", vid_win.height )); } else { - Error(( "Failed to get window attributes: %s\n", strerror(errno) )); + Error(( "Failed to get window attributes: %s", strerror(errno) )); exit(-1); } vid_win.x = 0; @@ -81,23 +81,23 @@ void LocalCamera::Initialise() if( ioctl( m_videohandle, VIDIOCSWIN, &vid_win ) ) { - Error(( "Failed to set window attributes: %s\n", strerror(errno) )); + Error(( "Failed to set window attributes: %s", strerror(errno) )); if ( !ZM_STRICT_VIDEO_CONFIG ) exit(-1); } struct video_picture vid_pic; if( !ioctl( m_videohandle, VIDIOCGPICT, &vid_pic)) { - Info(( "P:%d\n", vid_pic.palette )); - Info(( "D:%d\n", vid_pic.depth )); - Info(( "B:%d\n", vid_pic.brightness )); - Info(( "h:%d\n", vid_pic.hue )); - Info(( "Cl:%d\n", vid_pic.colour )); - Info(( "Cn:%d\n", vid_pic.contrast )); + Info(( "P:%d", vid_pic.palette )); + Info(( "D:%d", vid_pic.depth )); + Info(( "B:%d", vid_pic.brightness )); + Info(( "h:%d", vid_pic.hue )); + Info(( "Cl:%d", vid_pic.colour )); + Info(( "Cn:%d", vid_pic.contrast )); } else { - Error(( "Failed to get picture attributes: %s\n", strerror(errno) )); + Error(( "Failed to get picture attributes: %s", strerror(errno) )); exit(-1); } @@ -123,18 +123,18 @@ void LocalCamera::Initialise() if( ioctl( m_videohandle, VIDIOCSPICT, &vid_pic ) ) { - Error(( "Failed to set picture attributes: %s\n", strerror(errno) )); + Error(( "Failed to set picture attributes: %s", strerror(errno) )); if ( !ZM_STRICT_VIDEO_CONFIG ) exit(-1); } if(!ioctl(m_videohandle, VIDIOCGMBUF, &m_vmb)) { m_vmm = new video_mmap[m_vmb.frames]; - Info(( "vmb.frames = %d\n", m_vmb.frames )); - Info(( "vmb.size = %d\n", m_vmb.size )); + Info(( "vmb.frames = %d", m_vmb.frames )); + Info(( "vmb.size = %d", m_vmb.size )); } else { - Error(( "Failed to setup memory: %s\n", strerror(errno) )); + Error(( "Failed to setup memory: %s", strerror(errno) )); exit(-1); } @@ -158,14 +158,14 @@ void LocalCamera::Initialise() if( !ioctl( m_videohandle, VIDIOCGCHAN, &vid_src)) { - Info(( "C:%d\n", vid_src.channel )); - Info(( "F:%d\n", vid_src.norm )); - Info(( "Fl:%x\n", vid_src.flags )); - Info(( "T:%d\n", vid_src.type )); + Info(( "C:%d", vid_src.channel )); + Info(( "F:%d", vid_src.norm )); + Info(( "Fl:%x", vid_src.flags )); + Info(( "T:%d", vid_src.type )); } else { - Error(( "Failed to get camera source: %s\n", strerror(errno) )); + Error(( "Failed to get camera source: %s", strerror(errno) )); exit(-1); } @@ -175,35 +175,35 @@ void LocalCamera::Initialise() vid_src.type = VIDEO_TYPE_CAMERA; if(ioctl(m_videohandle, VIDIOCSCHAN, &vid_src)) { - Error(( "Failed to set camera source %d: %s\n", channel, strerror(errno) )); + Error(( "Failed to set camera source %d: %s", channel, strerror(errno) )); if ( !ZM_STRICT_VIDEO_CONFIG ) exit(-1); } if( !ioctl( m_videohandle, VIDIOCGWIN, &vid_win)) { - Info(( "X:%d\n", vid_win.x )); - Info(( "Y:%d\n", vid_win.y )); - Info(( "W:%d\n", vid_win.width )); - Info(( "H:%d\n", vid_win.height )); + Info(( "X:%d", vid_win.x )); + Info(( "Y:%d", vid_win.y )); + Info(( "W:%d", vid_win.width )); + Info(( "H:%d", vid_win.height )); } else { - Error(( "Failed to get window data: %s\n", strerror(errno) )); + Error(( "Failed to get window data: %s", strerror(errno) )); exit(-1); } if( !ioctl( m_videohandle, VIDIOCGPICT, &vid_pic)) { - Info(( "P:%d\n", vid_pic.palette )); - Info(( "D:%d\n", vid_pic.depth )); - Info(( "B:%d\n", vid_pic.brightness )); - Info(( "h:%d\n", vid_pic.hue )); - Info(( "Cl:%d\n", vid_pic.colour )); - Info(( "Cn:%d\n", vid_pic.contrast )); + Info(( "P:%d", vid_pic.palette )); + Info(( "D:%d", vid_pic.depth )); + Info(( "B:%d", vid_pic.brightness )); + Info(( "h:%d", vid_pic.hue )); + Info(( "Cl:%d", vid_pic.colour )); + Info(( "Cn:%d", vid_pic.contrast )); } else { - Error(( "Failed to get window data: %s\n", strerror(errno) )); + Error(( "Failed to get window data: %s", strerror(errno) )); exit(-1); } } @@ -227,7 +227,7 @@ bool LocalCamera::GetCurrentSettings( int device, char *output, bool verbose ) sprintf( output, output+strlen(output), "Checking Video Device: %s\n", device_path ); if( (m_videohandle=open(device_path, O_RDONLY)) <=0 ) { - Error(( "Failed to open video device %s: %s\n", device_path, strerror(errno) )); + Error(( "Failed to open video device %s: %s", device_path, strerror(errno) )); if ( verbose ) sprintf( output+strlen(output), "Error, failed to open video device: %s\n", strerror(errno) ); else @@ -405,7 +405,7 @@ bool LocalCamera::GetCurrentSettings( int device, char *output, bool verbose ) } else { - Error(( "Failed to get channel %d attributes: %s\n", chan, strerror(errno) )); + Error(( "Failed to get channel %d attributes: %s", chan, strerror(errno) )); if ( verbose ) sprintf( output, "Error, failed to get channel %d attributes: %s\n", chan, strerror(errno) ); else @@ -418,11 +418,11 @@ bool LocalCamera::GetCurrentSettings( int device, char *output, bool verbose ) int LocalCamera::PreCapture() { - //Info(( "%s: Capturing image\n", id )); + //Info(( "%s: Capturing image", id )); if ( camera_count > 1 ) { - //Info(( "Switching\n" )); + //Info(( "Switching" )); struct video_channel vs; vs.channel = channel; @@ -432,14 +432,14 @@ int LocalCamera::PreCapture() vs.type = VIDEO_TYPE_CAMERA; if(ioctl(m_videohandle, VIDIOCSCHAN, &vs)) { - Error(( "Failed to set camera source %d: %s\n", channel, strerror(errno) )); + Error(( "Failed to set camera source %d: %s", channel, strerror(errno) )); return( -1 ); } } - //Info(( "MC:%d\n", m_videohandle )); + //Info(( "MC:%d", m_videohandle )); if ( ioctl(m_videohandle, VIDIOCMCAPTURE, &m_vmm[m_cap_frame]) ) { - Error(( "Capture failure for frame %d: %s\n", m_cap_frame, strerror(errno))); + Error(( "Capture failure for frame %d: %s", m_cap_frame, strerror(errno))); return( -1 ); } m_cap_frame = (m_cap_frame+1)%m_vmb.frames; @@ -448,11 +448,11 @@ int LocalCamera::PreCapture() unsigned char *LocalCamera::PostCapture() { - //Info(( "%s: Capturing image\n", id )); + //Info(( "%s: Capturing image", id )); if ( ioctl(m_videohandle, VIDIOCSYNC, &m_sync_frame) ) { - Error(( "Sync failure for frame %d: %s\n", m_sync_frame, strerror(errno))); + Error(( "Sync failure for frame %d: %s", m_sync_frame, strerror(errno))); return( 0 ); } @@ -464,11 +464,11 @@ unsigned char *LocalCamera::PostCapture() int LocalCamera::PostCapture( Image &image ) { - //Info(( "%s: Capturing image\n", id )); + //Info(( "%s: Capturing image", id )); if ( ioctl(m_videohandle, VIDIOCSYNC, &m_sync_frame) ) { - Error(( "Sync failure for frame %d: %s\n", m_sync_frame, strerror(errno))); + Error(( "Sync failure for frame %d: %s", m_sync_frame, strerror(errno))); return( -1 ); } diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 2858c63a3..408c60344 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -47,14 +47,14 @@ Monitor::Monitor( int p_id, char *p_name, int p_function, int p_device, int p_ch shmid = shmget( ZM_SHM_KEY|id, shared_images_size, IPC_CREAT|0777 ); if ( shmid < 0 ) { - Error(( "Can't shmget: %s\n", strerror(errno))); + Error(( "Can't shmget: %s", strerror(errno))); exit( -1 ); } unsigned char *shm_ptr = (unsigned char *)shmat( shmid, 0, 0 ); shared_images = (SharedImages *)shm_ptr; if ( shared_images < 0 ) { - Error(( "Can't shmat: %s\n", strerror(errno))); + Error(( "Can't shmat: %s", strerror(errno))); exit( -1 ); } diff --git a/src/zm_zone.cpp b/src/zm_zone.cpp index f4aa3b9bf..76e86b45d 100644 --- a/src/zm_zone.cpp +++ b/src/zm_zone.cpp @@ -314,7 +314,7 @@ bool Zone::CheckAlarms( const Image *delta_image ) BlobStats *bs = &blob_stats[i]; if ( bs->count && ((min_blob_pixels && bs->count < min_blob_pixels) || (max_blob_pixels && bs->count > max_blob_pixels)) ) { - //Info(( "Eliminating blob %d, %d pixels (%d,%d - %d,%d)\n", i, bs->count, bs->lo_x, bs->lo_y, bs->hi_x, bs->hi_y )); + //Info(( "Eliminating blob %d, %d pixels (%d,%d - %d,%d)", i, bs->count, bs->lo_x, bs->lo_y, bs->hi_x, bs->hi_y )); for ( int sy = bs->lo_y; sy <= bs->hi_y; sy++ ) { unsigned char *spdiff = diff_image->Buffer( bs->lo_x, sy ); diff --git a/src/zmfix.cpp b/src/zmfix.cpp index 47c03c24b..d8ea51104 100644 --- a/src/zmfix.cpp +++ b/src/zmfix.cpp @@ -41,7 +41,7 @@ bool fixDevice( int device ) if ( stat( device_path, &stat_buf ) < 0 ) { - Error(( "Can't stat %s: %s\n", device_path, strerror(errno))); + Error(( "Can't stat %s: %s", device_path, strerror(errno))); return( false ); } @@ -68,15 +68,15 @@ bool fixDevice( int device ) mode_t mode = stat_buf.st_mode; if ( mode & mask ) { - Info(( "Permissions on %s are ok at %o\n", device_path, mode )); + Info(( "Permissions on %s are ok at %o", device_path, mode )); return( true ); } mode |= mask; - Info(( "Resetting permission on %s to %o\n", device_path, mode )); + Info(( "Resetting permissions on %s to %o", device_path, mode )); if ( chmod( device_path, mode ) < 0 ) { - Error(( "Can't chmod %s to %o: %s\n", device_path, mode, strerror(errno))); + Error(( "Can't chmod %s to %o: %s", device_path, mode, strerror(errno))); return( false ); } return( true ); @@ -110,14 +110,14 @@ int main( int argc, char *argv[] ) sprintf( sql, "select distinct Device from Monitors where Type = 'Local'" ); if ( mysql_query( &dbconn, sql ) ) { - Error(( "Can't run query: %s\n", mysql_error( &dbconn ) )); + Error(( "Can't run query: %s", mysql_error( &dbconn ) )); exit( mysql_errno( &dbconn ) ); } MYSQL_RES *result = mysql_store_result( &dbconn ); if ( !result ) { - Error(( "Can't use query result: %s\n", mysql_error( &dbconn ) )); + Error(( "Can't use query result: %s", mysql_error( &dbconn ) )); exit( mysql_errno( &dbconn ) ); } @@ -129,7 +129,7 @@ int main( int argc, char *argv[] ) if ( mysql_errno( &dbconn ) ) { - Error(( "Can't fetch row: %s\n", mysql_error( &dbconn ) )); + Error(( "Can't fetch row: %s", mysql_error( &dbconn ) )); exit( mysql_errno( &dbconn ) ); } // Yadda yadda