From: Armaan Bhojwani Date: Sun, 9 May 2021 03:34:27 +0000 (-0400) Subject: Cast i to size_t type X-Git-Url: https://git.armaanb.net/?p=mmenu.git;a=commitdiff_plain;h=f709561b0490aae6335e4271e9e35e9c16139b9d Cast i to size_t type This doesn't really increase safety because logically i could never be negative, but at least it suppresses the compiler warnings. --- diff --git a/mmenu.c b/mmenu.c index b00af5a..ed9f339 100644 --- a/mmenu.c +++ b/mmenu.c @@ -76,7 +76,7 @@ main(int argc, char *argv[]) // Extract text from between HTML tags int j = 1; - for (int i = 345; i < strlen(chunk.memory); i++) { + for (int i = 345; (size_t)i < strlen(chunk.memory); i++) { char c = chunk.memory[i]; if (c == '<') intag = true; if (!intag) { @@ -92,7 +92,7 @@ main(int argc, char *argv[]) char *nl = (char *) calloc(1, sizeof(char)); if (!nl) memfail(); - for (int i = 0; i < strlen(outp) - 1; i++) { + for (int i = 0; (size_t)i < strlen(outp) - 1; i++) { if (outp[i] == '\n' && outp[i+1] == '\n') i+=4; nl = (char *) realloc(nl, i); if (!nl) memfail();