From: Ruben Kerkhof Date: Thu, 31 May 2018 14:40:08 +0000 (+0200) Subject: scanner.l: fix a few implicit conversion warnings X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=0261b776d7300048bfc95be6f808e98fbe896f76;p=collectd.git scanner.l: fix a few implicit conversion warnings LEX src/liboconfig/scanner.c CC src/liboconfig/liboconfig_la-scanner.lo src/liboconfig/scanner.l:113:12: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] int len = strlen (yytext); ~~~ ^~~~~~~~~~~~~~~ src/liboconfig/scanner.l:129:12: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] int len = strlen (yytext); ~~~ ^~~~~~~~~~~~~~~ --- diff --git a/src/liboconfig/scanner.l b/src/liboconfig/scanner.l index 48580031..a9c733e3 100644 --- a/src/liboconfig/scanner.l +++ b/src/liboconfig/scanner.l @@ -110,7 +110,7 @@ IPV6_ADDR ({IPV6_BASE})|(\[{IPV6_BASE}\](:{PORT})?) {UNQUOTED_STRING} {yylval.string = yytext; return (UNQUOTED_STRING);} \"{QUOTED_STRING}\\{EOL} { - int len = strlen (yytext); + size_t len = strlen (yytext); ml_pos = 0; @@ -126,7 +126,7 @@ IPV6_ADDR ({IPV6_BASE})|(\[{IPV6_BASE}\](:{PORT})?) } ^{WHITE_SPACE}+ {/* remove leading white-space */} {NON_WHITE_SPACE}{QUOTED_STRING}\\{EOL} { - int len = strlen (yytext); + size_t len = strlen (yytext); /* remove "\\" */ if ('\r' == yytext[len - 2]) @@ -147,7 +147,7 @@ IPV6_ADDR ({IPV6_BASE})|(\[{IPV6_BASE}\](:{PORT})?) %% static void ml_append (char *string) { - int len = strlen (string); + size_t len = strlen (string); int s; if (ml_free <= len) {