poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/4] poke/pk-mi-json.c: Fix offset to JSON converter to handl


From: Mohammad-Reza Nabipoor
Subject: Re: [PATCH 3/4] poke/pk-mi-json.c: Fix offset to JSON converter to handle uint
Date: Sat, 27 Mar 2021 18:19:13 +0430

Hi, Jose.

On Wed, Mar 24, 2021 at 02:03:09AM +0430, Mohammad-Reza Nabipoor via poke-devel 
wrote:
> 2021-03-24  Mohammad-Reza Nabipoor  <m.nabipoor@yahoo.com>
> 
>       * poke/pk-mi-json.c (pk_mi_offset_to_json): Add support for `uint`
>       as magnitude of offsets.
> ---
>  ChangeLog         | 5 +++++
>  poke/pk-mi-json.c | 7 +++++--
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index 2938f6ea..901deda3 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,8 @@
> +2021-03-24  Mohammad-Reza Nabipoor  <m.nabipoor@yahoo.com>
> +
> +     * poke/pk-mi-json.c (pk_mi_offset_to_json): Add support for `uint`
> +     as magnitude of offsets.
> +
>  2021-03-24  Mohammad-Reza Nabipoor  <m.nabipoor@yahoo.com>
>  
>       * libpoke/libpoke.h (pk_val_set_mapped): New function declaration.
> diff --git a/poke/pk-mi-json.c b/poke/pk-mi-json.c
> index 0d0d74df..82fbb34e 100644
> --- a/poke/pk-mi-json.c
> +++ b/poke/pk-mi-json.c
> @@ -199,7 +199,7 @@ pk_mi_offset_to_json (pk_val pk_offset, char **errmsg)
>    json_object *magnitude_object;
>    json_object *unit_object, *unit_type_object, *unit_size_object;
>    json_object *unit_value_object;
> -  pk_val off_unit;
> +  pk_val off_mag, off_unit;
>  
>    assert (pk_type_code (pk_typeof (pk_offset)) == PK_OFFSET);
>  
> @@ -207,7 +207,10 @@ pk_mi_offset_to_json (pk_val pk_offset, char **errmsg)
>    PK_MI_CHECK (errmsg, offset_type_object != NULL,
>                "json_object_new_object () failed");
>  
> -  magnitude_object = pk_mi_int_to_json (pk_offset_magnitude (pk_offset), 
> errmsg);
> +  off_mag = pk_offset_magnitude (pk_offset);
> +  magnitude_object = pk_type_code (pk_typeof (off_mag)) == PK_INT
> +                         ? pk_mi_int_to_json (off_mag, errmsg)
> +                         : pk_mi_uint_to_json (off_mag, errmsg);
>  
>    unit_type_object = json_object_new_string ("UnsignedInteger");
>    PK_MI_CHECK (errmsg, unit_type_object != NULL,
> -- 
> 2.31.0
> 
> 


This is a trivial fix and you forgot to give me the permission explicitly
to push.
Should I push this to maint/poke-1, too?


Thanks


reply via email to

[Prev in Thread] Current Thread [Next in Thread]