When building QEMU for NetBSD ("make vm-build-netbsd"), the compiler
complains:

  In file included from /usr/include/ctype.h:100,
                 from ../src/include/qemu/osdep.h:123,
                 from ../src/hw/ppc/vof.c:12:
  ../src/hw/ppc/vof.c: In function 'path_offset':
  ../src/hw/ppc/vof.c:150:31: warning: array subscript has type 'char' 
[-Wchar-subscripts]
  150 |                 *at = tolower(*at);

tolower() should not be used with plain "char" variables since these
can be signed and tolower() could be implemented as a macro that uses
its parameter to index into an array. Use our wrapper qemu_tolower()
to fix this problem.

Signed-off-by: Thomas Huth <[email protected]>
---
 hw/ppc/vof.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c
index fa7b73159a0..873e967f1e4 100644
--- a/hw/ppc/vof.c
+++ b/hw/ppc/vof.c
@@ -10,6 +10,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/ctype.h"
 #include "qemu/timer.h"
 #include "qemu/range.h"
 #include "qemu/units.h"
@@ -147,7 +148,7 @@ static int path_offset(const void *fdt, const char *path)
             if (*at == '/') {
                 at = strchr(at, '@');
             } else {
-                *at = tolower(*at);
+                *at = qemu_tolower(*at);
                 ++at;
             }
     }
-- 
2.55.0


Reply via email to