From 4887f71ca3623e6d57923da1727d4214e51bb769 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Mon, 6 Jan 2025 17:22:41 +0000 Subject: [PATCH] CIFread.h: fix struct cifrstyle.crs_layers type bool -> enum (unsigned char) The type is actually an enum (assumed to be int by default) but relies on the magic typedef to (unsigned char) so we make this explicit and better document what the real type is. I guess in the past it was really a bool with only 2 states NONE|TEXT. C29 bool type compatibility --- calma/calmaInt.h | 7 +++++-- cif/CIFread.h | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/calma/calmaInt.h b/calma/calmaInt.h index 506f285b..72fa6bf1 100644 --- a/calma/calmaInt.h +++ b/calma/calmaInt.h @@ -131,8 +131,11 @@ typedef struct /* Length of record header */ #define CALMAHEADERLENGTH 4 -/* Label types */ -typedef enum { LABEL_TYPE_NONE, LABEL_TYPE_TEXT, LABEL_TYPE_PORT, LABEL_TYPE_CELLID } labelType; +/* Label types + * The intention is all the values can be stored/converted with unsigned char type, + * C23 allows us to be explicit with the type but C99 does not, so a comment for now. + */ +typedef enum /* : unsigned char */ { LABEL_TYPE_NONE, LABEL_TYPE_TEXT, LABEL_TYPE_PORT, LABEL_TYPE_CELLID } labelType; /* ------------------------- Input macros ----------------------------- */ diff --git a/cif/CIFread.h b/cif/CIFread.h index 8d0f75fe..cb764eb4 100644 --- a/cif/CIFread.h +++ b/cif/CIFread.h @@ -104,8 +104,10 @@ typedef struct cifrstyle /* Gives the Magic layer to use for labels * on each possible CIF layer. */ - bool crs_labelSticky[MAXCIFRLAYERS]; - /* Marker if label layer makes sticky labels */ + /* enum labelType */ unsigned char crs_labelSticky[MAXCIFRLAYERS]; + /* Marker if label layer makes sticky labels + * enum labelType LABEL_TYPE_xxxxxx + */ CIFReadLayer *crs_layers[MAXCIFRLAYERS]; HashTable cifCalmaToCif; /* Table mapping from Calma layer numbers to * CIF layers