From: Wei Liu Subject: Re: [PATCH V4 09/24] libxl_json: introduce parser functions for builtin types Date: Mon, 12 May 2014 17:43:14 +0100 Message-ID: <20140512164313.GF6332@zion.uk.xensource.com> References: <1398949101-23320-1-git-send-email-wei.liu2@citrix.com> <1398949101-23320-10-git-send-email-wei.liu2@citrix.com> <1399381058.3014.121.camel@kazak.uk.xensource.com> <20140506135713.GG3530@perard.uk.xensource.com> <20140506140420.GI17067@zion.uk.xensource.com> <20140506143527.GH3530@perard.uk.xensource.com> <20140506144547.GN17067@zion.uk.xensource.com> <20140506144906.GO17067@zion.uk.xensource.com> <20140506151453.GI3530@perard.uk.xensource.com> <20140506154220.GS17067@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20140506154220.GS17067@zion.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Anthony PERARD Cc: ian.jackson@eu.citrix.com, Wei Liu , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, May 06, 2014 at 04:42:20PM +0100, Wei Liu wrote: [...] > + > +int libxl__uint64_parse_json(libxl__gc *gc, const libxl__json_object *o, > + void *p) > +{ > + if (!libxl__json_object_is_integer(o) && > + !libxl__json_object_is_number(o)) > + return ERROR_FAIL; > + > + if (libxl__json_object_is_integer(o)) { > + long long i = libxl__json_object_get_integer(o); > + > + if (i < 0) > + return ERROR_FAIL; > + Just found out that current API will generate -1 for some fields (say, video_memkb), so we have to loosen this check. Wei.