From 1cb77e7c465d4bf130be8ed1f44ac50b8983643c Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github@jdrake.com>
Date: Mon, 14 Jun 2021 10:16:19 -0700
Subject: [PATCH 1/3] cast isspace parameters to unsigned char

This is a known C pitfall, and was causing an error on MSYS2.
---
 lib/pacutils/mtree.c | 4 ++--
 src/pacsift.c        | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/pacutils/mtree.c b/lib/pacutils/mtree.c
index 932bfeb..dcfd68e 100644
--- a/lib/pacutils/mtree.c
+++ b/lib/pacutils/mtree.c
@@ -167,7 +167,7 @@ pu_mtree_t *pu_mtree_reader_next(pu_mtree_reader_t *reader, pu_mtree_t *dest) {
   if (reader->_buf[len - 1] == '\n') { reader->_buf[len - 1] = '\0'; }
 
   c = reader->_buf;
-  while (isspace(*c)) { c++; }
+  while (isspace((unsigned char)*c)) { c++; }
 
   if (c[0] == '#') {
     return pu_mtree_reader_next(reader, dest);
@@ -176,7 +176,7 @@ pu_mtree_t *pu_mtree_reader_next(pu_mtree_reader_t *reader, pu_mtree_t *dest) {
     c += 5;
   } else {
     char *sep = c, *path;
-    while (*sep && !isspace(*sep)) { sep++; }
+    while (*sep && !isspace((unsigned char)*sep)) { sep++; }
     if ((path = _pu_mtree_path(c, sep)) == NULL) { return NULL; }
     if (entry) {
       free(entry->path);
diff --git a/src/pacsift.c b/src/pacsift.c
index ae95df3..cb61d26 100644
--- a/src/pacsift.c
+++ b/src/pacsift.c
@@ -290,7 +290,7 @@ struct size_cmp *parse_size(const char *str) {
   }
 
   if (bytes > 0) {
-    while (isspace(*end)) { end++; }
+    while (isspace((unsigned char)*end)) { end++; }
     if (*end && !parse_size_units(&size.bytes, bytes, end)) {
       fprintf(stderr, "error: invalid size comparison '%s'\n", str);
       cleanup(1);
-- 
2.32.0.windows.1

