From 4deb3a8d845cd407538ed0ef4f46169493810e94 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 23 Nov 2020 19:31:21 -0500 Subject: [PATCH 1/5] escape the word Groups --- db/zm_update-1.31.5.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/zm_update-1.31.5.sql b/db/zm_update-1.31.5.sql index 859487e88..d315c8e84 100644 --- a/db/zm_update-1.31.5.sql +++ b/db/zm_update-1.31.5.sql @@ -10,7 +10,7 @@ SET @s = (SELECT IF( AND column_name = 'ParentId' ) > 0, "SELECT 'Column GroupId exists in Groups'", -"ALTER TABLE Groups ADD `ParentId` int(10) unsigned AFTER `Name`" +"ALTER TABLE `Groups` ADD `ParentId` int(10) unsigned AFTER `Name`" )); PREPARE stmt FROM @s; From be27630a8508f6e0517fb6e3b70832cdc694c5f2 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 23 Nov 2020 19:33:53 -0500 Subject: [PATCH 2/5] escape the word Groups --- db/zm_update-1.31.7.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/zm_update-1.31.7.sql b/db/zm_update-1.31.7.sql index 1221d9adb..0afd76ce5 100644 --- a/db/zm_update-1.31.7.sql +++ b/db/zm_update-1.31.7.sql @@ -3,7 +3,7 @@ SET @s = (SELECT IF( AND table_name = 'Groups' AND column_name = 'MonitorIds' ) > 0, - "ALTER TABLE Groups MODIFY `MonitorIds` text NOT NULL", + "ALTER TABLE `Groups` MODIFY `MonitorIds` text NOT NULL", "SELECT 'Groups no longer has MonitorIds'" )); From d8993931da8ad92994440f2b710a567fbc23ed72 Mon Sep 17 00:00:00 2001 From: Bluemax Date: Wed, 2 Dec 2020 21:13:45 +0100 Subject: [PATCH 3/5] Improve group permissions (mode 660) Make /dev/shm files 660. --- src/zm_monitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index b66341beb..0630939db 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -557,7 +557,7 @@ bool Monitor::connect() { Debug(3, "Connecting to monitor. Purpose is %d", purpose ); #if ZM_MEM_MAPPED snprintf(mem_file, sizeof(mem_file), "%s/zm.mmap.%d", staticConfig.PATH_MAP.c_str(), id); - map_fd = open(mem_file, O_RDWR|O_CREAT, (mode_t)0600); + map_fd = open(mem_file, O_RDWR|O_CREAT, (mode_t)0660); if ( map_fd < 0 ) { Error("Can't open memory map file %s, probably not enough space free: %s", mem_file, strerror(errno)); return false; From a88ccf793bd2ea4df790c3ae66f777294be1552b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 15 Dec 2020 16:32:19 -0500 Subject: [PATCH 4/5] correct zone points instead of skipping zone --- src/zm_zone.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/zm_zone.cpp b/src/zm_zone.cpp index ea6c170ac..38d1a5ee3 100644 --- a/src/zm_zone.cpp +++ b/src/zm_zone.cpp @@ -922,10 +922,12 @@ int Zone::Load(Monitor *monitor, Zone **&zones) { if ( polygon.LoX() < 0 || polygon.HiX() >= (int)monitor->Width() || polygon.LoY() < 0 || polygon.HiY() >= (int)monitor->Height() ) { - Error("Zone %d/%s for monitor %s extends outside of image dimensions, (%d,%d), (%d,%d), ignoring", + Error("Zone %d/%s for monitor %s extends outside of image dimensions, (%d,%d), (%d,%d), fixing", Id, Name, monitor->Name(), polygon.LoX(), polygon.LoY(), polygon.HiX(), polygon.HiY()); - n_zones -= 1; - continue; + if ( polygon.LoX() < 0 ) polygon.LoX(0); + if ( polygon.HiX() >= (int)monitor->Width()) polygon.HiX((int)monitor->Width()); + if ( polygon.LoY() < 0 ) polygon.LoY(0); + if ( polygon.HiY() >= (int)monitor->Height() ) polygon.HiY((int)monitor->Height()); } if ( false && !strcmp( Units, "Percent" ) ) { From e9d34499299a9adf8895aeb900e56a47ab5d1da7 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 15 Dec 2020 16:32:41 -0500 Subject: [PATCH 5/5] Allow altering polygon coordinates --- src/zm_box.h | 4 ++++ src/zm_coord.h | 10 +++++----- src/zm_poly.h | 4 ++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/zm_box.h b/src/zm_box.h index efc12cb18..ca3e6fd39 100644 --- a/src/zm_box.h +++ b/src/zm_box.h @@ -47,10 +47,14 @@ public: inline const Coord &Lo() const { return lo; } inline int LoX() const { return lo.X(); } + inline int LoX(int p_lo_x) { return lo.X(p_lo_x); } inline int LoY() const { return lo.Y(); } + inline int LoY(int p_lo_y) { return lo.Y(p_lo_y); } inline const Coord &Hi() const { return hi; } inline int HiX() const { return hi.X(); } + inline int HiX(int p_hi_x) { return hi.X(p_hi_x); } inline int HiY() const { return hi.Y(); } + inline int HiY(int p_hi_y) { return hi.Y(p_hi_y); } inline const Coord &Size() const { return size; } inline int Width() const { return size.X(); } inline int Height() const { return size.Y(); } diff --git a/src/zm_coord.h b/src/zm_coord.h index c6234fb1c..9ddd4af0c 100644 --- a/src/zm_coord.h +++ b/src/zm_coord.h @@ -38,14 +38,14 @@ public: y = coord.y; return *this; } - inline int &X() { return( x ); } - inline const int &X() const { return( x ); } - inline int &Y() { return( y ); } - inline const int &Y() const { return( y ); } + inline int &X(int p_x) { x=p_x; return x; } + inline const int &X() const { return x; } + inline int &Y(int p_y) { y=p_y; return y; } + inline const int &Y() const { return y; } inline static Coord Range( const Coord &coord1, const Coord &coord2 ) { Coord result( (coord1.x-coord2.x)+1, (coord1.y-coord2.y)+1 ); - return( result ); + return result; } inline bool operator==( const Coord &coord ) { return( x == coord.x && y == coord.y ); } diff --git a/src/zm_poly.h b/src/zm_poly.h index be039ef3e..d45a13ea2 100644 --- a/src/zm_poly.h +++ b/src/zm_poly.h @@ -100,9 +100,13 @@ public: inline const Box &Extent() const { return extent; } inline int LoX() const { return extent.LoX(); } + inline int LoX(int p_lo_x) { return extent.LoX(p_lo_x); } inline int HiX() const { return extent.HiX(); } + inline int HiX(int p_hi_x) { return extent.HiX(p_hi_x); } inline int LoY() const { return extent.LoY(); } + inline int LoY(int p_lo_y) { return extent.LoY(p_lo_y); } inline int HiY() const { return extent.HiY(); } + inline int HiY(int p_hi_y) { return extent.HiY(p_hi_y); } inline int Width() const { return extent.Width(); } inline int Height() const { return extent.Height(); }