From 596ac24a2f3f0049e3c64994cc409b5955e8a411 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 27 Dec 2024 10:48:43 +0100 Subject: [PATCH] corec: don't use a custom value for MAX_64 We should use the values from the compiler. --- corec/corec/portab.h | 8 ++------ corec/corec/str/str.c | 4 ++-- libmatroska2/matroska2/matroska.h | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/corec/corec/portab.h b/corec/corec/portab.h index df423532..38c16b24 100644 --- a/corec/corec/portab.h +++ b/corec/corec/portab.h @@ -330,10 +330,6 @@ typedef uint64_t uint_fast64_t; #define TPRIx64 PRIx64 #endif -#define MAX_INT64 LL(0x7fffffffffffffff) - -#define MAX_TICK INT_MAX - typedef int_fast32_t err_t; typedef int_fast32_t bool_t; typedef int_fast32_t tick_t; @@ -498,10 +494,10 @@ void * __alloca(size_t size); #ifdef CONFIG_FILEPOS_64 typedef int_fast64_t filepos_t; -#define MAX_FILEPOS MAX_INT64 +#define MAX_FILEPOS INT_FAST64_MAX #else typedef int_fast32_t filepos_t; -#define MAX_FILEPOS INT_MAX +#define MAX_FILEPOS INT_FAST32_MAX #endif #define INVALID_FILEPOS_T ((filepos_t)-1) diff --git a/corec/corec/str/str.c b/corec/corec/str/str.c index 6f1a3efa..1760d5da 100644 --- a/corec/corec/str/str.c +++ b/corec/corec/str/str.c @@ -185,7 +185,7 @@ static int get_integers(int64_t IntValue) { int Result = 0; int64_t TmpVal = 1; - while (IntValue >= TmpVal && TmpVal < MAX_INT64/10) + while (IntValue >= TmpVal && TmpVal < INT64_MAX/10) { TmpVal *= 10; Result++; @@ -197,7 +197,7 @@ static int get_decimals(int Decimals, int64_t IntValue) { int Result = 0; int64_t TmpVal = IntValue+1; - while (TmpVal < MAX_INT64/10) + while (TmpVal < INT64_MAX/10) { TmpVal *= 10; Result++; diff --git a/libmatroska2/matroska2/matroska.h b/libmatroska2/matroska2/matroska.h index f7eb9c14..6fae6557 100644 --- a/libmatroska2/matroska2/matroska.h +++ b/libmatroska2/matroska2/matroska.h @@ -58,7 +58,7 @@ MATROSKA_DLL err_t MATROSKA_Init(parsercontext *p); -#define INVALID_TIMESTAMP_T MAX_INT64 +#define INVALID_TIMESTAMP_T INT64_MAX typedef int64_t mkv_timestamp_t; // in nanoseconds typedef struct matroska_block matroska_block;