Skip to contentSkip to conversation

utf8: Don't rely on char being signed

PATCH In review Andrew Zaborowski 2 participants 3 messages Mar 15, 2019 – Mar 21, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 utf8: Don't rely on char being signed

Even if it gets forced by compile flags in a future commit it's better to avoid this char usage.

Reported-by Natanael Copa
Tested-by Natanael Copa
---
 ell/utf8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ell/utf8.c +1 -1
index e9998f7..edc2fc0 100644
@@ -93,7 +93,7 @@ LIB_EXPORT int l_utf8_get_codepoint(const char *str, size_t len, wchar_t *cp)
 	if (len == 0)
 		return 0;
 
-	if (str[0] > 0) {
+	if ((signed char) str[0] > 0) {
 		*cp = str[0];
 		return 1;
 	}
Signature · 1 line
2.19.1
#1 lore raw

PATCH 2/2 unit: Define WAIT_ANY if necessary

WAIT_ANY is not POSIX and musl libc doesn't define it. Fix based on
http://git.yoctoproject.org/cgit/cgit.cgi/meta-virtualization/tree/recipes-networking/openvswitch/openvswitch-git/0002-Define-WAIT_ANY-if-not-provided-by-system.patch

Reported-by Natanael Copa
Tested-by Natanael Copa
---
 unit/test-dbus-message-fds.c | 4 ++++
 unit/test-dbus-properties.c  | 4 ++++
 unit/test-dbus.c             | 4 ++++
 3 files changed, 12 insertions(+)
unit/test-dbus-message-fds.c +4 -0
index d6d0b38..6f68bae 100644
@@ -37,6 +37,10 @@
 #include <ell/ell.h>
 #include "ell/dbus-private.h"
 
+#ifndef WAIT_ANY
+#define WAIT_ANY (-1) /* Any process */
+#endif
+
 #define TEST_BUS_ADDRESS "unix:path=/tmp/ell-test-bus"
 
 static pid_t dbus_daemon_pid = -1;
unit/test-dbus-properties.c +4 -0
index f91ba73..1844ec0 100644
@@ -34,6 +34,10 @@
 #include <ell/ell.h>
 #include "ell/dbus-private.h"
 
+#ifndef WAIT_ANY
+#define WAIT_ANY (-1) /* Any process */
+#endif
+
 #define TEST_BUS_ADDRESS "unix:path=/tmp/ell-test-bus"
 
 static pid_t dbus_daemon_pid = -1;
unit/test-dbus.c +4 -0
index d5bd8c5..67f0a7b 100644
@@ -31,6 +31,10 @@
 
 #include <ell/ell.h>
 
+#ifndef WAIT_ANY
+#define WAIT_ANY (-1) /* Any process */
+#endif
+
 #define TEST_BUS_ADDRESS "unix:path=/tmp/ell-test-bus"
 
 static pid_t dbus_daemon_pid = -1;
Signature · 1 line
2.19.1
#2 lore raw
In reply to Andrew Zaborowski

Hi Andrew,

Quoted 9 lines · Andrew Zaborowski

Even if it gets forced by compile flags in a future commit it's better to avoid this char usage.

Reported-by Natanael Copa
Tested-by Natanael Copa
---
  ell/utf8.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Both applied, thanks.

Regards,
-Denis