libyang BUGFIX type size problems
diff --git a/compat/compat.c b/compat/compat.c
index 380c756..ea8a618 100644
--- a/compat/compat.c
+++ b/compat/compat.c
@@ -103,7 +103,7 @@
     written = 0;
     while (fgets(chunk, sizeof(chunk), stream)) {
         len = strlen(chunk);
-        if (written + len > *n) {
+        if ((size_t)(written + len) > *n) {
             ptr = realloc(*lineptr, *n + sizeof(chunk));
             if (!ptr) {
                 return -1;
diff --git a/src/dict.c b/src/dict.c
index bf49561..9f741a2 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -82,7 +82,7 @@
          * before calling lydict_clean()
          */
         dict_rec = (struct ly_dict_rec *)rec->val;
-        LOGWRN(NULL, "String \"%s\" not freed from the dictionary, refcount %d", dict_rec->value, dict_rec->refcount);
+        LOGWRN(NULL, "String \"%s\" not freed from the dictionary, refcount %" PRIu32 ".", dict_rec->value, dict_rec->refcount);
         /* if record wasn't removed before free string allocated for that record */
 #ifdef NDEBUG
         free(dict_rec->value);
diff --git a/src/json.c b/src/json.c
index f5e8bac..0b1e670 100644
--- a/src/json.c
+++ b/src/json.c
@@ -237,7 +237,7 @@
 
             offset += i;   /* add read escaped characters */
             LY_CHECK_ERR_GOTO(ly_pututf8(&buf[len], value, &u),
-                    LOGVAL(jsonctx->ctx, LYVE_SYNTAX, "Invalid character reference \"%.*s\" (0x%08x).",
+                    LOGVAL(jsonctx->ctx, LYVE_SYNTAX, "Invalid character reference \"%.*s\" (0x%08" PRIx32 ").",
                     (int)(&in[offset] - c), c, value),
                     error);
             len += u;      /* update number of bytes in buffer */
@@ -271,7 +271,7 @@
                     LOGVAL(jsonctx->ctx, LY_VCODE_INCHAR, in[offset]), error);
 
             LY_CHECK_ERR_GOTO(!is_jsonstrchar(value),
-                    LOGVAL(jsonctx->ctx, LYVE_SYNTAX, "Invalid character in JSON string \"%.*s\" (0x%08x).",
+                    LOGVAL(jsonctx->ctx, LYVE_SYNTAX, "Invalid character in JSON string \"%.*s\" (0x%08" PRIx32 ").",
                     (int)(&in[offset] - start + u), start, value),
                     error);
 
@@ -354,7 +354,7 @@
         }
     }
 
-    return lyjson_count_in_row(in, end, '0', 0) == end - in;
+    return lyjson_count_in_row(in, end, '0', 0) == (uint32_t)(end - in);
 }
 
 /**
diff --git a/src/parser_json.c b/src/parser_json.c
index 60fb29f..858ec99 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -761,8 +761,8 @@
         LY_CHECK_GOTO((status != LYJSON_OBJECT) && (status != LYJSON_NULL), representation_error);
 
         if (!node || (node->schema != prev->schema)) {
-            LOGVAL(lydctx->jsonctx->ctx, LYVE_REFERENCE, "Missing JSON data instance #%u of %s:%s to be coupled with metadata.",
-                    instance, prev->schema->module->name, prev->schema->name);
+            LOGVAL(lydctx->jsonctx->ctx, LYVE_REFERENCE, "Missing JSON data instance #%" PRIu32
+                    " of %s:%s to be coupled with metadata.", instance, prev->schema->module->name, prev->schema->name);
             rc = LY_EVALID;
             goto cleanup;
         }
diff --git a/src/parser_xml.c b/src/parser_xml.c
index 887d9d5..4fb7187 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -457,7 +457,7 @@
         if ((unsigned)(ptr - value) == value_len) {
             /* number value */
             *hints |= LYD_VALHINT_DECNUM;
-            if ((num < INT32_MIN) || (num > UINT32_MAX)) {
+            if ((num < INT32_MIN) || (num > (long)UINT32_MAX)) {
                 /* large number */
                 *hints |= LYD_VALHINT_NUM64;
             }
diff --git a/src/path.c b/src/path.c
index bf68612..2ef2fbd 100644
--- a/src/path.c
+++ b/src/path.c
@@ -73,11 +73,11 @@
                 /* check prefix based on the options */
                 name = strnstr(exp->expr + exp->tok_pos[*tok_idx], ":", exp->tok_len[*tok_idx]);
                 if ((prefix == LY_PATH_PREFIX_MANDATORY) && !name) {
-                    LOGVAL(ctx, LYVE_XPATH, "Prefix missing for \"%.*s\" in path.", exp->tok_len[*tok_idx],
+                    LOGVAL(ctx, LYVE_XPATH, "Prefix missing for \"%.*s\" in path.", (int)exp->tok_len[*tok_idx],
                             exp->expr + exp->tok_pos[*tok_idx]);
                     goto token_error;
                 } else if ((prefix == LY_PATH_PREFIX_STRICT_INHERIT) && name) {
-                    LOGVAL(ctx, LYVE_XPATH, "Redundant prefix for \"%.*s\" in path.", exp->tok_len[*tok_idx],
+                    LOGVAL(ctx, LYVE_XPATH, "Redundant prefix for \"%.*s\" in path.", (int)exp->tok_len[*tok_idx],
                             exp->expr + exp->tok_pos[*tok_idx]);
                     goto token_error;
                 }
@@ -207,7 +207,7 @@
                 if ((exp->tok_len[*tok_idx] != ly_strlen_const("current")) ||
                         strncmp(exp->expr + exp->tok_pos[*tok_idx], "current", ly_strlen_const("current"))) {
                     LOGVAL(ctx, LYVE_XPATH, "Invalid function \"%.*s\" invocation in path.",
-                            exp->tok_len[*tok_idx], exp->expr + exp->tok_pos[*tok_idx]);
+                            (int)exp->tok_len[*tok_idx], exp->expr + exp->tok_pos[*tok_idx]);
                     goto token_error;
                 }
                 ++(*tok_idx);
@@ -285,7 +285,7 @@
     LY_CHECK_RET(lyxp_next_token(ctx, exp, tok_idx, LYXP_TOKEN_FUNCNAME), LY_EVALID);
     if (!strncmp(&exp->expr[exp->tok_pos[*tok_idx]], "deref", 5)) {
         LOGVAL(ctx, LYVE_XPATH, "Unexpected XPath function \"%.*s\" in path, expected \"deref(...)\"",
-                exp->tok_len[*tok_idx], exp->expr + exp->tok_pos[*tok_idx]);
+                (int)exp->tok_len[*tok_idx], exp->expr + exp->tok_pos[*tok_idx]);
         return LY_EVALID;
     }
 
@@ -390,7 +390,7 @@
         cur_len = exp->tok_len[tok_idx];
         if (prefix == LY_PATH_PREFIX_MANDATORY) {
             if (!strnstr(cur_node, ":", cur_len)) {
-                LOGVAL(ctx, LYVE_XPATH, "Prefix missing for \"%.*s\" in path.", cur_len, cur_node);
+                LOGVAL(ctx, LYVE_XPATH, "Prefix missing for \"%.*s\" in path.", (int)cur_len, cur_node);
                 ret = LY_EVALID;
                 goto error;
             }
@@ -398,7 +398,7 @@
             if (!prev_prefix && is_abs) {
                 /* the first node must have a prefix */
                 if (!strnstr(cur_node, ":", cur_len)) {
-                    LOGVAL(ctx, LYVE_XPATH, "Prefix missing for \"%.*s\" in path.", cur_len, cur_node);
+                    LOGVAL(ctx, LYVE_XPATH, "Prefix missing for \"%.*s\" in path.", (int)cur_len, cur_node);
                     ret = LY_EVALID;
                     goto error;
                 }
@@ -410,7 +410,7 @@
                 ptr = strnstr(cur_node, ":", cur_len);
                 if (ptr) {
                     if (!strncmp(prev_prefix, cur_node, ptr - cur_node) && (prev_prefix[ptr - cur_node] == ':')) {
-                        LOGVAL(ctx, LYVE_XPATH, "Duplicate prefix for \"%.*s\" in path.", cur_len, cur_node);
+                        LOGVAL(ctx, LYVE_XPATH, "Duplicate prefix for \"%.*s\" in path.", (int)cur_len, cur_node);
                         ret = LY_EVALID;
                         goto error;
                     }
diff --git a/src/plugins_types/xpath1.0.c b/src/plugins_types/xpath1.0.c
index d289422..e574862 100644
--- a/src/plugins_types/xpath1.0.c
+++ b/src/plugins_types/xpath1.0.c
@@ -63,14 +63,14 @@
                 mem = realloc(str, str_len + strlen(prefix) + 1 + len + 1);
                 LY_CHECK_ERR_GOTO(!mem, ret = ly_err_new(err, LY_EMEM, LYVE_DATA, NULL, NULL, "No memory."), cleanup);
                 str = mem;
-                str_len += sprintf(str + str_len, "%s:%.*s", prefix, len, str_begin);
+                str_len += sprintf(str + str_len, "%s:%.*s", prefix, (int)len, str_begin);
             } else {
                 /* just append the string, we may get the first expression node without a prefix but since this
                  * is not strictly forbidden, allow it */
                 mem = realloc(str, str_len + len + 1);
                 LY_CHECK_ERR_GOTO(!mem, ret = ly_err_new(err, LY_EMEM, LYVE_DATA, NULL, NULL, "No memory."), cleanup);
                 str = mem;
-                str_len += sprintf(str + str_len, "%.*s", len, str_begin);
+                str_len += sprintf(str + str_len, "%.*s", (int)len, str_begin);
             }
         } else {
             /* remember there was a prefix found */
@@ -79,7 +79,8 @@
             /* resolve the module in the original format */
             mod = lyplg_type_identity_module(resolve_ctx, NULL, str_begin, len, resolve_format, resolve_prefix_data);
             if (!mod && is_nametest) {
-                ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Failed to resolve prefix \"%.*s\".", len, str_begin);
+                ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Failed to resolve prefix \"%.*s\".",
+                        (int)len, str_begin);
                 goto cleanup;
             }
 
diff --git a/src/printer_lyb.c b/src/printer_lyb.c
index 5a062b1..110cb29 100644
--- a/src/printer_lyb.c
+++ b/src/printer_lyb.c
@@ -431,7 +431,7 @@
         error = str_len > UINT32_MAX;
         break;
     case sizeof(uint64_t):
-        error = str_len > UINT64_MAX;
+        error = 0;
         break;
     default:
         error = 1;
diff --git a/src/schema_compile_amend.c b/src/schema_compile_amend.c
index b05076c..5f1a561 100644
--- a/src/schema_compile_amend.c
+++ b/src/schema_compile_amend.c
@@ -223,7 +223,7 @@
         /* descendant schema nodeid */
         if (e->tokens[0] != LYXP_TOKEN_NAMETEST) {
             LOGVAL(ctx->ctx, LYVE_REFERENCE, "Invalid %s value \"%s\" - name test expected instead of \"%.*s\".",
-                    nodeid_type, str, e->tok_len[0], e->expr + e->tok_pos[0]);
+                    nodeid_type, str, (int)e->tok_len[0], e->expr + e->tok_pos[0]);
             ret = LY_EVALID;
             goto cleanup;
         }
@@ -234,7 +234,7 @@
     for ( ; i < e->used; i += 2) {
         if (e->tokens[i] != LYXP_TOKEN_OPER_PATH) {
             LOGVAL(ctx->ctx, LYVE_REFERENCE, "Invalid %s value \"%s\" - \"/\" expected instead of \"%.*s\".",
-                    nodeid_type, str, e->tok_len[i], e->expr + e->tok_pos[i]);
+                    nodeid_type, str, (int)e->tok_len[i], e->expr + e->tok_pos[i]);
             ret = LY_EVALID;
             goto cleanup;
         } else if (e->used == i + 1) {
@@ -244,7 +244,7 @@
             goto cleanup;
         } else if (e->tokens[i + 1] != LYXP_TOKEN_NAMETEST) {
             LOGVAL(ctx->ctx, LYVE_REFERENCE, "Invalid %s value \"%s\" - name test expected instead of \"%.*s\".",
-                    nodeid_type, str, e->tok_len[i + 1], e->expr + e->tok_pos[i + 1]);
+                    nodeid_type, str, (int)e->tok_len[i + 1], e->expr + e->tok_pos[i + 1]);
             ret = LY_EVALID;
             goto cleanup;
         }
@@ -1235,7 +1235,8 @@
 
         if (target->flags & LYS_SET_MIN) {
             LOGVAL(ctx->ctx, LYVE_REFERENCE,
-                    "Invalid deviation adding \"min-elements\" property which already exists (with value \"%u\").", *num);
+                    "Invalid deviation adding \"min-elements\" property which already exists (with value \"%" PRIu32 "\").",
+                    *num);
             ret = LY_EVALID;
             goto cleanup;
         }
@@ -1259,7 +1260,7 @@
         if (target->flags & LYS_SET_MAX) {
             if (*num) {
                 LOGVAL(ctx->ctx, LYVE_REFERENCE,
-                        "Invalid deviation adding \"max-elements\" property which already exists (with value \"%u\").",
+                        "Invalid deviation adding \"max-elements\" property which already exists (with value \"%" PRIu32 "\").",
                         *num);
             } else {
                 LOGVAL(ctx->ctx, LYVE_REFERENCE,
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index 7208c6a..2bb7af3 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -1494,7 +1494,7 @@
                 LY_ARRAY_FOR(*bitenums, v) {
                     if (cur_val == (*bitenums)[v].value) {
                         LOGVAL(ctx->ctx, LYVE_SYNTAX_YANG,
-                                "Invalid enumeration - value %d collide in items \"%s\" and \"%s\".",
+                                "Invalid enumeration - value %" PRId32 " collide in items \"%s\" and \"%s\".",
                                 cur_val, enums_p[u].name, (*bitenums)[v].name);
                         return LY_EVALID;
                     }
@@ -1528,7 +1528,7 @@
                 LY_ARRAY_FOR(*bitenums, v) {
                     if (cur_pos == (*bitenums)[v].position) {
                         LOGVAL(ctx->ctx, LYVE_SYNTAX_YANG,
-                                "Invalid bits - position %u collide in items \"%s\" and \"%s\".",
+                                "Invalid bits - position %" PRIu32 " collide in items \"%s\" and \"%s\".",
                                 cur_pos, enums_p[u].name, (*bitenums)[v].name);
                         return LY_EVALID;
                     }
@@ -1562,15 +1562,15 @@
             if (basetype == LY_TYPE_ENUM) {
                 if (cur_val != base_enums[match].value) {
                     LOGVAL(ctx->ctx, LYVE_SYNTAX_YANG,
-                            "Invalid enumeration - value of the item \"%s\" has changed from %d to %d in the derived type.",
-                            enums_p[u].name, base_enums[match].value, cur_val);
+                            "Invalid enumeration - value of the item \"%s\" has changed from %" PRId32 " to %" PRId32
+                            " in the derived type.", enums_p[u].name, base_enums[match].value, cur_val);
                     return LY_EVALID;
                 }
             } else {
                 if (cur_pos != base_enums[match].position) {
                     LOGVAL(ctx->ctx, LYVE_SYNTAX_YANG,
-                            "Invalid bits - position of the item \"%s\" has changed from %u to %u in the derived type.",
-                            enums_p[u].name, base_enums[match].position, cur_pos);
+                            "Invalid bits - position of the item \"%s\" has changed from %" PRIu32 " to %" PRIu32
+                            " in the derived type.", enums_p[u].name, base_enums[match].position, cur_pos);
                     return LY_EVALID;
                 }
             }
@@ -3063,7 +3063,7 @@
     }
 
     if (llist->min > llist->max) {
-        LOGVAL(ctx->ctx, LYVE_SEMANTICS, "Leaf-list min-elements %u is bigger than max-elements %u.",
+        LOGVAL(ctx->ctx, LYVE_SEMANTICS, "Leaf-list min-elements %" PRIu32 " is bigger than max-elements %" PRIu32 ".",
                 llist->min, llist->max);
         return LY_EVALID;
     }
@@ -3504,7 +3504,8 @@
 
     /* checks */
     if (list->min > list->max) {
-        LOGVAL(ctx->ctx, LYVE_SEMANTICS, "List min-elements %u is bigger than max-elements %u.", list->min, list->max);
+        LOGVAL(ctx->ctx, LYVE_SEMANTICS, "List min-elements %" PRIu32 " is bigger than max-elements %" PRIu32 ".",
+                list->min, list->max);
         return LY_EVALID;
     }
 
diff --git a/src/tree_schema_common.c b/src/tree_schema_common.c
index 94e91a4..67cbae6 100644
--- a/src/tree_schema_common.c
+++ b/src/tree_schema_common.c
@@ -1001,7 +1001,7 @@
 lysp_check_stringchar(struct lysp_ctx *ctx, uint32_t c)
 {
     if (!is_yangutf8char(c)) {
-        LOGVAL_PARSER(ctx, LY_VCODE_INCHAR, c);
+        LOGVAL_PARSER(ctx, LY_VCODE_INCHAR, (char)c);
         return LY_EVALID;
     }
     return LY_SUCCESS;
@@ -1014,11 +1014,12 @@
         if (!is_yangidentstartchar(c)) {
             if ((c < UCHAR_MAX) && isprint(c)) {
                 if (ctx) {
-                    LOGVAL_PARSER(ctx, LYVE_SYNTAX_YANG, "Invalid identifier first character '%c' (0x%04x).", (char)c, c);
+                    LOGVAL_PARSER(ctx, LYVE_SYNTAX_YANG, "Invalid identifier first character '%c' (0x%04" PRIx32 ").",
+                            (char)c, c);
                 }
             } else {
                 if (ctx) {
-                    LOGVAL_PARSER(ctx, LYVE_SYNTAX_YANG, "Invalid identifier first character 0x%04x.", c);
+                    LOGVAL_PARSER(ctx, LYVE_SYNTAX_YANG, "Invalid identifier first character 0x%04" PRIx32 ".", c);
                 }
             }
             return LY_EVALID;
@@ -1034,7 +1035,7 @@
         (*prefix) = 1;
     } else if (!is_yangidentchar(c)) {
         if (ctx) {
-            LOGVAL_PARSER(ctx, LYVE_SYNTAX_YANG, "Invalid identifier character '%c' (0x%04x).", (char)c, c);
+            LOGVAL_PARSER(ctx, LYVE_SYNTAX_YANG, "Invalid identifier character '%c' (0x%04" PRIx32 ").", (char)c, c);
         }
         return LY_EVALID;
     }
diff --git a/src/xml.c b/src/xml.c
index f509445..004dbb9 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -516,7 +516,7 @@
                 }
                 ++offset;
                 if (ly_pututf8(&buf[len], n, &u)) {
-                    LOGVAL(ctx, LYVE_SYNTAX, "Invalid character reference \"%.12s\" (0x%08x).", p, n);
+                    LOGVAL(ctx, LYVE_SYNTAX, "Invalid character reference \"%.12s\" (0x%08" PRIx32 ").", p, n);
                     goto error;
                 }
                 len += u;
diff --git a/src/xpath.c b/src/xpath.c
index a1308d5..ae0c627 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -2393,7 +2393,7 @@
         break;
     }
     if (min_arg_count == -1) {
-        LOGVAL(ctx, LY_VCODE_XP_INFUNC, exp->tok_len[*tok_idx], &exp->expr[exp->tok_pos[*tok_idx]]);
+        LOGVAL(ctx, LY_VCODE_XP_INFUNC, (int)exp->tok_len[*tok_idx], &exp->expr[exp->tok_pos[*tok_idx]]);
         return LY_EINVAL;
     }
     ++(*tok_idx);
@@ -2426,7 +2426,8 @@
     ++(*tok_idx);
 
     if ((arg_count < (uint32_t)min_arg_count) || (arg_count > max_arg_count)) {
-        LOGVAL(ctx, LY_VCODE_XP_INARGCOUNT, arg_count, exp->tok_len[func_tok_idx], &exp->expr[exp->tok_pos[func_tok_idx]]);
+        LOGVAL(ctx, LY_VCODE_XP_INARGCOUNT, arg_count, (int)exp->tok_len[func_tok_idx],
+                &exp->expr[exp->tok_pos[func_tok_idx]]);
         return LY_EVALID;
     }
 
@@ -3119,8 +3120,10 @@
                 tok_type = LYXP_TOKEN_OPER_MATH;
 
             } else if (prev_ntype_check || prev_func_check) {
-                LOGVAL(ctx, LYVE_XPATH, "Invalid character 0x%x ('%c'), perhaps \"%.*s\" is supposed to be a function call.",
-                        expr_str[parsed], expr_str[parsed], expr->tok_len[expr->used - 1], &expr->expr[expr->tok_pos[expr->used - 1]]);
+                LOGVAL(ctx, LYVE_XPATH,
+                        "Invalid character 0x%x ('%c'), perhaps \"%.*s\" is supposed to be a function call.",
+                        expr_str[parsed], expr_str[parsed], (int)expr->tok_len[expr->used - 1],
+                        &expr->expr[expr->tok_pos[expr->used - 1]]);
                 ret = LY_EVALID;
                 goto error;
             } else {
@@ -3836,10 +3839,11 @@
         for (i = 0; i < arg_count; ++i) {
             if ((args[i]->type == LYXP_SET_SCNODE_SET) && (sleaf = (struct lysc_node_leaf *)warn_get_scnode_in_ctx(args[i]))) {
                 if (!(sleaf->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
-                    LOGWRN(set->ctx, "Argument #%u of %s is a %s node \"%s\".",
+                    LOGWRN(set->ctx, "Argument #%" PRIu32 " of %s is a %s node \"%s\".",
                             i + 1, __func__, lys_nodetype2str(sleaf->nodetype), sleaf->name);
                 } else if (!warn_is_string_type(sleaf->type)) {
-                    LOGWRN(set->ctx, "Argument #%u of %s is node \"%s\", not of string-type.", i + 1, __func__, sleaf->name);
+                    LOGWRN(set->ctx, "Argument #%" PRIu32 " of %s is node \"%s\", not of string-type.", i + 1, __func__,
+                            sleaf->name);
                 }
             }
         }
@@ -5689,7 +5693,7 @@
             break;
         case LY_VALUE_XML:
             /* all nodes need to be prefixed */
-            LOGVAL(set->ctx, LYVE_DATA, "Non-prefixed node \"%.*s\" in XML xpath found.", *qname_len, *qname);
+            LOGVAL(set->ctx, LYVE_DATA, "Non-prefixed node \"%.*s\" in XML xpath found.", (int)*qname_len, *qname);
             return LY_EVALID;
         }
     }
@@ -8667,7 +8671,7 @@
         }
 
         if (!xpath_func) {
-            LOGVAL(set->ctx, LY_VCODE_XP_INFUNC, exp->tok_len[*tok_idx], &exp->expr[exp->tok_pos[*tok_idx]]);
+            LOGVAL(set->ctx, LY_VCODE_XP_INFUNC, (int)exp->tok_len[*tok_idx], &exp->expr[exp->tok_pos[*tok_idx]]);
             return LY_EVALID;
         }
     }
@@ -8779,12 +8783,12 @@
         if (errno) {
             LOGVAL(ctx, LY_VCODE_XP_INTOK, "Unknown", &exp->expr[exp->tok_pos[*tok_idx]]);
             LOGVAL(ctx, LYVE_XPATH, "Failed to convert \"%.*s\" into a long double (%s).",
-                    exp->tok_len[*tok_idx], &exp->expr[exp->tok_pos[*tok_idx]], strerror(errno));
+                    (int)exp->tok_len[*tok_idx], &exp->expr[exp->tok_pos[*tok_idx]], strerror(errno));
             return LY_EVALID;
-        } else if (endptr - &exp->expr[exp->tok_pos[*tok_idx]] != exp->tok_len[*tok_idx]) {
+        } else if ((uint32_t)(endptr - &exp->expr[exp->tok_pos[*tok_idx]]) != exp->tok_len[*tok_idx]) {
             LOGVAL(ctx, LY_VCODE_XP_INTOK, "Unknown", &exp->expr[exp->tok_pos[*tok_idx]]);
             LOGVAL(ctx, LYVE_XPATH, "Failed to convert \"%.*s\" into a long double.",
-                    exp->tok_len[*tok_idx], &exp->expr[exp->tok_pos[*tok_idx]]);
+                    (int)exp->tok_len[*tok_idx], &exp->expr[exp->tok_pos[*tok_idx]]);
             return LY_EVALID;
         }