Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
qemu.3557
0199-string-input-visitor-Fix-uint64-han.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0199-string-input-visitor-Fix-uint64-han.patch of Package qemu.3557
From e9fcca3a1842ff2c42991b14f1291abb4b2e55f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de> Date: Fri, 25 Sep 2015 15:15:57 +0200 Subject: [PATCH] string-input-visitor: Fix uint64 handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement the .type_uint64 hook to override string parsing. Signed-off-by: Andreas Färber <afaerber@suse.de> --- qapi/string-input-visitor.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 793548a..2721499 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -42,6 +42,26 @@ static void parse_type_int(Visitor *v, int64_t *obj, const char *name, *obj = val; } +static void parse_type_uint64(Visitor *v, uint64_t *obj, const char *name, + Error **errp) +{ + StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v); + char *endp = (char *) siv->string; + unsigned long long val; + + errno = 0; + if (siv->string) { + val = strtoull(siv->string, &endp, 0); + } + if (!siv->string || errno || endp == siv->string || *endp) { + error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", + "uint64"); + return; + } + + *obj = val; +} + static void parse_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp) { @@ -151,6 +171,7 @@ StringInputVisitor *string_input_visitor_new(const char *str) v->visitor.type_enum = input_type_enum; v->visitor.type_int = parse_type_int; + v->visitor.type_uint64 = parse_type_uint64; v->visitor.type_size = parse_type_size; v->visitor.type_bool = parse_type_bool; v->visitor.type_str = parse_type_str;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor