From: kostasch Date: Mon, 3 Aug 2020 22:37:23 +0300 Subject: [PATCH] pk_type_code and json schema fixes. 2020-08-03 Kostas Chasialis * libpoke/pk-val.c (pk_type_code): Now return PK_UINT if integral type is unsigned. * etc/pk-mi-json-schema.json (json_schema) : Changed "offsets" to "boffsets" on arrays and structs. --- ChangeLog | 7 +++++++ etc/pk-mi-json-schema.json | 26 ++++++++++++++++++++------ libpoke/pk-val.c | 5 ++++- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d9f6870..c0df29c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-08-03 Kostas Chasialis + + * libpoke/pk-val.c (pk_type_code): Now return PK_UINT + if integral type is unsigned. + * etc/pk-mi-json-schema.json (json_schema) : Changed "offsets" + to "boffsets" on arrays and structs. + 2020-08-02 Kostas Chasialis * libpoke/libpoke.h: Change poke to Poke on function documentations. diff --git a/etc/pk-mi-json-schema.json b/etc/pk-mi-json-schema.json index 40b83bf8..5b0a980c 100644 --- a/etc/pk-mi-json-schema.json +++ b/etc/pk-mi-json-schema.json @@ -114,9 +114,16 @@ "StructField" : { "type" : "object", "properties" : { - "offset" : { + "boffset" : { "type" : "object", - "$ref" : "#/definitions/Offset" + "allOf" : [ + { "$ref" : "#/definitions/UnsignedInteger" } + ], + "properties" : { + "size" : { + "const" : 64 + } + } }, "name" : { "type" : "object", @@ -136,7 +143,7 @@ }, "maxProperties": 3, "required" : [ - "offset", + "boffset", "name", "value" ] @@ -220,15 +227,22 @@ { "$ref": "#/definitions/Null" } ] }, - "offset" : { + "boffset" : { "type" : "object", - "$ref" : "#/definitions/Offset" + "allOf" : [ + { "$ref" : "#/definitions/UnsignedInteger" } + ], + "properties" : { + "size" : { + "const" : 64 + } + } } }, "maxProperties" : 2, "required" : [ "value", - "offset" + "boffset" ] } }, diff --git a/libpoke/pk-val.c b/libpoke/pk-val.c index 5f9c882c..035d9fa5 100644 --- a/libpoke/pk-val.c +++ b/libpoke/pk-val.c @@ -164,7 +164,10 @@ pk_type_code (pk_val val) switch (PVM_VAL_TYP_CODE (val)) { case PVM_TYPE_INTEGRAL: - return PK_INT; + if ((pk_int_value (pk_integral_type_signed_p (pk_typeof (val))))) + return PK_INT; + else + return PK_UINT; case PVM_TYPE_STRING: return PK_STRING; case PVM_TYPE_ARRAY: -- 2.17.1