]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
glib-2.0: Let (u)int.try_parse() return false if there is an unparsed part 8021ad3876ede6b19a8e075ab0f0a23a999d0b50
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 14 Jan 2020 13:05:02 +0000 (14:05 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 14 Jan 2020 13:06:23 +0000 (14:06 +0100)
This is how our other try_parse() implementions behave.

vapi/glib-2.0.vapi

index e4ce4dcd6ea23e0060b119d0d69a55fc7efb89d5..255f0834a390c2a11fd8c0d278247e72ec3c48e7 100644 (file)
@@ -164,7 +164,7 @@ public struct int {
                }
                if (int.MIN <= long_result <= int.MAX) {
                        result = (int) long_result;
-                       return errno != ERANGE && errno != EINVAL;
+                       return errno != ERANGE && errno != EINVAL && unparsed != endptr;
                } else {
                        result = int.MAX;
                        return false;
@@ -225,7 +225,7 @@ public struct uint {
                }
                if (uint.MIN <= ulong_result <= uint.MAX) {
                        result = (uint) ulong_result;
-                       return errno != ERANGE && errno != EINVAL;
+                       return errno != ERANGE && errno != EINVAL && unparsed != endptr;
                } else {
                        result = uint.MAX;
                        return false;