summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2025-06-12 07:28:55 +0200
committerGravatar Nikias Bassen2025-06-12 07:28:55 +0200
commit8b316af7539650e7ed8f913530d9a5473bf664ed (patch)
tree1fc5a0d3d439a9c2704f938a9a781806369e3805
parent9d26a1636ba684b600b5cfa0e96e7cb648501539 (diff)
downloadlibimobiledevice-8b316af7539650e7ed8f913530d9a5473bf664ed.tar.gz
libimobiledevice-8b316af7539650e7ed8f913530d9a5473bf664ed.tar.bz2
debug: Silence some compiler warnings
-rw-r--r--common/debug.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/common/debug.c b/common/debug.c
index 11aab00..7a593fc 100644
--- a/common/debug.c
+++ b/common/debug.c
@@ -30,6 +30,9 @@
30#include <stdint.h> 30#include <stdint.h>
31#include <stdlib.h> 31#include <stdlib.h>
32#include <time.h> 32#include <time.h>
33#ifndef _WIN32
34#include <sys/time.h>
35#endif
33 36
34#include "src/idevice.h" 37#include "src/idevice.h"
35#include "debug.h" 38#include "debug.h"
@@ -51,24 +54,24 @@ void internal_set_debug_level(int level)
51#ifndef STRIP_DEBUG_CODE 54#ifndef STRIP_DEBUG_CODE
52static void debug_print_line(const char *func, const char *file, int line, const char *buffer) 55static void debug_print_line(const char *func, const char *file, int line, const char *buffer)
53{ 56{
54 char str_time[16]; 57 char str_time[24];
55#ifdef _WIN32 58#ifdef _WIN32
56 SYSTEMTIME lt; 59 SYSTEMTIME lt;
57 GetLocalTime(&lt); 60 GetLocalTime(&lt);
58 snprintf(str_time, 13, "%02d:%02d:%02d.%03d", lt.wHour, lt.wMinute, lt.wSecond, lt.wMilliseconds); 61 snprintf(str_time, 24, "%02d:%02d:%02d.%03d", lt.wHour, lt.wMinute, lt.wSecond, lt.wMilliseconds);
59#else 62#else
60#ifdef HAVE_GETTIMEOFDAY 63#ifdef HAVE_GETTIMEOFDAY
61 struct timeval tv; 64 struct timeval tv;
62 struct tm tp_;
63 struct tm *tp; 65 struct tm *tp;
64 gettimeofday(&tv, NULL); 66 gettimeofday(&tv, NULL);
65#ifdef HAVE_LOCALTIME_R 67#ifdef HAVE_LOCALTIME_R
68 struct tm tp_;
66 tp = localtime_r(&tv.tv_sec, &tp_); 69 tp = localtime_r(&tv.tv_sec, &tp_);
67#else 70#else
68 tp = localtime(&tv.tv_sec); 71 tp = localtime(&tv.tv_sec);
69#endif 72#endif
70 strftime(str_time, 9, "%H:%M:%S", tp); 73 strftime(str_time, 9, "%H:%M:%S", tp);
71 snprintf(str_time+8, 5, ".%03d", (int)tv.tv_usec/1000); 74 snprintf(str_time+8, 10, ".%03d", (int)tv.tv_usec/1000);
72#else 75#else
73 time_t the_time; 76 time_t the_time;
74 time(&the_time); 77 time(&the_time);