From 3c5f412861c8c5efe776b5973f8765e0c81cf62f Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Wed, 15 Feb 2023 17:45:36 +0100 Subject: [PATCH] Don't check if unsigned expressions are less than zero Signed-off-by: Sebastien GODARD --- common.c | 2 +- sa_common.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common.c b/common.c index 0fc81bb..f3a88b4 100644 --- a/common.c +++ b/common.c @@ -999,7 +999,7 @@ char *get_persistent_name_from_pretty(char *pretty) } free (persist_names); - if (strlen(persist_name) <= 0) + if (!strlen(persist_name)) return (NULL); return persist_name; diff --git a/sa_common.c b/sa_common.c index 4a4d140..d7fadd2 100644 --- a/sa_common.c +++ b/sa_common.c @@ -671,7 +671,7 @@ int decode_epoch(char timestamp[], struct tstamp_ext *tse, uint64_t flags) { tse->epoch_time = atol(timestamp); - if (tse->epoch_time <= 0) { + if (!tse->epoch_time) { tse->use = NO_TIME; return 1; } @@ -1583,7 +1583,7 @@ int read_record_hdr(int ifd, void *buffer, struct record_header *record_hdr, } /* Sanity checks */ - if ((record_hdr->record_type <= 0) || (record_hdr->record_type > R_EXTRA_MAX) || + if (!record_hdr->record_type || (record_hdr->record_type > R_EXTRA_MAX) || (record_hdr->hour > 23) || (record_hdr->minute > 59) || (record_hdr->second > 60) || (record_hdr->ust_time < 1000000000)) { #ifdef DEBUG fprintf(stderr, "%s: record_type=%d HH:MM:SS=%02d:%02d:%02d (%llu)\n", -- 2.50.1