From ae1816e563b8fd854f7e70a3f9a7ee0911e8a49a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Sat, 4 Sep 2021 14:15:47 +0200 Subject: Settings: use size_t for meter count in header Header.c:150:26: error: implicit conversion loses integer precision: 'int' to 'uint8_t' (aka 'unsigned char') [-Werror,-Wimplicit-int-conversion] colSettings->len = len; ~ ^~~ --- Settings.c | 8 ++++---- Settings.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Settings.c b/Settings.c index cf90119e..e4b0aad9 100644 --- a/Settings.c +++ b/Settings.c @@ -29,7 +29,7 @@ void Settings_delete(Settings* this) { free(this->fields); for (unsigned int i = 0; i < HeaderLayout_getColumns(this->hLayout); i++) { if (this->hColumns[i].names) { - for (uint8_t j = 0; j < this->hColumns[i].len; j++) + for (size_t j = 0; j < this->hColumns[i].len; j++) free(this->hColumns[i].names[j]); free(this->hColumns[i].names); } @@ -329,7 +329,7 @@ static void writeFields(FILE* fd, const ProcessField* fields, Hashtable* columns static void writeMeters(const Settings* this, FILE* fd, char separator, unsigned int column) { const char* sep = ""; - for (uint8_t i = 0; i < this->hColumns[column].len; i++) { + for (size_t i = 0; i < this->hColumns[column].len; i++) { fprintf(fd, "%s%s", sep, this->hColumns[column].names[i]); sep = " "; } @@ -338,7 +338,7 @@ static void writeMeters(const Settings* this, FILE* fd, char separator, unsigned static void writeMeterModes(const Settings* this, FILE* fd, char separator, unsigned int column) { const char* sep = ""; - for (uint8_t i = 0; i < this->hColumns[column].len; i++) { + for (size_t i = 0; i < this->hColumns[column].len; i++) { fprintf(fd, "%s%d", sep, this->hColumns[column].modes[i]); sep = " "; } @@ -587,7 +587,7 @@ void Settings_setHeaderLayout(Settings* this, HeaderLayout hLayout) { } else if (newColumns < oldColumns) { for (unsigned int i = newColumns; i < oldColumns; i++) { if (this->hColumns[i].names) { - for (uint8_t j = 0; j < this->hColumns[i].len; j++) + for (size_t j = 0; j < this->hColumns[i].len; j++) free(this->hColumns[i].names[j]); free(this->hColumns[i].names); } diff --git a/Settings.h b/Settings.h index f8caa31f..a1f70402 100644 --- a/Settings.h +++ b/Settings.h @@ -22,7 +22,7 @@ in the source distribution for its full text. #define CONFIG_READER_MIN_VERSION 2 typedef struct { - uint8_t len; + size_t len; char** names; int* modes; } MeterColumnSetting; -- cgit v1.2.3