From b94589b4975f3c512864735426c3b8aa1ed8126b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 2 Sep 2024 21:06:01 +0200 Subject: [PATCH] libdvbsub/Debug.cpp: Fix format warnings for __suseconds64_t in Debug.cpp - Added for correct format specifiers. - Used PRIdMAX for formatting __suseconds64_t in print function. - Updated sprintf call to handle __suseconds64_t correctly. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/a23f84104f5f1af6b38fc5d7ab3b192aafb312ff Author: Thilo Graf Date: 2024-09-02 (Mon, 02 Sep 2024) ------------------ This commit was generated by Migit --- lib/libdvbsub/Debug.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/libdvbsub/Debug.cpp b/lib/libdvbsub/Debug.cpp index c9fa291ba..07e73ae35 100644 --- a/lib/libdvbsub/Debug.cpp +++ b/lib/libdvbsub/Debug.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -42,13 +43,11 @@ void Debug::print(int level, const char *fmt, ...) if (level < level_) { gettimeofday(&tv, NULL); strftime(tbuf, sizeof(tbuf), "%H:%M:%S", localtime(&tv.tv_sec)); - len = sprintf(buf, "[ %s.%03ld ] ", tbuf, tv.tv_usec / 1000); + len = sprintf(buf, "[ %s.%03" PRIdMAX " ] ", tbuf, static_cast(tv.tv_usec / 1000)); va_start(argp, fmt); - //vfprintf(fp_, fmt, argp); - vsnprintf (&buf[len], 512, fmt, argp); + vsnprintf(&buf[len], sizeof(buf) - len, fmt, argp); va_end(argp); fprintf(fp_, "%s", buf); } } -