libyang REFACTOR use size-specific int types instead of generic types (#1177)
Align parameters' types with the values in (internal) structures.
diff --git a/tests/utests/schema/test_parser_yang.c b/tests/utests/schema/test_parser_yang.c
index efbd868..c8b3511 100644
--- a/tests/utests/schema/test_parser_yang.c
+++ b/tests/utests/schema/test_parser_yang.c
@@ -38,11 +38,11 @@
LY_ERR buf_add_char(struct ly_ctx *ctx, struct ly_in *in, size_t len, char **buf, size_t *buf_len, size_t *buf_used);
LY_ERR buf_store_char(struct lys_yang_parser_ctx *ctx, struct ly_in *in, enum yang_arg arg, char **word_p,
- size_t *word_len, char **word_b, size_t *buf_len, int need_buf, int *prefix);
+ size_t *word_len, char **word_b, size_t *buf_len, uint8_t need_buf, uint8_t *prefix);
LY_ERR get_keyword(struct lys_yang_parser_ctx *ctx, struct ly_in *in, enum ly_stmt *kw, char **word_p, size_t *word_len);
LY_ERR get_argument(struct lys_yang_parser_ctx *ctx, struct ly_in *in, enum yang_arg arg,
uint16_t *flags, char **word_p, char **word_b, size_t *word_len);
-LY_ERR skip_comment(struct lys_yang_parser_ctx *ctx, struct ly_in *in, int comment);
+LY_ERR skip_comment(struct lys_yang_parser_ctx *ctx, struct ly_in *in, uint8_t comment);
LY_ERR parse_action(struct lys_yang_parser_ctx *ctx, struct ly_in *in, struct lysp_node *parent, struct lysp_action **actions);
LY_ERR parse_any(struct lys_yang_parser_ctx *ctx, struct ly_in *in, enum ly_stmt kw, struct lysp_node *parent, struct lysp_node **siblings);
@@ -143,7 +143,7 @@
ctx.ctx = NULL;
ctx.pos_type = LY_VLOG_LINE;
ctx.line = 1;
- int prefix = 0;
+ uint8_t prefix = 0;
/* storing into buffer */
in.current = "abcd";
@@ -190,9 +190,9 @@
/* checking identifiers */
assert_int_equal(LY_EVALID, lysp_check_identifierchar((struct lys_parser_ctx *)&ctx, ':', 0, NULL));
- logbuf_assert("Invalid identifier character ':'. Line number 1.");
+ logbuf_assert("Invalid identifier character ':' (0x003a). Line number 1.");
assert_int_equal(LY_EVALID, lysp_check_identifierchar((struct lys_parser_ctx *)&ctx, '#', 1, NULL));
- logbuf_assert("Invalid identifier first character '#'. Line number 1.");
+ logbuf_assert("Invalid identifier first character '#' (0x0023). Line number 1.");
assert_int_equal(LY_SUCCESS, lysp_check_identifierchar((struct lys_parser_ctx *)&ctx, 'a', 1, &prefix));
assert_int_equal(0, prefix);
@@ -204,7 +204,7 @@
assert_int_equal(2, prefix);
/* second colon is invalid */
assert_int_equal(LY_EVALID, lysp_check_identifierchar((struct lys_parser_ctx *)&ctx, ':', 0, &prefix));
- logbuf_assert("Invalid identifier character ':'. Line number 1.");
+ logbuf_assert("Invalid identifier character ':' (0x003a). Line number 1.");
}
static void
diff --git a/tests/utests/schema/test_parser_yin.c b/tests/utests/schema/test_parser_yin.c
index 201de0d..1d0f011 100644
--- a/tests/utests/schema/test_parser_yin.c
+++ b/tests/utests/schema/test_parser_yin.c
@@ -754,7 +754,7 @@
st->yin_ctx->xmlctx->value = "#invalid";
st->yin_ctx->xmlctx->value_len = 8;
assert_int_equal(yin_validate_value(st->yin_ctx, Y_IDENTIF_ARG), LY_EVALID);
- logbuf_assert("Invalid identifier character '#'. Line number 1.");
+ logbuf_assert("Invalid identifier character '#' (0x0023). Line number 1.");
st->yin_ctx->xmlctx->value = "";
st->yin_ctx->xmlctx->value_len = 0;
diff --git a/tests/utests/schema/test_tree_schema_compile.c b/tests/utests/schema/test_tree_schema_compile.c
index e587bc2..cf30cdc 100644
--- a/tests/utests/schema/test_tree_schema_compile.c
+++ b/tests/utests/schema/test_tree_schema_compile.c
@@ -30,7 +30,7 @@
void yang_parser_ctx_free(struct lys_yang_parser_ctx *ctx);
LY_ERR lys_path_token(const char **path, const char **prefix, size_t *prefix_len, const char **name, size_t *name_len,
- int *parent_times, int *has_predicate);
+ int32_t *parent_times, uint8_t *has_predicate);
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
@@ -204,7 +204,7 @@
struct lysc_node_leaflist *ll;
struct lysc_node_leaf *l;
const char *dflt;
- int dynamic;
+ uint8_t dynamic;
assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
@@ -1276,10 +1276,10 @@
logbuf_assert("Duplicate identifier \"one\" of bit statement. Line number 1.");
assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type bits {"
"bit '11';}}}", LYS_IN_YANG, &mod));
- logbuf_assert("Invalid identifier first character '1'. Line number 1.");
+ logbuf_assert("Invalid identifier first character '1' (0x0031). Line number 1.");
assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type bits {"
"bit 'x1$1';}}}", LYS_IN_YANG, &mod));
- logbuf_assert("Invalid identifier character '$'. Line number 1.");
+ logbuf_assert("Invalid identifier character '$' (0x0024). Line number 1.");
assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb; leaf l {type bits;}}", LYS_IN_YANG, &mod));
logbuf_assert("Missing bit substatement for bits type. /bb:l");
@@ -1519,7 +1519,8 @@
struct lysc_type *type;
const char *path, *name, *prefix;
size_t prefix_len, name_len;
- int parent_times, has_predicate;
+ int32_t parent_times;
+ uint8_t has_predicate;
assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
@@ -2016,7 +2017,7 @@
const struct lys_module *mod;
struct lysc_type *type;
struct lysc_node_leaf *leaf;
- int dynamic;
+ uint8_t dynamic;
assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
@@ -2357,7 +2358,7 @@
struct lysc_node *parent, *child;
struct lysc_node_leaf *leaf;
struct lysc_node_leaflist *llist;
- int dynamic;
+ uint8_t dynamic;
assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
@@ -2667,7 +2668,7 @@
const struct lysc_node_leaflist *llist;
const struct lysc_node_leaf *leaf;
const char *str;
- int dynamic;
+ uint8_t dynamic;
assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));