aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2022-08-24 09:51:10 +0200
committerGuy Harris <gharris@sonic.net>2022-08-24 23:26:19 +0000
commite0c302330b48173a89b66e166719b9b1c3462b81 (patch)
tree0b115629af16969436659d236ee81b7fb5c75619 /wiretap
parenteba586040ebc1587ee59f161f52f11ae53c68686 (diff)
wiretap: Fix build on 32-bit Linux
Add WTAP_NSTIME_32BIT_SECS_MAX to define the maximum timestamp for some formats where this is not known.
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/5views.c2
-rw-r--r--wiretap/netxray.c4
-rw-r--r--wiretap/visual.c2
-rw-r--r--wiretap/wtap.h2
4 files changed, 6 insertions, 4 deletions
diff --git a/wiretap/5views.c b/wiretap/5views.c
index 9478f88cd3..5d51c1c8a7 100644
--- a/wiretap/5views.c
+++ b/wiretap/5views.c
@@ -391,7 +391,7 @@ static gboolean _5views_dump(wtap_dumper *wdh,
* we should check against G_MININT32 and G_MAXINT32 and make
* Utc a gint32.
*/
- if (rec->ts.secs < 0 || rec->ts.secs > G_MAXUINT32) {
+ if (rec->ts.secs < 0 || rec->ts.secs > WTAP_NSTIME_32BIT_SECS_MAX) {
*err = WTAP_ERR_TIME_STAMP_NOT_SUPPORTED;
return FALSE;
}
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index 9e1ed447e9..74f244c2f2 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -1812,7 +1812,7 @@ netxray_dump_1_1(wtap_dumper *wdh,
* G_MININT32 and G_MAXINT32 and make start_secs a
* gint32.
*/
- if (rec->ts.secs < 0 || rec->ts.secs > G_MAXUINT32) {
+ if (rec->ts.secs < 0 || rec->ts.secs > WTAP_NSTIME_32BIT_SECS_MAX) {
*err = WTAP_ERR_TIME_STAMP_NOT_SUPPORTED;
return FALSE;
}
@@ -2011,7 +2011,7 @@ netxray_dump_2_0(wtap_dumper *wdh,
* G_MININT32 and G_MAXINT32 and make start_secs a
* gint32.
*/
- if (rec->ts.secs < 0 || rec->ts.secs > G_MAXUINT32) {
+ if (rec->ts.secs < 0 || rec->ts.secs > WTAP_NSTIME_32BIT_SECS_MAX) {
*err = WTAP_ERR_TIME_STAMP_NOT_SUPPORTED;
return FALSE;
}
diff --git a/wiretap/visual.c b/wiretap/visual.c
index f0fa86ea33..4707c86bbe 100644
--- a/wiretap/visual.c
+++ b/wiretap/visual.c
@@ -685,7 +685,7 @@ static gboolean visual_dump(wtap_dumper *wdh, const wtap_rec *rec,
* in which case we should check against G_MININT32 and G_MAXINT32
* and make start_time a gint32.
*/
- if (rec->ts.secs < 0 || rec->ts.secs > G_MAXUINT32) {
+ if (rec->ts.secs < 0 || rec->ts.secs > WTAP_NSTIME_32BIT_SECS_MAX) {
*err = WTAP_ERR_TIME_STAMP_NOT_SUPPORTED;
return FALSE;
}
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 4f6354d710..739367f777 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -1338,6 +1338,8 @@ typedef struct {
#define BBLOG_TYPE_EVENT_BLOCK 1
#define BBLOG_TYPE_SKIPPED_BLOCK 2
+#define WTAP_NSTIME_32BIT_SECS_MAX ((time_t)(sizeof(time_t) > sizeof(gint32) ? G_MAXUINT32 : G_MAXINT32))
+
typedef struct {
guint rec_type; /* what type of record is this? */
guint32 presence_flags; /* what stuff do we have? */