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.
This commit is contained in:
Stig Bjørlykke 2022-08-24 09:51:10 +02:00 committed by Guy Harris
parent eba586040e
commit e0c302330b
4 changed files with 6 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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? */