diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-09-04 14:15:47 +0200 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2021-10-01 18:36:35 +0200 |
commit | ae1816e563b8fd854f7e70a3f9a7ee0911e8a49a (patch) | |
tree | 1b191952bc6938dcdb66346eedd5d647cd313b66 | |
parent | 53732ab0bbc723a7e5504e42b0857076e24409c4 (diff) |
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;
~ ^~~
-rw-r--r-- | Settings.c | 8 | ||||
-rw-r--r-- | Settings.h | 2 |
2 files changed, 5 insertions, 5 deletions
@@ -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); } @@ -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; |