[packages/zoneminder] - enhanced build patch (cover CHAR_WIDTH conflict with glibc and sole flexible length array in struc

qboosh qboosh at pld-linux.org
Fri Apr 14 22:56:00 CEST 2017


commit 708cf0df05bfdfc3f53c8179013841f84aac0e85
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Apr 14 22:56:09 2017 +0200

    - enhanced build patch (cover CHAR_WIDTH conflict with glibc and sole flexible length array in struct)
    - added types patch (fix some type and format string issues)
    - general spec cleanup
    - release 4

 zoneminder-build.patch | 106 ++++++++++++++++++++++++++++
 zoneminder-types.patch | 187 +++++++++++++++++++++++++++++++++++++++++++++++++
 zoneminder.spec        |  58 ++++++++-------
 3 files changed, 327 insertions(+), 24 deletions(-)
---
diff --git a/zoneminder.spec b/zoneminder.spec
index 5688cf7..88ea992 100644
--- a/zoneminder.spec
+++ b/zoneminder.spec
@@ -9,7 +9,7 @@ Summary:	Zone Minder is a software motion detector with nice WWW GUI
 Summary(pl.UTF-8):	Zone Minder - programowy wykrywacz ruchu z miłym GUI przez WWW
 Name:		zoneminder
 Version:	1.28.0
-Release:	3
+Release:	4
 License:	GPL v2
 Group:		Applications/Graphics
 Source0:	https://github.com/ZoneMinder/ZoneMinder/archive/v%{version}.tar.gz
@@ -28,29 +28,29 @@ Patch1:		%{name}-xlib_shm.patch
 Patch2:		%{name}-build.patch
 Patch3:		%{name}-init.patch
 Patch4:		ffmpeg3.patch
+Patch5:		%{name}-types.patch
 URL:		http://www.zoneminder.com/
-BuildRequires:	autoconf
+BuildRequires:	autoconf >= 2.59
 BuildRequires:	automake
 BuildRequires:	bzip2-devel
 BuildRequires:	curl-devel
 BuildRequires:	ffmpeg-devel >= 0.4.9-4.20090225
+# scanf m modifier
+BuildRequires:	glibc-devel >= 6:2.7
 BuildRequires:	gnutls-devel
 BuildRequires:	libjpeg-devel
 BuildRequires:	libstdc++-devel
 BuildRequires:	libx264-devel
 BuildRequires:	mysql-devel
+BuildRequires:	openssl-devel
 BuildRequires:	pcre-devel
 BuildRequires:	perl-DBD-mysql
 BuildRequires:	perl-DBI
 BuildRequires:	perl-Date-Manip
-BuildRequires:	perl-Device-SerialPort
-BuildRequires:	perl-Expect
-BuildRequires:	perl-Net-SFTP
-BuildRequires:	perl-Net-SFTP-Foreign
-BuildRequires:	perl-PHP-Serialization
 BuildRequires:	perl-Sys-Mmap
-BuildRequires:	perl-devel
+BuildRequires:	perl-devel >= 1:5.6.0
 BuildRequires:	perl-libwww
+BuildRequires:	pkgconfig
 BuildRequires:	polkit-devel
 BuildRequires:	rpmbuild(macros) >= 1.268
 BuildRequires:	vlc-devel
@@ -59,11 +59,6 @@ BuildRequires:	zlib-devel
 Requires(post,preun):	/sbin/chkconfig
 Requires:	perl-DBD-mysql
 Requires:	perl-Date-Manip
-Requires:	perl-Device-SerialPort
-Requires:	perl-Expect
-Requires:	perl-MIME-tools
-Requires:	perl-Net-SFTP
-Requires:	perl-Net-SFTP-Foreign
 Requires:	perl-PHP-Serialization
 Requires:	perl-Sys-Mmap
 Requires:	php(mysql)
@@ -72,7 +67,21 @@ Requires:	rc-scripts
 Requires:	webapps
 Requires:	webserver(php)
 Suggests:	cambozola
+Suggests:	perl-Archive-Zip
+# for RS232/RS486 PTZ cameras
+Suggests:	perl-Device-SerialPort
+# for sftp event uploading
+Suggests:	perl-Expect
+# for event mail notification
+Suggests:	perl-MIME-tools
 Suggests:	perl-MIME-Lite
+# for sftp event uploading
+Suggests:	perl-Net-SFTP
+Suggests:	perl-Net-SFTP-Foreign
+# for PTZ cameras
+Suggests:	perl-Module-Load
+# for X.10 support (TODO)
+#Suggests:	perl-X10
 Obsoletes:	zm
 Obsoletes:	zm-X10
 Obsoletes:	zm-control
@@ -113,6 +122,7 @@ cd ..
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 
 sed -i -e 's#-frepo##g' src/Makefile.am
 sed -i -e 's#chown#true#g' -e 's#chmod#true#g' *.am */*.am */*/*.am
@@ -125,8 +135,8 @@ GRANT SELECT,INSERT,UPDATE,DELETE ON zm.* TO 'zmuser'@localhost IDENTIFIED BY 'z
 EOF
 
 install -d jscalendar-doc
-mv jscalendar-[0-9]*/{*html,*php,doc/*,README} jscalendar-doc
-rm -rf jscalendar-[0-9]*/doc
+%{__mv} jscalendar-[0-9]*/{*html,*php,doc/*,README} jscalendar-doc
+%{__rm} -r jscalendar-[0-9]*/doc
 
 %build
 %{__autoheader}
@@ -141,10 +151,10 @@ rm -rf jscalendar-[0-9]*/doc
 	--enable-mmap=yes \
 	--disable-debug \
 	--with-mysql=%{_prefix} \
-	--with-ffmpeg		\
-	--with-webgroup=http	\
-	--with-webuser=http		 \
-	--with-webdir=%{_appdir}/www	\
+	--with-ffmpeg \
+	--with-webgroup=http \
+	--with-webuser=http \
+	--with-webdir=%{_appdir}/www \
 	--with-cgidir=%{_libdir}/%{name}/cgi-bin
 
 %{__make}
@@ -164,9 +174,9 @@ install -d $RPM_BUILD_ROOT{%{_localstatedir}/{run,log/zoneminder},/etc/logrotate
 	DESTDIR=$RPM_BUILD_ROOT \
 	INSTALLDIRS=vendor
 
-rm -rf $RPM_BUILD_ROOT%{_prefix}/%{_lib}/perl5/vendor_perl/*.*/*-*
-rm -rf $RPM_BUILD_ROOT%{_prefix}/%{_lib}/perl5/*.*/*-*
-rm -f $RPM_BUILD_ROOT%{_bindir}/zmx10.pl
+%{__rm} -r $RPM_BUILD_ROOT%{_prefix}/%{_lib}/perl5/vendor_perl/*.*/*-*
+%{__rm} -r $RPM_BUILD_ROOT%{_prefix}/%{_lib}/perl5/*.*/*-*
+%{__rm} $RPM_BUILD_ROOT%{_bindir}/zmx10.pl
 
 install -m 755 -d $RPM_BUILD_ROOT%{_localstatedir}/log/zoneminder
 for dir in events images temp
@@ -272,5 +282,5 @@ exit 0
 %dir %attr(770,root,http) /var/lib/zoneminder/temp
 
 %{perl_vendorlib}/ZoneMinder
-%{perl_vendorlib}/*.pm
-%{_mandir}/man3/ZoneMinder*3pm*
+%{perl_vendorlib}/ZoneMinder.pm
+%{_mandir}/man3/ZoneMinder*.3pm*
diff --git a/zoneminder-build.patch b/zoneminder-build.patch
index e8a0868..1aca604 100644
--- a/zoneminder-build.patch
+++ b/zoneminder-build.patch
@@ -19,3 +19,109 @@
          {
              for ( my $i = 0; $i < @{$filter_expr->{terms}}; $i++ )
              {
+--- ZoneMinder-1.28.0/src/zm_image.cpp.orig	2014-10-18 22:23:13.000000000 +0200
++++ ZoneMinder-1.28.0/src/zm_image.cpp	2017-04-14 18:25:49.847052104 +0200
+@@ -1668,7 +1668,7 @@ const Coord Image::centreCoord( const ch
+         line = text+index;
+         line_no++;
+     }
+-    int x = (width - (max_line_len * CHAR_WIDTH) ) / 2;
++    int x = (width - (max_line_len * ZM_CHAR_WIDTH) ) / 2;
+     int y = (height - (line_no * LINE_HEIGHT) ) / 2;
+     return( Coord( x, y ) );
+ }
+@@ -1701,7 +1701,7 @@ void Image::Annotate( const char *p_text
+     while ( (index < text_len) && (line_len = strcspn( line, "\n" )) )
+     {
+ 
+-        unsigned int line_width = line_len * CHAR_WIDTH;
++        unsigned int line_width = line_len * ZM_CHAR_WIDTH;
+ 
+         unsigned int lo_line_x = coord.X();
+         unsigned int lo_line_y = coord.Y() + (line_no * LINE_HEIGHT);
+@@ -1732,13 +1732,13 @@ void Image::Annotate( const char *p_text
+         if ( colours == ZM_COLOUR_GRAY8 )
+         {
+             unsigned char *ptr = &buffer[(lo_line_y*width)+lo_line_x];
+-            for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < CHAR_HEIGHT; y++, r++, ptr += width )
++            for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < ZM_CHAR_HEIGHT; y++, r++, ptr += width )
+             {
+                 unsigned char *temp_ptr = ptr;
+                 for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
+                 {
+-                    int f = fontdata[(line[c] * CHAR_HEIGHT) + r];
+-                    for ( unsigned int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr++ )
++                    int f = fontdata[(line[c] * ZM_CHAR_HEIGHT) + r];
++                    for ( unsigned int i = 0; i < ZM_CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr++ )
+                     {
+                         if ( f & (0x80 >> i) )
+                         {
+@@ -1758,13 +1758,13 @@ void Image::Annotate( const char *p_text
+             unsigned int wc = width * colours;
+ 
+             unsigned char *ptr = &buffer[((lo_line_y*width)+lo_line_x)*colours];
+-            for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < CHAR_HEIGHT; y++, r++, ptr += wc )
++            for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < ZM_CHAR_HEIGHT; y++, r++, ptr += wc )
+             {
+                 unsigned char *temp_ptr = ptr;
+                 for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
+                 {
+-                    int f = fontdata[(line[c] * CHAR_HEIGHT) + r];
+-                    for ( unsigned int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr += colours )
++                    int f = fontdata[(line[c] * ZM_CHAR_HEIGHT) + r];
++                    for ( unsigned int i = 0; i < ZM_CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr += colours )
+                     {
+                         if ( f & (0x80 >> i) )
+                         {
+@@ -1790,13 +1790,13 @@ void Image::Annotate( const char *p_text
+             unsigned int wc = width * colours;
+ 
+             uint8_t *ptr = &buffer[((lo_line_y*width)+lo_line_x)<<2];
+-            for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < CHAR_HEIGHT; y++, r++, ptr += wc )
++            for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < ZM_CHAR_HEIGHT; y++, r++, ptr += wc )
+             {
+                 Rgb* temp_ptr = (Rgb*)ptr;
+                 for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
+                 {
+-                    int f = fontdata[(line[c] * CHAR_HEIGHT) + r];
+-                    for ( unsigned int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr++ )
++                    int f = fontdata[(line[c] * ZM_CHAR_HEIGHT) + r];
++                    for ( unsigned int i = 0; i < ZM_CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr++ )
+                     {
+                         if ( f & (0x80 >> i) )
+                         {
+--- ZoneMinder-1.28.0/src/zm_image.h.orig	2014-10-18 22:23:13.000000000 +0200
++++ ZoneMinder-1.28.0/src/zm_image.h	2017-04-14 18:25:49.817050635 +0200
+@@ -122,8 +122,8 @@ protected:
+ 	}
+ 
+ public:
+-	enum { CHAR_HEIGHT=11, CHAR_WIDTH=6 };
+-	enum { LINE_HEIGHT=CHAR_HEIGHT+0 };
++	enum { ZM_CHAR_HEIGHT=11, ZM_CHAR_WIDTH=6 };
++	enum { LINE_HEIGHT=ZM_CHAR_HEIGHT+0 };
+ 
+ protected:
+ 	static bool initialised;
+--- ZoneMinder-1.28.0/src/zm_rtp_ctrl.cpp.orig	2014-10-18 22:23:13.000000000 +0200
++++ ZoneMinder-1.28.0/src/zm_rtp_ctrl.cpp	2017-04-14 20:21:02.697466199 +0200
+@@ -220,7 +220,7 @@ int RtpCtrlThread::generateBye( const un
+ {
+     RtcpPacket *rtcpPacket = (RtcpPacket *)packet;
+ 
+-    int byteLen = sizeof(rtcpPacket->header)+sizeof(rtcpPacket->body.bye)+sizeof(rtcpPacket->body.bye.srcN[0]);
++    int byteLen = sizeof(rtcpPacket->header)+sizeof(rtcpPacket->body.bye);
+     int wordLen = ((byteLen-1)/sizeof(uint32_t))+1;
+ 
+     rtcpPacket->header.version = RTP_VERSION;
+--- ZoneMinder-1.28.0/src/zm_rtp_ctrl.h.orig	2014-10-18 22:23:13.000000000 +0200
++++ ZoneMinder-1.28.0/src/zm_rtp_ctrl.h	2017-04-14 20:18:37.863663657 +0200
+@@ -125,7 +125,7 @@ private:
+             // BYE
+             struct Bye
+             {
+-                uint32_t srcN[];     // list of sources
++                uint32_t srcN[1];     // list of sources
+                 // can't express trailing text for reason (what does this mean? it's not even english!)
+             } bye;
+          } body;
diff --git a/zoneminder-types.patch b/zoneminder-types.patch
new file mode 100644
index 0000000..e06fdc3
--- /dev/null
+++ b/zoneminder-types.patch
@@ -0,0 +1,187 @@
+--- ZoneMinder-1.28.0/src/zm_buffer.h.orig	2014-10-18 22:23:13.000000000 +0200
++++ ZoneMinder-1.28.0/src/zm_buffer.h	2017-04-14 21:31:30.662591552 +0200
+@@ -145,7 +145,7 @@
+     {
+         return( append( buffer.mHead, buffer.mSize ) );
+     }
+-    void tidy( bool level=0 )
++    void tidy( int level=0 )
+     {
+         if ( mHead != mStorage )
+         {
+--- ZoneMinder-1.28.0/src/zm_rtsp.cpp.orig	2014-10-18 22:23:13.000000000 +0200
++++ ZoneMinder-1.28.0/src/zm_rtsp.cpp	2017-04-14 21:45:07.582828745 +0200
+@@ -464,7 +464,7 @@
+ 
+     for ( size_t i = 0; i < lines.size(); i++ )
+     {
+-        sscanf( lines[i].c_str(), "Session: %a[0-9a-fA-F]; timeout=%d", &session, &timeout );
++        sscanf( lines[i].c_str(), "Session: %m[0-9a-fA-F]; timeout=%d", &session, &timeout );
+         sscanf( lines[i].c_str(), "Transport: %s", transport );
+     }
+ 
+@@ -542,7 +542,7 @@
+     char *rtpInfo = 0;
+     for ( size_t i = 0; i < lines.size(); i++ )
+     {
+-        sscanf( lines[i].c_str(), "RTP-Info: %as", &rtpInfo );
++        sscanf( lines[i].c_str(), "RTP-Info: %ms", &rtpInfo );
+     }
+ 
+     if ( !rtpInfo )
+--- ZoneMinder-1.28.0/xlib_shm-0.6.3/xlib_shm.c.orig	2017-04-14 21:16:44.882261246 +0200
++++ ZoneMinder-1.28.0/xlib_shm-0.6.3/xlib_shm.c	2017-04-14 21:48:04.331529494 +0200
+@@ -55,6 +55,7 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <X11/Xlib.h>
++#include <X11/Xutil.h>
+ #include <stdbool.h>
+ #include <math.h>
+ #include <sys/shm.h>
+@@ -472,7 +473,7 @@
+     free(password);
+     free(database);
+     
+-    fprintf(stdout,"imgx=%d imgy=%d\ndelay=%d\nshmkey=%x\n",imgx,imgy,delay,shm_key);
++    fprintf(stdout,"imgx=%d imgy=%d\ndelay=%ld\nshmkey=%llx\n",imgx,imgy,delay,shm_key);
+     fprintf(stdout,"monitors:");
+     cam=0;
+     while(cam<cam_num)
+--- ZoneMinder-1.28.0/src/zm_logger.cpp.orig	2014-10-18 22:23:13.000000000 +0200
++++ ZoneMinder-1.28.0/src/zm_logger.cpp	2017-04-14 22:39:58.317336882 +0200
+@@ -509,7 +509,7 @@
+     #endif
+             char *timePtr = timeString;
+             timePtr += strftime( timePtr, sizeof(timeString), "%x %H:%M:%S", localtime(&timeVal.tv_sec) );
+-            snprintf( timePtr, sizeof(timeString)-(timePtr-timeString), ".%06ld", timeVal.tv_usec );
++            snprintf( timePtr, sizeof(timeString)-(timePtr-timeString), ".%06ld", (long)timeVal.tv_usec );
+     #if 0
+         }
+     #endif
+@@ -569,7 +569,7 @@
+             char escapedString[(strlen(syslogStart)*2)+1];
+ 
+             mysql_real_escape_string( &mDbConnection, escapedString, syslogStart, strlen(syslogStart) );
+-            snprintf( sql, sizeof(sql), "insert into Logs ( TimeKey, Component, Pid, Level, Code, Message, File, Line ) values ( %ld.%06ld, '%s', %d, %d, '%s', '%s', '%s', %d )", timeVal.tv_sec, timeVal.tv_usec, mId.c_str(), tid, level, classString, escapedString, file, line );
++            snprintf( sql, sizeof(sql), "insert into Logs ( TimeKey, Component, Pid, Level, Code, Message, File, Line ) values ( %lld.%06ld, '%s', %d, %d, '%s', '%s', '%s', %d )", (long long)timeVal.tv_sec, (long)timeVal.tv_usec, mId.c_str(), tid, level, classString, escapedString, file, line );
+             if ( mysql_query( &mDbConnection, sql ) )
+             {
+                 databaseLevel( NOLOG );
+--- ZoneMinder-1.28.0/src/zm_event.cpp.orig	2014-10-18 22:23:13.000000000 +0200
++++ ZoneMinder-1.28.0/src/zm_event.cpp	2017-04-14 22:44:18.196788194 +0200
+@@ -74,7 +74,7 @@
+     static char sql[ZM_SQL_MED_BUFSIZ];
+ 
+     struct tm *stime = localtime( &start_time.tv_sec );
+-    snprintf( sql, sizeof(sql), "insert into Events ( MonitorId, Name, StartTime, Width, Height, Cause, Notes ) values ( %d, 'New Event', from_unixtime( %ld ), %d, %d, '%s', '%s' )", monitor->Id(), start_time.tv_sec, monitor->Width(), monitor->Height(), cause.c_str(), notes.c_str() );
++    snprintf( sql, sizeof(sql), "insert into Events ( MonitorId, Name, StartTime, Width, Height, Cause, Notes ) values ( %d, 'New Event', from_unixtime( %lld ), %d, %d, '%s', '%s' )", monitor->Id(), (long long)start_time.tv_sec, monitor->Width(), monitor->Height(), cause.c_str(), notes.c_str() );
+     if ( mysql_query( &dbconn, sql ) )
+     {
+         Error( "Can't insert event: %s", mysql_error( &dbconn ) );
+@@ -172,7 +172,7 @@
+ 
+         Debug( 1, "Adding closing frame %d to DB", frames );
+         static char sql[ZM_SQL_SML_BUFSIZ];
+-        snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, TimeStamp, Delta ) values ( %d, %d, from_unixtime( %ld ), %s%ld.%02ld )", id, frames, end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
++        snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, TimeStamp, Delta ) values ( %d, %d, from_unixtime( %lld ), %s%ld.%02ld )", id, frames, (long long) end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
+         if ( mysql_query( &dbconn, sql ) )
+         {
+             Error( "Can't insert frame: %s", mysql_error( &dbconn ) );
+@@ -185,7 +185,7 @@
+     struct DeltaTimeval delta_time;
+     DELTA_TIMEVAL( delta_time, end_time, start_time, DT_PREC_2 );
+ 
+-    snprintf( sql, sizeof(sql), "update Events set Name='%s%d', EndTime = from_unixtime( %ld ), Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", monitor->EventPrefix(), id, end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, id );
++    snprintf( sql, sizeof(sql), "update Events set Name='%s%d', EndTime = from_unixtime( %lld ), Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", monitor->EventPrefix(), id, (long long) end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, id );
+     if ( mysql_query( &dbconn, sql ) )
+     {
+         Error( "Can't update event: %s", mysql_error( &dbconn ) );
+@@ -520,7 +520,7 @@
+         DELTA_TIMEVAL( delta_time, *(timestamps[i]), start_time, DT_PREC_2 );
+ 
+         int sql_len = strlen(sql);
+-        snprintf( sql+sql_len, sizeof(sql)-sql_len, "( %d, %d, from_unixtime(%ld), %s%ld.%02ld ), ", id, frames, timestamps[i]->tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
++        snprintf( sql+sql_len, sizeof(sql)-sql_len, "( %d, %d, from_unixtime(%lld), %s%ld.%02ld ), ", id, frames, (long long)timestamps[i]->tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
+ 
+         frameCount++;
+     }
+@@ -569,7 +569,7 @@
+ 
+         Debug( 1, "Adding frame %d to DB", frames );
+         static char sql[ZM_SQL_MED_BUFSIZ];
+-        snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, Type, TimeStamp, Delta, Score ) values ( %d, %d, '%s', from_unixtime( %ld ), %s%ld.%02ld, %d )", id, frames, frame_type, timestamp.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, score );
++        snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, Type, TimeStamp, Delta, Score ) values ( %d, %d, '%s', from_unixtime( %lld ), %s%ld.%02ld, %d )", id, frames, frame_type, (long long)timestamp.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, score );
+         if ( mysql_query( &dbconn, sql ) )
+         {
+             Error( "Can't insert frame: %s", mysql_error( &dbconn ) );
+@@ -656,7 +656,7 @@
+ {
+     static char sql[ZM_SQL_SML_BUFSIZ];
+ 
+-    snprintf( sql, sizeof(sql), "select Id from Events where MonitorId = %d and unix_timestamp( EndTime ) > %ld order by Id asc limit 1", monitor_id, event_time );
++    snprintf( sql, sizeof(sql), "select Id from Events where MonitorId = %d and unix_timestamp( EndTime ) > %lld order by Id asc limit 1", monitor_id, (long long)event_time );
+ 
+     if ( mysql_query( &dbconn, sql ) )
+     {
+--- ZoneMinder-1.28.0/src/zm_monitor.cpp.orig	2014-10-18 22:23:13.000000000 +0200
++++ ZoneMinder-1.28.0/src/zm_monitor.cpp	2017-04-14 22:44:52.005118045 +0200
+@@ -2949,7 +2949,7 @@
+                         found_macro = true;
+                         break;
+                     case 'f' :
+-                        d_ptr += snprintf( d_ptr, sizeof(label_text)-(d_ptr-label_text), "%02ld", ts_time->tv_usec/10000 );
++                        d_ptr += snprintf( d_ptr, sizeof(label_text)-(d_ptr-label_text), "%02ld", (long)(ts_time->tv_usec/10000) );
+                         found_macro = true;
+                         break;
+                 }
+--- ZoneMinder-1.28.0/src/zmu.cpp.orig	2014-10-18 22:23:13.000000000 +0200
++++ ZoneMinder-1.28.0/src/zmu.cpp	2017-04-14 22:47:07.361776851 +0200
+@@ -444,14 +444,14 @@
+ 					if ( timestamp.tv_sec )
+ 						strftime( timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", localtime( &timestamp.tv_sec ) );
+ 					if ( image_idx == -1 )
+-						printf( "Time of last image capture: %s.%02ld\n", timestamp_str, timestamp.tv_usec/10000 );
++						printf( "Time of last image capture: %s.%02ld\n", timestamp_str, (long)(timestamp.tv_usec/10000) );
+ 					else
+-						printf( "Time of image %d capture: %s.%02ld\n", image_idx, timestamp_str, timestamp.tv_usec/10000 );
++						printf( "Time of image %d capture: %s.%02ld\n", image_idx, timestamp_str, (long)(timestamp.tv_usec/10000) );
+ 				}
+ 				else
+ 				{
+ 					if ( have_output ) printf( "%c", separator );
+-					printf( "%ld.%02ld", timestamp.tv_sec, timestamp.tv_usec/10000 );
++					printf( "%lld.%02ld", (long long)timestamp.tv_sec, (long)(timestamp.tv_usec/10000) );
+ 					have_output = true;
+ 				}
+ 			}
+@@ -718,12 +718,12 @@
+ 						if ( monitor )
+ 						{
+ 							struct timeval tv = monitor->GetTimestamp();
+-							printf( "%4d%5d%6d%9d%11ld.%02ld%6d%6d%8d%8.2f\n",
++							printf( "%4d%5d%6d%9d%11lld.%02ld%6d%6d%8d%8.2f\n",
+ 								monitor->Id(),
+ 								function,
+ 								monitor->GetState(),
+ 								monitor->GetTriggerState(),
+-								tv.tv_sec, tv.tv_usec/10000,
++								(long long)tv.tv_sec, (long)(tv.tv_usec/10000),
+ 								monitor->GetLastReadIndex(),
+ 								monitor->GetLastWriteIndex(),
+ 								monitor->GetLastEvent(),
+@@ -735,12 +735,12 @@
+ 					else
+ 					{
+ 						struct timeval tv = { 0, 0 };
+-						printf( "%4d%5d%6d%9d%11ld.%02ld%6d%6d%8d%8.2f\n",
++						printf( "%4d%5d%6d%9d%11lld.%02ld%6d%6d%8d%8.2f\n",
+ 							mon_id,
+ 							function,
+ 							0,
+ 							0,
+-							tv.tv_sec, tv.tv_usec/10000,
++							(long long)tv.tv_sec, (long)(tv.tv_usec/10000),
+ 							0,
+ 							0,
+ 							0,
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/zoneminder.git/commitdiff/708cf0df05bfdfc3f53c8179013841f84aac0e85



More information about the pld-cvs-commit mailing list