pkgsrc-WIP-changes archive

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

zoneminder: Fix more time_t/suseconds_t/printf mismatches



Module Name:	pkgsrc-wip
Committed By:	Greg Troxel <gdt%lexort.com@localhost>
Pushed By:	gdt
Date:		Tue Sep 27 20:24:14 2022 -0400
Changeset:	d0e5dafa51f7064346998c818dbee73b80068137

Modified Files:
	zoneminder/distinfo
	zoneminder/patches/patch-src_zm_logger_cpp
	zoneminder/patches/patch-src_zmu.cpp
Added Files:
	zoneminder/patches/patch-src_zm__utils.cpp

Log Message:
zoneminder: Fix more time_t/suseconds_t/printf mismatches

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=d0e5dafa51f7064346998c818dbee73b80068137

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 zoneminder/distinfo                        |  5 +++--
 zoneminder/patches/patch-src_zm__utils.cpp | 15 +++++++++++++++
 zoneminder/patches/patch-src_zm_logger_cpp | 12 +++++++++---
 zoneminder/patches/patch-src_zmu.cpp       |  8 ++++----
 4 files changed, 31 insertions(+), 9 deletions(-)

diffs:
diff --git a/zoneminder/distinfo b/zoneminder/distinfo
index 7010ace4ad..d034864381 100644
--- a/zoneminder/distinfo
+++ b/zoneminder/distinfo
@@ -20,11 +20,12 @@ SHA1 (patch-src_zm__rtp__ctrl.h) = 4e0fd8e80932de8d77b3386a356cc026ddc23113
 SHA1 (patch-src_zm__rtp__source.cpp) = 2488ae3655f529a71d8b98fa29a9e0435bbdf182
 SHA1 (patch-src_zm__thread.h) = 03e7cce589b62b95676a72df0d6707816c477ffa
 SHA1 (patch-src_zm__timer.h) = 18ab09cd1ce92c80c43d34a2f2f8b9fe614bedeb
+SHA1 (patch-src_zm__utils.cpp) = d9244a1e3e9c67bbc89515fd6b79e6b98a18a069
 SHA1 (patch-src_zm_comms_cpp) = bd3c3e6dd4d11ea0845d2da662e99169cd6e6680
 SHA1 (patch-src_zm_comms_h) = e9e25dced4ad54aa118f153fbd3390d1eb525e65
-SHA1 (patch-src_zm_logger_cpp) = 79c604a7f85f03acb13e8bce1f4fe48d4cd98cca
+SHA1 (patch-src_zm_logger_cpp) = aed07139cd8adc11c7b43d4fefc24bc158b5617c
 SHA1 (patch-src_zm_remote_camera_h) = 87da3e6326df5f9ab3c98fed5c7c9bae20cd6dc5
 SHA1 (patch-src_zm_signal_cpp) = af9625702518648b8d62ed20d0d52c1a2a27841a
 SHA1 (patch-src_zm_thread_cpp) = 165a1e38eb76f5cfe72606b1071177e619d73fe6
 SHA1 (patch-src_zmc_cpp) = 1499eb3e2d92372a0dea036f22f429efeefe4d95
-SHA1 (patch-src_zmu.cpp) = a2ee3b7a96f427b3df58e434ca7b55b5258f653e
+SHA1 (patch-src_zmu.cpp) = 894f0e8941ca2d135d775001b96c0f780570aa2b
diff --git a/zoneminder/patches/patch-src_zm__utils.cpp b/zoneminder/patches/patch-src_zm__utils.cpp
new file mode 100644
index 0000000000..bd3784c0d9
--- /dev/null
+++ b/zoneminder/patches/patch-src_zm__utils.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Fix time types (sizes).
+
+--- src/zm_utils.cpp.orig	2018-12-08 14:22:36.000000000 +0000
++++ src/zm_utils.cpp
+@@ -397,7 +397,7 @@ char *timeval_to_string( struct timeval 
+   nowtime = tv.tv_sec;
+   nowtm = localtime(&nowtime);
+   strftime(tmbuf, sizeof tmbuf, "%Y-%m-%d %H:%M:%S", nowtm);
+-  snprintf(buf, sizeof buf, "%s.%06ld", tmbuf, tv.tv_usec);
++  snprintf(buf, sizeof buf, "%s.%06jd", tmbuf, (intmax_t) tv.tv_usec);
+   return buf;
+ }
+ 
diff --git a/zoneminder/patches/patch-src_zm_logger_cpp b/zoneminder/patches/patch-src_zm_logger_cpp
index 99c7c813c3..6d0561ccd1 100644
--- a/zoneminder/patches/patch-src_zm_logger_cpp
+++ b/zoneminder/patches/patch-src_zm_logger_cpp
@@ -11,7 +11,7 @@ Fix time types (sizes).
 
 --- src/zm_logger.cpp.orig	2018-12-08 14:22:36.000000000 +0000
 +++ src/zm_logger.cpp
-@@ -464,7 +464,7 @@ void Logger::logPrint( bool hex, const c
+@@ -464,12 +464,12 @@ void Logger::logPrint( bool hex, const c
  
      subtractTime( &timeVal, &logStart );
  
@@ -20,14 +20,20 @@ Fix time types (sizes).
    } else {
  #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), ".%06jd", (intmax_t) timeVal.tv_usec);
+ #if 0
+   }
+ #endif
 @@ -548,8 +548,8 @@ void Logger::logPrint( bool hex, const c
            "INSERT INTO Logs "
            "( TimeKey, Component, ServerId, Pid, Level, Code, Message, File, Line )"
           " VALUES "
 -         "( %ld.%06ld, '%s', %d, %d, %d, '%s', '%s', '%s', %d )",
 -         timeVal.tv_sec, timeVal.tv_usec, mId.c_str(), staticConfig.SERVER_ID, tid, level, classString, escapedString, file, line
-+         "( %jd.%06ld, '%s', %d, %d, %d, '%s', '%s', '%s', %d )",
-+         (intmax_t) timeVal.tv_sec, timeVal.tv_usec, mId.c_str(), staticConfig.SERVER_ID, tid, level, classString, escapedString, file, line
++         "( %jd.%06jd, '%s', %d, %d, %d, '%s', '%s', '%s', %d )",
++         (intmax_t) timeVal.tv_sec, (intmax_t) timeVal.tv_usec, mId.c_str(), staticConfig.SERVER_ID, tid, level, classString, escapedString, file, line
           );
        if ( mysql_query(&dbconn, sql) ) {
          Level tempDatabaseLevel = mDatabaseLevel;
diff --git a/zoneminder/patches/patch-src_zmu.cpp b/zoneminder/patches/patch-src_zmu.cpp
index ec6d24ad64..74a0dedbca 100644
--- a/zoneminder/patches/patch-src_zmu.cpp
+++ b/zoneminder/patches/patch-src_zmu.cpp
@@ -25,13 +25,13 @@ time types
              if ( monitor && monitor->connect() ) {
                struct timeval tv = monitor->GetTimestamp();
 -              printf( "%4d%5d%6d%9d%11ld.%02ld%6d%6d%8" PRIu64 "%8.2f\n",
-+              printf( "%4d%5d%6d%9d%11jd.%02ld%6d%6d%8" PRIu64 "%8.2f\n",
++              printf( "%4d%5d%6d%9d%11jd.%02jd%6d%6d%8" PRIu64 "%8.2f\n",
                  monitor->Id(),
                  function,
                  monitor->GetState(),
                  monitor->GetTriggerState(),
 -                tv.tv_sec, tv.tv_usec/10000,
-+                (intmax_t) tv.tv_sec, tv.tv_usec/10000,
++                (intmax_t) tv.tv_sec, (intmax_t) tv.tv_usec/10000,
                  monitor->GetLastReadIndex(),
                  monitor->GetLastWriteIndex(),
                  monitor->GetLastEventId(),
@@ -40,13 +40,13 @@ time types
            } 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",
++            printf( "%4d%5d%6d%9d%11jd.%02jd%6d%6d%8d%8.2f\n",
                mon_id,
                function,
                0,
                0,
 -              tv.tv_sec, tv.tv_usec/10000,
-+              (intmax_t) tv.tv_sec, tv.tv_usec/10000,
++              (intmax_t) tv.tv_sec, (intmax_t) tv.tv_usec/10000,
                0,
                0,
                0,


Home | Main Index | Thread Index | Old Index