From 72b80d74177cc53bec976d18ff09427705186502 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 1 Nov 2013 09:47:28 -0400 Subject: [PATCH 01/15] remake this branch off master instead of off mysql2PDO. Establish an automake substitution of @VERSION@ and use it throughotu to override whatever is in zm.conf --- configure.ac | 1 + scripts/zmdbbackup.in | 2 ++ scripts/zmeventdump.in | 2 ++ web/includes/config.php.in | 2 ++ zm.conf.in | 14 +++++++------- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 7ce0942a7..d1592368a 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,7 @@ PATH_BUILD=`pwd` AC_SUBST(PATH_BUILD) TIME_BUILD=`date +'%s'` AC_SUBST(TIME_BUILD) +AC_SUBST(VERSION) AC_ARG_VAR(ZM_DB_HOST,[Hostname where ZoneMinder database located, default localhost]) AC_ARG_VAR(ZM_DB_NAME,[Name of ZoneMinder database, default zm]) diff --git a/scripts/zmdbbackup.in b/scripts/zmdbbackup.in index 303cf86be..37879b5f1 100644 --- a/scripts/zmdbbackup.in +++ b/scripts/zmdbbackup.in @@ -20,6 +20,8 @@ # Edit these to suit your configuration ZM_CONFIG=@ZM_CONFIG@ source $ZM_CONFIG +# ZM_VERSION in the config is now deprecated but will likely still exist in people's config files. This will override it. +ZM_VERSION=@VERSION@ MYSQLDUMP=/usr/bin/mysqldump BACKUP_PATH=/var/lib/zm diff --git a/scripts/zmeventdump.in b/scripts/zmeventdump.in index 342b665b0..fad82db37 100644 --- a/scripts/zmeventdump.in +++ b/scripts/zmeventdump.in @@ -23,6 +23,8 @@ # Edit these to suit your configuration ZM_CONFIG=@ZM_CONFIG@ +# ZM_VERSION in the config is now deprecated but will likely still exist in people's config files. This will override it. +ZM_VERSION=@VERSION@ MYSQLDUMP=/usr/bin/mysqldump # The rest should not need editing diff --git a/web/includes/config.php.in b/web/includes/config.php.in index b9f66449e..14a8215fb 100644 --- a/web/includes/config.php.in +++ b/web/includes/config.php.in @@ -22,6 +22,8 @@ // This section contains options substituted by the zmconfig.pl utility, do not edit these directly // define( "ZM_CONFIG", "@ZM_CONFIG@" ); // Path to config file +// Define, and override any given in config file +define( "ZM_VERSION", "@VERSION@" ); // Version $configFile = ZM_CONFIG; $localConfigFile = basename($configFile); diff --git a/zm.conf.in b/zm.conf.in index f4c426c65..65380a533 100644 --- a/zm.conf.in +++ b/zm.conf.in @@ -9,15 +9,9 @@ # or installations. # -# Current version of ZoneMinder -ZM_VERSION=@VERSION@ - -# Path to build directory +# Path to build directory, used mostly for finding DB upgrade scripts ZM_PATH_BUILD=@PATH_BUILD@ -# Path to installed data directory, used mostly for finding DB upgrade scripts -ZM_PATH_DATA=@PKGDATADIR@ - # Build time, used to record when to trigger various checks ZM_TIME_BUILD=@TIME_BUILD@ @@ -40,6 +34,9 @@ ZM_PATH_CGI=@CGI_PREFIX@ ZM_WEB_USER=@WEB_USER@ ZM_WEB_GROUP=@WEB_GROUP@ +# ZoneMinder database type: so far only mysql is supported +ZM_DB_TYPE=@ZM_DB_TYPE@ + # ZoneMinder database hostname or ip address ZM_DB_HOST=@ZM_DB_HOST@ @@ -51,3 +48,6 @@ ZM_DB_USER=@ZM_DB_USER@ # ZoneMinder database password ZM_DB_PASS=@ZM_DB_PASS@ + +# Host of this machine +ZM_SERVER_HOST= From d428c832e7fde9cb81d4cab9b3af8def83dfee30 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 1 Nov 2013 09:50:50 -0400 Subject: [PATCH 02/15] blah --- scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in index 37119f725..31854fe67 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in @@ -32,6 +32,8 @@ require Exporter; our @ISA = qw(Exporter); +use constant ZM_VERSION => "@VERSION"; + # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. @@ -39,7 +41,7 @@ our @ISA = qw(Exporter); # This allows declaration use ZoneMinder ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. -our %EXPORT_TAGS = ( 'all' => [ qw() ] ); +our %EXPORT_TAGS = ( 'all' => [ qw(ZM_VERSION) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); From 550040474fd80e29b568c4b76b3ed89e1acef66b Mon Sep 17 00:00:00 2001 From: Joe Evans Date: Fri, 1 Nov 2013 14:11:48 -0700 Subject: [PATCH 03/15] Cast content_length to signed int for error-check comparison, preventing segfault when attempting to read buffer. --- src/zm_remote_camera_http.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index 59c6f53e0..c83db6401 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -1092,7 +1092,7 @@ int RemoteCameraHttp::Capture( Image &image ) Warning( "Unable to capture image, retrying" ); return( 1 ); } - if ( content_length < 0 ) + if ( (int)content_length < 0 ) { Error( "Unable to get response" ); Disconnect(); From b368d306b9633d3a65220c7878ca3065bce794e2 Mon Sep 17 00:00:00 2001 From: David Nesting Date: Sat, 2 Nov 2013 15:56:42 -0700 Subject: [PATCH 04/15] Fix marker-out-of-bounds crash when defining zone points --- src/zm_zone.cpp | 12 +++++--- web/skins/classic/views/css/zone.css | 6 +++- web/skins/classic/views/js/zone.js | 41 +++++++++++----------------- 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/zm_zone.cpp b/src/zm_zone.cpp index 51853a0b9..f1418e4e5 100644 --- a/src/zm_zone.cpp +++ b/src/zm_zone.cpp @@ -956,12 +956,16 @@ int Zone::Load( Monitor *monitor, Zone **&zones ) Debug( 5, "Parsing polygon %s", Coords ); Polygon polygon; - if ( !ParsePolygonString( Coords, polygon ) ) - Panic( "Unable to parse polygon string '%s' for zone %d/%s for monitor %s", Coords, Id, Name, monitor->Name() ); + if ( !ParsePolygonString( Coords, polygon ) ) { + Error( "Unable to parse polygon string '%s' for zone %d/%s for monitor %s, ignoring", Coords, Id, Name, monitor->Name() ); + continue; + } if ( polygon.LoX() < 0 || polygon.HiX() >= (int)monitor->Width() - || polygon.LoY() < 0 || polygon.HiY() >= (int)monitor->Height() ) - Panic( "Zone %d/%s for monitor %s extends outside of image dimensions, %d, %d, %d, %d", Id, Name, monitor->Name(), polygon.LoX(), polygon.LoY(), polygon.HiX(), polygon.HiY() ); + || 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", Id, Name, monitor->Name(), polygon.LoX(), polygon.LoY(), polygon.HiX(), polygon.HiY() ); + continue; + } if ( false && !strcmp( Units, "Percent" ) ) { diff --git a/web/skins/classic/views/css/zone.css b/web/skins/classic/views/css/zone.css index 554255a74..2f6754275 100644 --- a/web/skins/classic/views/css/zone.css +++ b/web/skins/classic/views/css/zone.css @@ -33,9 +33,13 @@ position: relative; } +/* NB: The size of the imageFrame determines the area within which the markers + * may be moved. When adjusting the padding and margins of the imageFrame and + * the DIVs within it, test that the markers behave sensibly when dragged to + * the extreme edges of the imageFrame. */ #imageFrame { position: relative; - padding: 0 6px 6px 0; /* Double margin of points below */ + padding: 0 3px 3px 0; /* Compensate for negative margins in the markers just below. */ } #imageFrame div { diff --git a/web/skins/classic/views/js/zone.js b/web/skins/classic/views/js/zone.js index ed2024e26..7f6824127 100644 --- a/web/skins/classic/views/js/zone.js +++ b/web/skins/classic/views/js/zone.js @@ -255,30 +255,13 @@ function applyZoneUnits() function limitRange( field, minValue, maxValue ) { - if ( parseInt(field.value) < parseInt(minValue) ) - { - field.value = minValue; - } - else if ( parseInt(field.value) > parseInt(maxValue) ) - { - field.value = maxValue; - } + field.value = constrainValue( parseInt(field.value), parseInt(minValue), parseInt(maxValue) ); } function limitFilter( field ) { - var minValue = 3; - var maxValue = 15; - field.value = (Math.floor((field.value-1)/2)*2) + 1; - if ( parseInt(field.value) < minValue ) - { - field.value = minValue; - } - if ( parseInt(field.value) > maxValue ) - { - field.value = maxValue; - } + field.value = constrainValue(parseInt(field.value), 3, 15); } function limitArea( field ) @@ -352,11 +335,22 @@ function fixActivePoint( index ) updateZoneImage(); } +function constrainValue( value, loVal, hiVal ) +{ + if ( value < loVal ) { + return loVal; + } + if ( value > hiVal ) { + return hiVal; + } + return value; +} + function updateActivePoint( index ) { var point = $('point'+index); - var x = point.getStyle( 'left' ).toInt(); - var y = point.getStyle( 'top' ).toInt(); + var x = constrainValue( point.getStyle( 'left' ).toInt(), 0, maxX ); + var y = constrainValue( point.getStyle( 'top' ).toInt(), 0, maxY ); $('newZone[Points]['+index+'][x]').value = x; $('newZone[Points]['+index+'][y]').value = y; @@ -387,10 +381,7 @@ function delPoint( index ) function limitPointValue( point, loVal, hiVal ) { - if ( point.value < loVal ) - point.value = 0; - else if ( point.value > hiVal ) - point.value = hiVal; + point.value = constrainValue(point.value, loVal, hiVal) } function updateX( index ) From 9d5ac7ae8cfd764bae639cb4999993696fabfcdf Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Mon, 4 Nov 2013 09:56:40 +0200 Subject: [PATCH 05/15] Fix cmake installing wrong files in an out-of-source build --- CMakeLists.txt | 10 +++++----- db/CMakeLists.txt | 8 +++++--- misc/CMakeLists.txt | 4 ++-- scripts/CMakeLists.txt | 4 ++-- web/CMakeLists.txt | 3 ++- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 733ec81be..4dd8dc096 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -438,10 +438,10 @@ if((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6")) endif((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6")) # Generate files from the .in files -configure_file(zoneminder-config.cmake config.h @ONLY) -configure_file(zm.conf.in zm.conf @ONLY) -configure_file(zmconfgen.pl.in zmconfgen.pl @ONLY) -configure_file(zmlinkcontent.sh.in zmlinkcontent.sh @ONLY) +configure_file(zm.conf.in "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" @ONLY) +configure_file(zoneminder-config.cmake "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) +configure_file(zmconfgen.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmconfgen.pl" @ONLY) +configure_file(zmlinkcontent.sh.in "${CMAKE_CURRENT_BINARY_DIR}/zmlinkcontent.sh" @ONLY) # Process subdirectories add_subdirectory(src) @@ -472,7 +472,7 @@ else(zmconfgen_result EQUAL 0) endif(zmconfgen_result EQUAL 0) # Install zm.conf -install(FILES zm.conf DESTINATION "/${CMAKE_INSTALL_SYSCONFDIR}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "/${CMAKE_INSTALL_SYSCONFDIR}") # Uninstall target configure_file( diff --git a/db/CMakeLists.txt b/db/CMakeLists.txt index 41481a250..e1b551b1c 100644 --- a/db/CMakeLists.txt +++ b/db/CMakeLists.txt @@ -3,9 +3,11 @@ # Create files from the .in files configure_file(zm_create.sql.in "${CMAKE_CURRENT_BINARY_DIR}/zm_create.sql" @ONLY) -# Glob all files matching zm*.sql (to exclude *.in files and autotools's files) -file(GLOB dbfileslist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "zm*.sql") +# Glob all database upgrade scripts +file(GLOB dbfileslist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "zm_update-*.sql") -# Install the database scripts, exclude makefiles and cmake stuff +# Install the database upgrade scripts install(FILES ${dbfileslist} DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db") +# install zm_create.sql +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm_create.sql" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db") diff --git a/misc/CMakeLists.txt b/misc/CMakeLists.txt index 830e70ace..c1dbcabb9 100644 --- a/misc/CMakeLists.txt +++ b/misc/CMakeLists.txt @@ -5,6 +5,6 @@ configure_file(apache.conf.in "${CMAKE_CURRENT_BINARY_DIR}/apache.conf" @ONLY) configure_file(logrotate.conf.in "${CMAKE_CURRENT_BINARY_DIR}/logrotate.conf" @ONLY) configure_file(syslog.conf.in "${CMAKE_CURRENT_BINARY_DIR}/syslog.conf" @ONLY) -# Install the misc files -install(FILES apache.conf logrotate.conf syslog.conf DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/misc") +# Do not install the misc files by default +#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/apache.conf" "${CMAKE_CURRENT_BINARY_DIR}/logrotate.conf" "${CMAKE_CURRENT_BINARY_DIR}/syslog.conf" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/misc") diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 2409c7681..d78a4e56b 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -23,7 +23,7 @@ configure_file(zm.in "${CMAKE_CURRENT_BINARY_DIR}/zm" @ONLY) #configure_file(zmeventdump.in zmeventdump @ONLY) # Install the perl scripts -install(FILES zmaudit.pl zmcontrol.pl zmdc.pl zmfilter.pl zmpkg.pl zmtrack.pl zmtrigger.pl zmupdate.pl zmvideo.pl zmwatch.pl DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zmaudit.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmcontrol.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmdc.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmfilter.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmpkg.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmtrack.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmtrigger.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmupdate.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmvideo.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmwatch.pl" DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) if(NOT ZM_NO_X10) -install(FILES zmx10.pl DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zmx10.pl" DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) endif(NOT ZM_NO_X10) diff --git a/web/CMakeLists.txt b/web/CMakeLists.txt index b547df708..b122bea4e 100644 --- a/web/CMakeLists.txt +++ b/web/CMakeLists.txt @@ -7,5 +7,6 @@ add_subdirectory(tools/mootools) configure_file(includes/config.php.in "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" @ONLY) # Install the web files -install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATION "${ZM_WEBDIR}" PATTERN "*.in" EXCLUDE PATTERN "*Make*" EXCLUDE) +install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATION "${ZM_WEBDIR}" PATTERN "*.in" EXCLUDE PATTERN "*Make*" EXCLUDE PATTERN "*cmake*" EXCLUDE REGEX "includes/config.php$" EXCLUDE) install(FILES index.php README.md DESTINATION "${ZM_WEBDIR}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" DESTINATION "${ZM_WEBDIR}/includes") From 4e1d23669f1a2c1e98bd32363d2c28a1f703b2fd Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Mon, 4 Nov 2013 10:54:39 +0200 Subject: [PATCH 06/15] Revert content_length to be int --- src/zm_remote_camera_http.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index c83db6401..80cdca430 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -1086,13 +1086,13 @@ int RemoteCameraHttp::PreCapture() int RemoteCameraHttp::Capture( Image &image ) { - unsigned int content_length = GetResponse(); + int content_length = GetResponse(); if ( content_length == 0 ) { Warning( "Unable to capture image, retrying" ); return( 1 ); } - if ( (int)content_length < 0 ) + if ( content_length < 0 ) { Error( "Unable to get response" ); Disconnect(); @@ -1112,7 +1112,7 @@ int RemoteCameraHttp::Capture( Image &image ) } case X_RGB : { - if ( content_length != image.Size() ) + if ( (unsigned int)content_length != image.Size() ) { Error( "Image length mismatch, expected %d bytes, content length was %d", image.Size(), content_length ); Disconnect(); From 7a2f3b5226df7909b89ef9b85b91c482c8d7b2f8 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 4 Nov 2013 09:57:00 -0500 Subject: [PATCH 07/15] add in missing @ --- scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in index 31854fe67..3f10e9137 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in @@ -32,7 +32,7 @@ require Exporter; our @ISA = qw(Exporter); -use constant ZM_VERSION => "@VERSION"; +use constant ZM_VERSION => "@VERSION@"; # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. From 0fd7d857bf8ff2b3ebfcce6a6c502817c8a45f32 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 4 Nov 2013 10:06:39 -0500 Subject: [PATCH 08/15] put back ZM_PATH_DATA --- zm.conf.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zm.conf.in b/zm.conf.in index 65380a533..dc3fd086f 100644 --- a/zm.conf.in +++ b/zm.conf.in @@ -9,12 +9,15 @@ # or installations. # -# Path to build directory, used mostly for finding DB upgrade scripts +# Path to build directory ZM_PATH_BUILD=@PATH_BUILD@ # Build time, used to record when to trigger various checks ZM_TIME_BUILD=@TIME_BUILD@ +# Path to installed data directory, used mostly for finding DB upgrade scripts +ZM_PATH_DATA=@PKGDATADIR@ + # Path to ZoneMinder binaries ZM_PATH_BIN=@BINDIR@ From f6bf3743f7933a19757bbc0eac1ae9abedcba675 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 4 Nov 2013 10:50:40 -0500 Subject: [PATCH 09/15] very sub-optimisation, removing duplicate comparisons --- src/zm_image.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/zm_image.cpp b/src/zm_image.cpp index 18b93c57b..f60d6e9d0 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -3000,23 +3000,23 @@ __attribute__((noinline,__target__("sse2"))) void sse2_fastblend(const uint8_t* // 1.5625% blending divider = 6; clearmask = 0x03030303; - } else if(blendpercent >= 2.34375 && blendpercent < 4.6875) { + } else if(blendpercent < 4.6875) { // 3.125% blending divider = 5; clearmask = 0x07070707; - } else if(blendpercent >= 4.6875 && blendpercent < 9.375) { + } else if(blendpercent < 9.375) { // 6.25% blending divider = 4; clearmask = 0x0F0F0F0F; - } else if(blendpercent >= 9.375 && blendpercent < 18.75) { + } else if(blendpercent < 18.75) { // 12.5% blending divider = 3; clearmask = 0x1F1F1F1F; - } else if(blendpercent >= 18.75 && blendpercent < 37.5) { + } else if(blendpercent < 37.5) { // 25% blending divider = 2; clearmask = 0x3F3F3F3F; - } else if(blendpercent >= 37.5) { + } else { // 50% blending divider = 1; clearmask = 0x7F7F7F7F; @@ -3063,19 +3063,19 @@ __attribute__((noinline)) void std_fastblend(const uint8_t* col1, const uint8_t* if(blendpercent < 2.34375) { // 1.5625% blending divider = 6; - } else if(blendpercent >= 2.34375 && blendpercent < 4.6875) { + } else if(blendpercent < 4.6875) { // 3.125% blending divider = 5; - } else if(blendpercent >= 4.6875 && blendpercent < 9.375) { + } else if(blendpercent < 9.375) { // 6.25% blending divider = 4; - } else if(blendpercent >= 9.375 && blendpercent < 18.75) { + } else if(blendpercent < 18.75) { // 12.5% blending divider = 3; - } else if(blendpercent >= 18.75 && blendpercent < 37.5) { + } else if(blendpercent < 37.5) { // 25% blending divider = 2; - } else if(blendpercent >= 37.5) { + } else { // 50% blending divider = 1; } From 90d7ce98f12b22368eea5f17a377f4077e0468af Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Mon, 4 Nov 2013 22:38:21 +0200 Subject: [PATCH 10/15] Delete PATH_BUILD and TIME_BUILD from zm.conf and setup default for ZM_DB_TYPE --- CMakeLists.txt | 3 +-- configure.ac | 7 +++---- zm.conf.in | 8 +------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dd8dc096..1fa4b2e52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -418,9 +418,7 @@ message(STATUS "Using web group: ${ZM_WEB_GROUP}") set(ZM_PID "${ZM_RUNDIR}/zm.pid") set(ZM_CONFIG "/${CMAKE_INSTALL_SYSCONFDIR}/zm.conf") set(VERSION "${zoneminder_VERSION}") -set(PATH_BUILD "${PROJECT_SOURCE_DIR}") set(PKGDATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/zoneminder") -set(TIME_BUILD "1000000") # Don't have a solution for this one yet set(BINDIR "${CMAKE_INSTALL_FULL_BINDIR}") set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}") set(SYSCONFDIR "/${CMAKE_INSTALL_SYSCONFDIR}") @@ -428,6 +426,7 @@ set(WEB_PREFIX "${ZM_WEBDIR}") set(CGI_PREFIX "${ZM_CGIDIR}") set(WEB_USER "${ZM_WEB_USER}") set(WEB_GROUP "${ZM_WEB_GROUP}") +set(ZM_DB_TYPE "mysql") set(EXTRA_PERL_LIB "use lib '${ZM_PERL_USE_PATH}';") # Reassign some variables if a target distro has been specified diff --git a/configure.ac b/configure.ac index d1592368a..9b6270acd 100644 --- a/configure.ac +++ b/configure.ac @@ -6,10 +6,6 @@ AC_CONFIG_HEADERS(config.h) AC_SUBST([AM_CXXFLAGS], [-D__STDC_CONSTANT_MACROS]) -PATH_BUILD=`pwd` -AC_SUBST(PATH_BUILD) -TIME_BUILD=`date +'%s'` -AC_SUBST(TIME_BUILD) AC_SUBST(VERSION) AC_ARG_VAR(ZM_DB_HOST,[Hostname where ZoneMinder database located, default localhost]) @@ -22,6 +18,9 @@ AC_ARG_VAR(ZM_RUNDIR,[Location of transient process files, default /var/run/zm]) AC_ARG_VAR(ZM_TMPDIR,[Location of temporary files, default /tmp/zm]) AC_ARG_VAR(ZM_LOGDIR,[Location of generated log files, default /var/log/zm]) +if test "$ZM_DB_TYPE" == ""; then + AC_SUBST(ZM_DB_HOST,[mysql]) +fi if test "$ZM_DB_HOST" == ""; then AC_SUBST(ZM_DB_HOST,[localhost]) fi diff --git a/zm.conf.in b/zm.conf.in index dc3fd086f..242d6adea 100644 --- a/zm.conf.in +++ b/zm.conf.in @@ -9,12 +9,6 @@ # or installations. # -# Path to build directory -ZM_PATH_BUILD=@PATH_BUILD@ - -# Build time, used to record when to trigger various checks -ZM_TIME_BUILD=@TIME_BUILD@ - # Path to installed data directory, used mostly for finding DB upgrade scripts ZM_PATH_DATA=@PKGDATADIR@ @@ -37,7 +31,7 @@ ZM_PATH_CGI=@CGI_PREFIX@ ZM_WEB_USER=@WEB_USER@ ZM_WEB_GROUP=@WEB_GROUP@ -# ZoneMinder database type: so far only mysql is supported +# ZoneMinder database type ZM_DB_TYPE=@ZM_DB_TYPE@ # ZoneMinder database hostname or ip address From 82a3f4622f0187da237bc21496e58340fed985ac Mon Sep 17 00:00:00 2001 From: Will Scales Date: Wed, 6 Nov 2013 06:30:43 -0600 Subject: [PATCH 11/15] Update zoneminder.service Added "After=" rule to [unit] section to prevent Zoneminder from starting before mysqld. --- distros/fedora/zoneminder.service | 1 + 1 file changed, 1 insertion(+) diff --git a/distros/fedora/zoneminder.service b/distros/fedora/zoneminder.service index d59fc6796..fdd9b3af2 100644 --- a/distros/fedora/zoneminder.service +++ b/distros/fedora/zoneminder.service @@ -1,5 +1,6 @@ [Unit] Description=Video security and surveillance system +After=mysqld.service [Service] Type=forking From f4dfd88d9f2048fffbb1d17efbca8f6b941a8efb Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 6 Nov 2013 17:02:01 -0500 Subject: [PATCH 12/15] handle bad config lines better --- scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in index fbd9ea374..a840db080 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in @@ -78,7 +78,11 @@ BEGIN { next if ( $str =~ /^\s*$/ ); next if ( $str =~ /^\s*#/ ); - my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*(.+?)\s*$/; + my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*(.*?)\s*$/; + if ( ! $name ) { + print( STDERR "Warning, bad line in $config_file: $str\n" ); + next; + } # end if $name =~ tr/a-z/A-Z/; *{$name} = sub { $value }; push( @EXPORT_CONFIG, $name ); From d87709528d551711409b6d8163aa0c1a925adfd0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 6 Nov 2013 17:47:23 -0500 Subject: [PATCH 13/15] fix assigning DB_TYPE --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9b6270acd..2afcdf0ff 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ AC_ARG_VAR(ZM_TMPDIR,[Location of temporary files, default /tmp/zm]) AC_ARG_VAR(ZM_LOGDIR,[Location of generated log files, default /var/log/zm]) if test "$ZM_DB_TYPE" == ""; then - AC_SUBST(ZM_DB_HOST,[mysql]) + AC_SUBST(ZM_DB_TYPE,[mysql]) fi if test "$ZM_DB_HOST" == ""; then AC_SUBST(ZM_DB_HOST,[localhost]) From 9979385c3b6416e45d0019e7006f1fbe03ee272c Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Thu, 7 Nov 2013 23:35:44 +0200 Subject: [PATCH 14/15] Remove the crashtrace option from configure.ac (autoconf) --- configure.ac | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/configure.ac b/configure.ac index 2afcdf0ff..11e453bdc 100644 --- a/configure.ac +++ b/configure.ac @@ -177,22 +177,6 @@ if test "$ENABLE_DEBUG" != "yes"; then AC_DEFINE(ZM_DBG_OFF,1,"Whether debug is switched off and compiled out") fi -ENABLE_CRASHTRACE=yes -AC_ARG_ENABLE(crashtrace, - [ --enable-crashtrace= enable or disabled crash tracing, default enabled], - [ENABLE_CRASHTRACE=$enable_crashtrace], - AC_MSG_WARN([You can call configure with the --enable-crashtrace= or --disable-crashtrace option. - This tells configure whether to compile ZoneMinder with crash tracing included. This allows a - dump of the stack trace when a ZoneMinder binary crashes or is killed by an unexpected signal. - Although this should work on most systems it does rely on un(or loosely) documented features and - so should be regarded as experimental. If you experience problems compiling zm_signal.cpp or - ZoneMinder binaries fail to shut down correctly then you should probably disable this feature. - e.g. --enable-crashtrace=yes or --disable-crashtrace]) -) -if test "$ENABLE_CRASHTRACE" != "yes"; then - AC_DEFINE(ZM_NO_CRASHTRACE,1,"Whether crash tracing is switched off and compiled out") -fi - ENABLE_MMAP=yes AC_ARG_ENABLE(mmap, [ --enable-mmap= enable or disabled mapped memory versus shared memory, default mapped], From e9c05093999d9e5f4b6ad100b95a5d67a9139f3e Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 8 Nov 2013 11:09:23 -0500 Subject: [PATCH 15/15] add rules for a dbg package --- distros/ubuntu1204/control | 22 ++++++++++++++++++++-- distros/ubuntu1204/rules | 4 ++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/distros/ubuntu1204/control b/distros/ubuntu1204/control index 06bc6801e..39503027e 100644 --- a/distros/ubuntu1204/control +++ b/distros/ubuntu1204/control @@ -2,13 +2,31 @@ Source: zoneminder Section: net Priority: optional Maintainer: Isaac Connor -Build-Depends: debhelper (>= 5), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf +Build-Depends: debhelper (>= 7.0.50), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf Standards-Version: 3.9.2 Package: zoneminder Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5, php5, php5-mysql, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-lite-perl, mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl -Description: Linux video camera security and surveillance solution +Description: A video camera security and surveillance solution + ZoneMinder is intended for use in single or multi-camera video security + applications, including commercial or home CCTV, theft prevention and child + or family member or home monitoring and other care scenarios. It + supports capture, analysis, recording, and monitoring of video data coming + from one or more video or network cameras attached to a Linux system. + ZoneMinder also support web and semi-automatic control of Pan/Tilt/Zoom + cameras using a variety of protocols. It is suitable for use as a home + video security system and for commercial or professional video security + and surveillance. It can also be integrated into a home automation system + via X.10 or other protocols. + +Package: zoneminder-dbg +Architecture: any +Depends: + zoneminder (= ${binary:Version}), + ${misc:Depends} +Description: debugging syumbols for zoneminder. + ZoneMinder is a video camera security and surveillance solution. ZoneMinder is intended for use in single or multi-camera video security applications, including commercial or home CCTV, theft prevention and child or family member or home monitoring and other care scenarios. It diff --git a/distros/ubuntu1204/rules b/distros/ubuntu1204/rules index 601dcf62a..3dea63174 100755 --- a/distros/ubuntu1204/rules +++ b/distros/ubuntu1204/rules @@ -71,3 +71,7 @@ override_dh_fixperms: override_dh_auto_test: # do not run tests... + +.PHONY: override_dh_strip +override_dh_strip: + dh_strip --dbg-package=zoneminder-dbg