From f6dbb3011031497a874c720ee44c95153984a69a Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Fri, 20 Oct 2023 10:01:44 +0200 Subject: [PATCH] Minor fixes: UTF str: removed unused code, clarified loading of yang-lib load --- lib/src/clixon_string.c | 11 ----------- lib/src/clixon_yang_module.c | 8 ++++++-- lib/src/clixon_yang_parse_lib.c | 4 ++++ lib/src/clixon_yang_schema_mount.c | 2 +- yang/clixon/clixon-config@2023-05-01.yang | 6 +++--- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/src/clixon_string.c b/lib/src/clixon_string.c index a208477e..b24af14b 100644 --- a/lib/src/clixon_string.c +++ b/lib/src/clixon_string.c @@ -1080,17 +1080,6 @@ clixon_unicode2utf8_one(uint16_t uc16, clicon_err(OE_UNIX, EINVAL, "unicode2utf error"); goto done; } - else if (uc16<0x10000) { - *utfstr++=224+uc16/4096; - *utfstr++=128+uc16/64%64; - *utfstr++=128+uc16%64; - } - else if (uc16<0x110000) { - *utfstr++=240+uc16/262144; - *utfstr++=128+uc16/4096%64; - *utfstr++=128+uc16/64%64; - *utfstr++=128+uc16%64; - } else{ clicon_err(OE_UNIX, EINVAL, "unicode2utf error"); goto done; diff --git a/lib/src/clixon_yang_module.c b/lib/src/clixon_yang_module.c index a3aa5000..57410b22 100644 --- a/lib/src/clixon_yang_module.c +++ b/lib/src/clixon_yang_module.c @@ -883,10 +883,14 @@ yang_lib2yspec(clicon_handle h, } else if (yang_parse_module(h, "ietf-yang-library", "2019-01-04", yspec, NULL) < 0) goto fail; - if (yang_parse_post(h, yspec, yang_len_get(yspec) - (1+veclen - modmin)) < 0) + if ((modmin = yang_len_get(yspec) - (1+veclen - modmin)) < 0) + goto fail; + if (yang_parse_post(h, yspec, modmin) < 0) goto done; #else - if (yang_parse_post(h, yspec, yang_len_get(yspec) - (veclen - modmin)) < 0) + if ((modmin = yang_len_get(yspec) - (1+veclen - modmin)) < 0) + goto fail; + if (yang_parse_post(h, yspec, modmin) < 0) goto done; #endif retval = 1; diff --git a/lib/src/clixon_yang_parse_lib.c b/lib/src/clixon_yang_parse_lib.c index 6261a233..6a15fba3 100644 --- a/lib/src/clixon_yang_parse_lib.c +++ b/lib/src/clixon_yang_parse_lib.c @@ -1436,6 +1436,10 @@ yang_parse_post(clicon_handle h, struct yang_stmt **ylist = NULL; /* Topology sorted modules */ int ylen = 0; /* Length of ylist */ + if (modmin < 0){ + clicon_err(OE_YANG, EINVAL, "modmin negative"); + goto done; + } /* 1: Parse from text to yang parse-tree. * Iterate through modules and detect module/submodules to parse * NOTE: the list may grow on each iteration */ diff --git a/lib/src/clixon_yang_schema_mount.c b/lib/src/clixon_yang_schema_mount.c index 4359de65..4d66f51c 100644 --- a/lib/src/clixon_yang_schema_mount.c +++ b/lib/src/clixon_yang_schema_mount.c @@ -261,7 +261,7 @@ xml_yang_mount_get(clicon_handle h, * @param[in] x XML moint-point node * @param[in] yspec Yangspec for this mount-point (consumed) * @retval 0 OK - * @retval -1 Error + * @retval -1 Error */ int xml_yang_mount_set(cxobj *x, diff --git a/yang/clixon/clixon-config@2023-05-01.yang b/yang/clixon/clixon-config@2023-05-01.yang index 873ec1f9..92fcbcd7 100644 --- a/yang/clixon/clixon-config@2023-05-01.yang +++ b/yang/clixon/clixon-config@2023-05-01.yang @@ -617,7 +617,7 @@ module clixon-config { edit operation. Setting this option disables this behaviour, ie the startup configuration is NOT automatically updated. - If this option is false, the startup is autoamtically updated following the RFC"; + If this option is false, the startup is automatically updated following the RFC"; } leaf CLICON_RESTCONF_USER { type string; @@ -1111,7 +1111,7 @@ module clixon-config { restconf GET. The module state data is on the form: ... - instead where the modile state is on the form: + instead where the module state is on the form: ... See also CLICON_XMLDB_MODSTATE where the module state info is used to tag datastores with module information."; @@ -1148,7 +1148,7 @@ module clixon-config { default false; description "Enable event stream discovery as described in RFC 5277 - sections 3.2. If enabled, available streams will appear + section 3.2. If enabled, available streams will appear when doing netconf get or restconf GET"; } leaf CLICON_STREAM_DISCOVERY_RFC8040 {