diff options
-rw-r--r-- | capinfos.c | 2 | ||||
-rw-r--r-- | editcap.c | 2 | ||||
-rw-r--r-- | epan/to_str.c | 4 | ||||
-rw-r--r-- | ui/gtk/summary_dlg.c | 2 | ||||
-rw-r--r-- | wiretap/k12text.l | 12 | ||||
-rw-r--r-- | wiretap/ngsniffer.c | 2 |
6 files changed, 14 insertions, 10 deletions
diff --git a/capinfos.c b/capinfos.c index a799be22bf..96d7de998a 100644 --- a/capinfos.c +++ b/capinfos.c @@ -395,7 +395,7 @@ time_string(time_t timer, capture_info *cf_info, gboolean want_lf) g_snprintf(time_string_buf, 20, "%lu%s", (unsigned long)timer, lf); return time_string_buf; } else { -#ifdef _MSC_VER +#if (defined _WIN32) && (_MSC_VER < 1500) /* calling localtime(), and thus ctime(), on MSVC 2005 with huge values causes it to crash */ /* XXX - find the exact value that still does work */ /* XXX - using _USE_32BIT_TIME_T might be another way to circumvent this problem */ @@ -149,7 +149,7 @@ abs_time_to_str_with_sec_resolution(const struct wtap_nstime *abs_time) struct tm *tmp; gchar *buf = g_malloc(16); -#ifdef _MSC_VER +#if (defined _WIN32) && (_MSC_VER < 1500) /* calling localtime() on MSVC 2005 with huge values causes it to crash */ /* XXX - find the exact value that still does work */ /* XXX - using _USE_32BIT_TIME_T might be another way to circumvent this problem */ diff --git a/epan/to_str.c b/epan/to_str.c index e25675647b..601b898548 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -571,7 +571,7 @@ abs_time_to_str(const nstime_t *abs_time, const absolute_time_display_e fmt, const char *zonename = "???"; gchar *buf = NULL; -#ifdef _MSC_VER +#if (defined _WIN32) && (_MSC_VER < 1500) /* calling localtime() on MSVC 2005 with huge values causes it to crash */ /* XXX - find the exact value that still does work */ /* XXX - using _USE_32BIT_TIME_T might be another way to circumvent this problem */ @@ -655,7 +655,7 @@ abs_time_secs_to_str(const time_t abs_time, const absolute_time_display_e fmt, const char *zonename = "???"; gchar *buf = NULL; -#ifdef _MSC_VER +#if (defined _WIN32) && (_MSC_VER < 1500) /* calling localtime() on MSVC 2005 with huge values causes it to crash */ /* XXX - find the exact value that still does work */ /* XXX - using _USE_32BIT_TIME_T might be another way to circumvent this problem */ diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c index 648663825d..078a3210eb 100644 --- a/ui/gtk/summary_dlg.c +++ b/ui/gtk/summary_dlg.c @@ -116,7 +116,7 @@ time_to_string(char *string_buff, gulong string_buff_size, time_t ti_time) { struct tm *ti_tm; -#ifdef _MSC_VER +#if (defined _WIN32) && (_MSC_VER < 1500) /* calling localtime() on MSVC 2005 with huge values causes it to crash */ /* XXX - find the exact value that still does work */ /* XXX - using _USE_32BIT_TIME_T might be another way to circumvent this problem */ diff --git a/wiretap/k12text.l b/wiretap/k12text.l index 13f197dfb1..71a74cb70c 100644 --- a/wiretap/k12text.l +++ b/wiretap/k12text.l @@ -375,6 +375,7 @@ k12text_dump(wtap_dumper *wdh _U_, const struct wtap_pkthdr *phdr, guint ns; guint ms; gboolean ret; + struct tm *tmp; str_enc = NULL; for(i=0; encaps[i].s; i++) { @@ -397,16 +398,19 @@ k12text_dump(wtap_dumper *wdh _U_, const struct wtap_pkthdr *phdr, ms = phdr->ts.nsecs / 1000000; ns = (phdr->ts.nsecs - (1000000*ms))/1000; -#ifdef _MSC_VER +#if (defined _WIN32) && (_MSC_VER < 1500) /* calling gmtime() on MSVC 2005 with huge values causes it to crash */ /* XXX - find the exact value that still does work */ /* XXX - using _USE_32BIT_TIME_T might be another way to circumvent this problem */ if (phdr->ts.secs > 2000000000) - g_snprintf(p, 90, "+---------+---------------+----------+\r\nXX:XX:XX,"); + tmp = NULL; else #endif - strftime(p, 90, "+---------+---------------+----------+\r\n%H:%M:%S,", - gmtime(&phdr->ts.secs)); + tmp = gmtime(&phdr->ts.secs); + if (tmp == NULL) + g_snprintf(p, 90, "+---------+---------------+----------+\r\nXX:XX:XX,"); + else + strftime(p, 90, "+---------+---------------+----------+\r\n%H:%M:%S,", tmp); wl = strlen(p); p += wl; left -= wl; diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index b0145565b2..a738c80a39 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -2127,7 +2127,7 @@ ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, date. */ if (ngsniffer->first_frame) { ngsniffer->first_frame=FALSE; -#ifdef _MSC_VER +#if (defined _WIN32) && (_MSC_VER < 1500) /* calling localtime() on MSVC 2005 with huge values causes it to crash */ /* XXX - find the exact value that still does work */ /* XXX - using _USE_32BIT_TIME_T might be another way to circumvent this problem */ |