pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/security/zoneminder zoneminder: adjust fix for printf/...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/dd8ee9ffc736
branches:  trunk
changeset: 382785:dd8ee9ffc736
user:      gdt <gdt%pkgsrc.org@localhost>
date:      Sat Jul 14 15:03:57 2018 +0000

description:
zoneminder: adjust fix for printf/time_t

Rather than casting to long, cast to intmax_t and print with %jd, as
suggested by joerg@.

diffstat:

 security/zoneminder/Makefile                              |   4 +-
 security/zoneminder/distinfo                              |  10 +++---
 security/zoneminder/patches/patch-src_zm__event.cpp       |  21 +++++++++---
 security/zoneminder/patches/patch-src_zm__rtp__source.cpp |   8 ++--
 security/zoneminder/patches/patch-src_zm_logger_cpp       |   4 +-
 security/zoneminder/patches/patch-src_zmu.cpp             |  24 +++++++++++---
 6 files changed, 46 insertions(+), 25 deletions(-)

diffs (212 lines):

diff -r 27ffd9b6828e -r dd8ee9ffc736 security/zoneminder/Makefile
--- a/security/zoneminder/Makefile      Sat Jul 14 15:03:42 2018 +0000
+++ b/security/zoneminder/Makefile      Sat Jul 14 15:03:57 2018 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.38 2018/07/13 02:05:11 gdt Exp $
+# $NetBSD: Makefile,v 1.39 2018/07/14 15:03:57 gdt Exp $
 
 PKGNAME=       ${DISTNAME:S/ZoneMinder-/zoneminder-/}
 DISTNAME=      ZoneMinder-1.28.1
-PKGREVISION=   16
+PKGREVISION=   17
 CATEGORIES=    security
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=ZoneMinder/}
 GITHUB_PROJECT=        ZoneMinder
diff -r 27ffd9b6828e -r dd8ee9ffc736 security/zoneminder/distinfo
--- a/security/zoneminder/distinfo      Sat Jul 14 15:03:42 2018 +0000
+++ b/security/zoneminder/distinfo      Sat Jul 14 15:03:57 2018 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.11 2018/07/13 02:05:11 gdt Exp $
+$NetBSD: distinfo,v 1.12 2018/07/14 15:03:57 gdt Exp $
 
 SHA1 (ZoneMinder-1.28.1.tar.gz) = 3e173ae1aac529b60d79a5fc668c107f0679d0a2
 RMD160 (ZoneMinder-1.28.1.tar.gz) = b3cc305656cb5b73d4ac0e21fe937c237467cdd1
@@ -9,9 +9,9 @@
 SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm) = 841d897662958698a4dfcb95dd5bc43bb5fed568
 SHA1 (patch-scripts_zm_in) = 8f59085bb9293afa7aeb268000c75988e5371c66
 SHA1 (patch-src_Makefile_am) = 0f6571c9d5a3e688544f93d687d266e1b71f0f43
-SHA1 (patch-src_zm__event.cpp) = 2db5a2f85039e711ab6a18af816e0269611fc5f2
+SHA1 (patch-src_zm__event.cpp) = 5258e89486b1152f0ddcac9b0a6fd68b70f24256
 SHA1 (patch-src_zm__monitor.cpp) = dcc3816686a6a7c375d4716d3663b4c922c90439
-SHA1 (patch-src_zm__rtp__source.cpp) = eecca36c18a6611745c49686499a16df177abc7f
+SHA1 (patch-src_zm__rtp__source.cpp) = 5341938eefe5def49dc8f3e3b760d86cabd17772
 SHA1 (patch-src_zm__sdp.cpp) = ed89bc14ae557281bb43baca9c90b78d801d8eb1
 SHA1 (patch-src_zm__thread.h) = 67dbd1e9c19df63fd120344cc8a36d663a724409
 SHA1 (patch-src_zm__timer.h) = 38080d08b5834e3dae713e81488944887ce5848b
@@ -20,12 +20,12 @@
 SHA1 (patch-src_zm_comms_cpp) = d40932a3d0ae4375a649f200d973995d56aa71c7
 SHA1 (patch-src_zm_comms_h) = baeb73040ff3ba862f23ad6301de7daba182456e
 SHA1 (patch-src_zm_ffmpeg_camera_cpp) = 6ead5f9afbe984aab14fee337093fd0269c6e9d8
-SHA1 (patch-src_zm_logger_cpp) = 6e0124756ef6fe58fb452651337d622ddff6c4ab
+SHA1 (patch-src_zm_logger_cpp) = c4d33648d28962fb0e211277caa8c5b1f829538a
 SHA1 (patch-src_zm_remote_camera_h) = 0d4bd7dae0188df7e463586250ac2ed530230f3d
 SHA1 (patch-src_zm_signal_cpp) = fa11938f55ccd50a1a9e949d6b58dd07773f2690
 SHA1 (patch-src_zm_thread_cpp) = c5f64697c3024c6c382f9ae2c5dbe9c21b529b6e
 SHA1 (patch-src_zmc_cpp) = d1046ddfad3a88bdd30501237834ec9e9fbc4c83
 SHA1 (patch-src_zmf.cpp) = a059b9ae068037c6f68c16dab861ed830dd1c7e2
-SHA1 (patch-src_zmu.cpp) = a95e81285167fc8df77bc059c7b7f09cc36ff922
+SHA1 (patch-src_zmu.cpp) = c83283c1ac38e7c39201f72099b9830d84566c41
 SHA1 (patch-web_Makefile.am) = ddb3815fa1b1799658034789302c8d3840f2b894
 SHA1 (patch-web_ajax_stream_php) = e8f811e63bedec03345b74db72c3d8014b3cc7f6
diff -r 27ffd9b6828e -r dd8ee9ffc736 security/zoneminder/patches/patch-src_zm__event.cpp
--- a/security/zoneminder/patches/patch-src_zm__event.cpp       Sat Jul 14 15:03:42 2018 +0000
+++ b/security/zoneminder/patches/patch-src_zm__event.cpp       Sat Jul 14 15:03:57 2018 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_zm__event.cpp,v 1.1 2018/07/13 02:05:11 gdt Exp $
+$NetBSD: patch-src_zm__event.cpp,v 1.2 2018/07/14 15:03:57 gdt Exp $
 
 zoneminder uses %ld for time_t, which is troublesome on NetBSD mrm and
 presumably i386.  (Note that there are multiple patch files for the
@@ -15,7 +15,7 @@
  
      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( %ld ), %d, %d, '%s', '%s' )", monitor->Id(), 
(long) 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( %jd ), %d, %d, '%s', '%s' )", monitor->Id(), 
(intmax_t) 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 ) );
@@ -24,7 +24,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( %ld ), %s%ld.%02ld )", id, frames, (long) 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( %jd ), %s%ld.%02ld )", id, frames, (intmax_t) 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 ) );
@@ -33,7 +33,7 @@
      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( %ld ), Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d 
where Id = %d", monitor->EventPrefix(), id, (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 );
++    snprintf( sql, sizeof(sql), "update Events set Name='%s%d', EndTime = from_unixtime( %jd ), Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d 
where Id = %d", monitor->EventPrefix(), id, (intmax_t) 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 ) );
@@ -42,7 +42,7 @@
  
          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(%ld), %s%ld.%02ld ), ", id, frames, (long) 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( %jd ), %s%ld.%02ld ), ", id, frames, (intmax_t) timestamps[i]->tv_sec, delta_time.positive?"":"-", delta_time.sec, 
delta_time.fsec );
  
          frameCount++;
      }
@@ -51,7 +51,16 @@
          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( %ld ), %s%ld.%02ld, %d )", id, frames, frame_type, 
(long) 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( %jd ), %s%ld.%02ld, %d )", id, frames, frame_type, 
(intmax_t) 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 @@ bool EventStream::loadInitialEventData( 
+ {
+     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 ) > %jd order by Id asc limit 1", monitor_id, (intmax_t) event_time );
+ 
+     if ( mysql_query( &dbconn, sql ) )
+     {
diff -r 27ffd9b6828e -r dd8ee9ffc736 security/zoneminder/patches/patch-src_zm__rtp__source.cpp
--- a/security/zoneminder/patches/patch-src_zm__rtp__source.cpp Sat Jul 14 15:03:42 2018 +0000
+++ b/security/zoneminder/patches/patch-src_zm__rtp__source.cpp Sat Jul 14 15:03:57 2018 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_zm__rtp__source.cpp,v 1.1 2018/07/13 02:05:11 gdt Exp $
+$NetBSD: patch-src_zm__rtp__source.cpp,v 1.2 2018/07/14 15:03:57 gdt Exp $
 
 --- src/zm_rtp_source.cpp.orig 2015-02-05 02:52:37.000000000 +0000
 +++ src/zm_rtp_source.cpp
@@ -7,7 +7,7 @@
      struct timeval ntpTime = tvMake( ntpTimeSecs, suseconds_t((USEC_PER_SEC*(ntpTimeFrac>>16))/(1<<16)) );
  
 -    Debug( 5, "ntpTime: %ld.%06ld, rtpTime: %x", ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
-+    Debug( 5, "ntpTime: %ld.%06ld, rtpTime: %x", (long) ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
++    Debug( 5, "ntpTime: %jd.%06ld, rtpTime: %x", (intmax_t) ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
                                                       
      if ( mBaseTimeNtp.tv_sec == 0 )
      {
@@ -17,8 +17,8 @@
      {
 -        Debug( 5, "lastSrNtpTime: %ld.%06ld, rtpTime: %x", mLastSrTimeNtp.tv_sec, mLastSrTimeNtp.tv_usec, rtpTime );
 -        Debug( 5, "ntpTime: %ld.%06ld, rtpTime: %x", ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
-+      Debug( 5, "lastSrNtpTime: %ld.%06ld, rtpTime: %x", (long) mLastSrTimeNtp.tv_sec, mLastSrTimeNtp.tv_usec, rtpTime );
-+        Debug( 5, "ntpTime: %ld.%06ld, rtpTime: %x", (long) ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
++      Debug( 5, "lastSrNtpTime: %jd.%06ld, rtpTime: %x", (intmax_t) mLastSrTimeNtp.tv_sec, mLastSrTimeNtp.tv_usec, rtpTime );
++        Debug( 5, "ntpTime: %jd.%06ld, rtpTime: %x", (intmax_t) ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
  
          double diffNtpTime = tvDiffSec( mBaseTimeNtp, ntpTime );
          uint32_t diffRtpTime = rtpTime - mBaseTimeRtp;
diff -r 27ffd9b6828e -r dd8ee9ffc736 security/zoneminder/patches/patch-src_zm_logger_cpp
--- a/security/zoneminder/patches/patch-src_zm_logger_cpp       Sat Jul 14 15:03:42 2018 +0000
+++ b/security/zoneminder/patches/patch-src_zm_logger_cpp       Sat Jul 14 15:03:57 2018 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_zm_logger_cpp,v 1.4 2018/07/13 02:05:11 gdt Exp $
+$NetBSD: patch-src_zm_logger_cpp,v 1.5 2018/07/14 15:03:57 gdt Exp $
 
 If the system has syscall() but not SYS_gettid [E.g. NetBSD], don't attempt
 to use SYS_gettid.
@@ -27,7 +27,7 @@
  
              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 ( %ld.%06ld, '%s', %d, %d, '%s', '%s', '%s', %d )", (long) 
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 ( %jd.%06ld, '%s', %d, %d, '%s', '%s', '%s', %d )", (intmax_t) 
timeVal.tv_sec, timeVal.tv_usec, mId.c_str(), tid, level, classString, escapedString, file, line );
              if ( mysql_query( &mDbConnection, sql ) )
              {
                  databaseLevel( NOLOG );
diff -r 27ffd9b6828e -r dd8ee9ffc736 security/zoneminder/patches/patch-src_zmu.cpp
--- a/security/zoneminder/patches/patch-src_zmu.cpp     Sat Jul 14 15:03:42 2018 +0000
+++ b/security/zoneminder/patches/patch-src_zmu.cpp     Sat Jul 14 15:03:57 2018 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_zmu.cpp,v 1.1 2018/07/13 02:05:11 gdt Exp $
+$NetBSD: patch-src_zmu.cpp,v 1.2 2018/07/14 15:03:57 gdt Exp $
 
 --- src/zmu.cpp.orig   2015-02-05 02:52:37.000000000 +0000
 +++ src/zmu.cpp
@@ -7,25 +7,37 @@
                                {
                                        if ( have_output ) printf( "%c", separator );
 -                                      printf( "%ld.%02ld", timestamp.tv_sec, timestamp.tv_usec/10000 );
-+                                      printf( "%ld.%02ld", (long) timestamp.tv_sec, timestamp.tv_usec/10000 );
++                                      printf( "%jd.%02ld", (intmax_t) timestamp.tv_sec, timestamp.tv_usec/10000 );
                                        have_output = true;
                                }
                        }
-@@ -729,7 +729,7 @@ int main( int argc, char *argv[] )
+@@ -724,12 +724,12 @@ int main( int argc, char *argv[] )
+                                               if ( monitor && monitor->connect() )
+                                               {
+                                                       struct timeval tv = monitor->GetTimestamp();
+-                                                      printf( "%4d%5d%6d%9d%11ld.%02ld%6d%6d%8d%8.2f\n",
++                                                      printf( "%4d%5d%6d%9d%11jd.%02ld%6d%6d%8d%8.2f\n",
+                                                               monitor->Id(),
                                                                function,
                                                                monitor->GetState(),
                                                                monitor->GetTriggerState(),
 -                                                              tv.tv_sec, tv.tv_usec/10000,
-+                                                              (long) tv.tv_sec, tv.tv_usec/10000,
++                                                              (intmax_t) tv.tv_sec, tv.tv_usec/10000,
                                                                monitor->GetLastReadIndex(),
                                                                monitor->GetLastWriteIndex(),
                                                                monitor->GetLastEvent(),
-@@ -746,7 +746,7 @@ int main( int argc, char *argv[] )
+@@ -741,12 +741,12 @@ int main( int argc, char *argv[] )
+                                       else
+                                       {
+                                               struct timeval tv = { 0, 0 };
+-                                              printf( "%4d%5d%6d%9d%11ld.%02ld%6d%6d%8d%8.2f\n",
++                                              printf( "%4d%5d%6d%9d%11jd.%02ld%6d%6d%8d%8.2f\n",
+                                                       mon_id,
                                                        function,
                                                        0,
                                                        0,
 -                                                      tv.tv_sec, tv.tv_usec/10000,
-+                                                      (long) tv.tv_sec, tv.tv_usec/10000,
++                                                      (intmax_t) tv.tv_sec, tv.tv_usec/10000,
                                                        0,
                                                        0,
                                                        0,



Home | Main Index | Thread Index | Old Index