From: Martin Ling Date: Fri, 24 Jan 2020 03:01:23 +0000 (+0000) Subject: Replace some usages of int with size_t to fix overflow warnings. X-Git-Tag: libserialport-0.1.2~45 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4651adb4f6fb37dbd15d3d73ebf513bde1892b92;p=libserialport.git Replace some usages of int with size_t to fix overflow warnings. On MSVC, these gave the following warning: warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data --- diff --git a/serialport.c b/serialport.c index d356057..e86603b 100644 --- a/serialport.c +++ b/serialport.c @@ -59,7 +59,7 @@ SP_API enum sp_return sp_get_port_by_name(const char *portname, struct sp_port * #ifndef NO_PORT_METADATA enum sp_return ret; #endif - int len; + size_t len; TRACE("%s, %p", portname, port_ptr); @@ -323,7 +323,7 @@ SP_PRIV struct sp_port **list_append(struct sp_port **list, const char *portname) { void *tmp; - unsigned int count; + size_t count; for (count = 0; list[count]; count++) ;