From 533876f3135606def3d2bc87d8447cbe057421e1 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 7 Jul 2020 09:16:42 -0400 Subject: [PATCH] rewrite code to use fewer lines. No logic change. --- src/zm_monitor.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index ea8f15edf..6ceae2be1 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -605,7 +605,7 @@ bool Monitor::connect() { if ( mem_ptr == MAP_FAILED ) Fatal("Can't map file %s (%d bytes) to memory: %s(%d)", mem_file, mem_size, strerror(errno), errno); if ( mem_ptr == NULL ) { - Error("mmap gave a null address:"); + Error("mmap gave a NULL address:"); } else { Debug(3, "mmapped to %p", mem_ptr); } @@ -1698,17 +1698,10 @@ bool Monitor::Analyse() { } // end if zone is alarmed } // end foreach zone - if ( got_anal_image ) { - if ( state == PREALARM ) - Event::AddPreAlarmFrame(snap_image, *timestamp, score, &alarm_image); - else - event->AddFrame(snap_image, *timestamp, score, &alarm_image); - } else { - if ( state == PREALARM ) - Event::AddPreAlarmFrame(snap_image, *timestamp, score); - else - event->AddFrame(snap_image, *timestamp, score); - } + if ( state == PREALARM ) + Event::AddPreAlarmFrame(snap_image, *timestamp, score, (got_anal_image?&alarm_image:NULL)); + else + event->AddFrame(snap_image, *timestamp, score, (got_anal_image?&alarm_image:NULL)); } else { // Not doing alarm frame storage if ( state == PREALARM ) { @@ -1744,7 +1737,6 @@ bool Monitor::Analyse() { //set up video store data snprintf(video_store_data->event_file, sizeof(video_store_data->event_file), "%s", event->getEventFile()); video_store_data->recording = event->StartTime(); - } } // end if event