From 028736501ebf63ab9d70b8de8628f9b2fd25eb37 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Fri, 1 Jun 2018 20:09:16 +0200 Subject: [PATCH] email plugin: fix implicit conversion warning src/email.c:275:13: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] len = strlen(line); ~ ^~~~~~~~~~~~ --- src/email.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/email.c b/src/email.c index 376dd6a5..f8a94fb6 100644 --- a/src/email.c +++ b/src/email.c @@ -260,7 +260,6 @@ static void *collect(void *arg) { while (42) { /* 256 bytes ought to be enough for anybody ;-) */ char line[256 + 1]; /* line + '\0' */ - int len = 0; errno = 0; if (fgets(line, sizeof(line), this->socket) == NULL) { @@ -272,7 +271,7 @@ static void *collect(void *arg) { break; } - len = strlen(line); + size_t len = strlen(line); if ((line[len - 1] != '\n') && (line[len - 1] != '\r')) { log_warn("collect: line too long (> %" PRIsz " characters): " "'%s' (truncated)", @@ -287,7 +286,7 @@ static void *collect(void *arg) { continue; } - line[len - 1] = 0; + line[len - 1] = '\0'; log_debug("collect: line = '%s'", line); -- 2.11.0