From 4af979c842ef51acb9b757180defb5140b44bf07 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 29 Aug 2021 09:15:40 -0400 Subject: [PATCH] spacing --- src/zm_monitor.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 66c91fe15..8a1aabe63 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -199,7 +199,7 @@ bool Monitor::MonitorLink::connect() { shared_data = (SharedData *)mem_ptr; trigger_data = (TriggerData *)((char *)shared_data + sizeof(SharedData)); - if ( !shared_data->valid ) { + if (!shared_data->valid) { Debug(3, "Linked memory not initialised by capture daemon"); disconnect(); return false; @@ -215,23 +215,23 @@ bool Monitor::MonitorLink::connect() { } // end bool Monitor::MonitorLink::connect() bool Monitor::MonitorLink::disconnect() { - if ( connected ) { + if (connected) { connected = false; #if ZM_MEM_MAPPED - if ( mem_ptr > (void *)0 ) { - msync( mem_ptr, mem_size, MS_ASYNC ); - munmap( mem_ptr, mem_size ); + if (mem_ptr > (void *)0) { + msync(mem_ptr, mem_size, MS_ASYNC); + munmap(mem_ptr, mem_size); } - if ( map_fd >= 0 ) - close( map_fd ); + if (map_fd >= 0) + close(map_fd); map_fd = -1; #else // ZM_MEM_MAPPED struct shmid_ds shm_data; - if ( shmctl( shm_id, IPC_STAT, &shm_data ) < 0 ) { - Debug( 3, "Can't shmctl: %s", strerror(errno) ); - return( false ); + if (shmctl(shm_id, IPC_STAT, &shm_data) < 0) { + Debug(3, "Can't shmctl: %s", strerror(errno)); + return false; } shm_id = 0; @@ -247,7 +247,6 @@ bool Monitor::MonitorLink::disconnect() { Debug(3, "Can't shmdt: %s", strerror(errno)); return false; } - #endif // ZM_MEM_MAPPED mem_size = 0; mem_ptr = nullptr; @@ -892,7 +891,6 @@ std::shared_ptr Monitor::Load(unsigned int p_id, bool load_zones, Purpo } bool Monitor::connect() { - if (mem_ptr != nullptr) { Warning("Already connected. Please call disconnect first."); } @@ -1035,7 +1033,7 @@ bool Monitor::connect() { video_store_data->size = sizeof(VideoStoreData); usedsubpixorder = camera->SubpixelOrder(); // Used in CheckSignal shared_data->valid = true; - } else if ( !shared_data->valid ) { + } else if (!shared_data->valid) { Error("Shared data not initialised by capture daemon for monitor %s", name.c_str()); return false; }