diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index 802ca58..d0de625 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -364,7 +364,7 @@
         if (fraction && (*len - 1 - fraction > frdigits)) {
             LOGVAL(ctx->ctx, LYVE_SYNTAX_YANG,
                     "Range boundary \"%.*s\" of decimal64 type exceeds defined number (%u) of fraction digits.",
-                    *len, value, frdigits);
+                    (int)(*len), value, frdigits);
             return LY_EINVAL;
         }
         if (fraction) {
@@ -631,7 +631,7 @@
                 /* min cannot be used elsewhere than in the first part */
                 LOGVAL(ctx->ctx, LYVE_SYNTAX_YANG,
                         "Invalid %s restriction - unexpected data before min keyword (%.*s).", length_restr ? "length" : "range",
-                        expr - range_p->arg.str, range_p->arg.str);
+                                (int)(expr - range_p->arg.str), range_p->arg.str);
                 goto cleanup;
             }
             expr += ly_strlen_const("min");
@@ -2766,7 +2766,7 @@
         if (*id == '/') {
             LOGVAL(ctx->ctx, LYVE_REFERENCE,
                     "Invalid descendant-schema-nodeid value \"%.*s\" - absolute-schema-nodeid used.",
-                    nodeid_len ? nodeid_len : strlen(nodeid), nodeid);
+                    (int)(nodeid_len ? nodeid_len : strlen(nodeid)), nodeid);
             return LY_EVALID;
         }
     } else {
@@ -2776,7 +2776,7 @@
         if (*id != '/') {
             LOGVAL(ctx->ctx, LYVE_REFERENCE,
                     "Invalid absolute-schema-nodeid value \"%.*s\" - missing starting \"/\".",
-                    nodeid_len ? nodeid_len : strlen(nodeid), nodeid);
+                    (int)(nodeid_len ? nodeid_len : strlen(nodeid)), nodeid);
             return LY_EVALID;
         }
         ++id;
@@ -2790,7 +2790,7 @@
                 assert(prefix);
                 LOGVAL(ctx->ctx, LYVE_REFERENCE,
                         "Invalid %s-schema-nodeid value \"%.*s\" - prefix \"%.*s\" not defined in module \"%s\".",
-                        nodeid_type, id - nodeid, nodeid, prefix_len, prefix, LYSP_MODULE_NAME(ctx->pmod));
+                        nodeid_type, (int)(id - nodeid), nodeid, (int)prefix_len, prefix, LYSP_MODULE_NAME(ctx->pmod));
                 return LY_ENOTFOUND;
             }
         } else {
@@ -2816,8 +2816,8 @@
         if (ctx_node && (ctx_node->nodetype & (LYS_RPC | LYS_ACTION))) {
             /* move through input/output manually */
             if (mod != ctx_node->module) {
-                LOGVAL(ctx->ctx, LYVE_REFERENCE,
-                        "Invalid %s-schema-nodeid value \"%.*s\" - target node not found.", nodeid_type, id - nodeid, nodeid);
+                LOGVAL(ctx->ctx, LYVE_REFERENCE, "Invalid %s-schema-nodeid value \"%.*s\" - target node not found.",
+                        nodeid_type, (int)(id - nodeid), nodeid);
                 return LY_ENOTFOUND;
             }
             if (!ly_strncmp("input", name, name_len)) {
@@ -2835,8 +2835,8 @@
             getnext_extra_flag = 0;
         }
         if (!ctx_node) {
-            LOGVAL(ctx->ctx, LYVE_REFERENCE,
-                    "Invalid %s-schema-nodeid value \"%.*s\" - target node not found.", nodeid_type, id - nodeid, nodeid);
+            LOGVAL(ctx->ctx, LYVE_REFERENCE, "Invalid %s-schema-nodeid value \"%.*s\" - target node not found.",
+                    nodeid_type, (int)(id - nodeid), nodeid);
             return LY_ENOTFOUND;
         }
         current_nodetype = ctx_node->nodetype;
@@ -2855,7 +2855,7 @@
         if (*id != '/') {
             LOGVAL(ctx->ctx, LYVE_REFERENCE,
                     "Invalid %s-schema-nodeid value \"%.*s\" - missing \"/\" as node-identifier separator.",
-                    nodeid_type, id - nodeid + 1, nodeid);
+                    nodeid_type, (int)(id - nodeid + 1), nodeid);
             return LY_EVALID;
         }
         ++id;
@@ -2869,7 +2869,7 @@
     } else {
         LOGVAL(ctx->ctx, LYVE_REFERENCE,
                 "Invalid %s-schema-nodeid value \"%.*s\" - unexpected end of expression.",
-                nodeid_type, nodeid_len ? nodeid_len : strlen(nodeid), nodeid);
+                nodeid_type, (int)(nodeid_len ? nodeid_len : strlen(nodeid)), nodeid);
     }
 
     return ret;
@@ -2917,13 +2917,13 @@
                 if (ret == LY_EDENIED) {
                     LOGVAL(ctx->ctx, LYVE_REFERENCE,
                             "Unique's descendant-schema-nodeid \"%.*s\" refers to %s node instead of a leaf.",
-                            len, keystr, lys_nodetype2str((*key)->nodetype));
+                            (int)len, keystr, lys_nodetype2str((*key)->nodetype));
                 }
                 return LY_EVALID;
             } else if (flags) {
                 LOGVAL(ctx->ctx, LYVE_REFERENCE,
                         "Unique's descendant-schema-nodeid \"%.*s\" refers into %s node.",
-                        len, keystr, flags & LYS_IS_NOTIF ? "notification" : "RPC/action");
+                        (int)len, keystr, flags & LYS_IS_NOTIF ? "notification" : "RPC/action");
                 return LY_EVALID;
             }
 
@@ -3025,13 +3025,13 @@
         /* key node must be present */
         key = (struct lysc_node_leaf *)lys_find_child(node, node->module, keystr, len, LYS_LEAF, LYS_GETNEXT_NOCHOICE);
         if (!key) {
-            LOGVAL(ctx->ctx, LYVE_REFERENCE, "The list's key \"%.*s\" not found.", len, keystr);
+            LOGVAL(ctx->ctx, LYVE_REFERENCE, "The list's key \"%.*s\" not found.", (int)len, keystr);
             return LY_EVALID;
         }
         /* keys must be unique */
         if (key->flags & LYS_KEY) {
             /* the node was already marked as a key */
-            LOGVAL(ctx->ctx, LYVE_SEMANTICS, "Duplicated key identifier \"%.*s\".", len, keystr);
+            LOGVAL(ctx->ctx, LYVE_SEMANTICS, "Duplicated key identifier \"%.*s\".", (int)len, keystr);
             return LY_EVALID;
         }
 
@@ -3171,7 +3171,7 @@
         mod = ly_resolve_prefix(ctx->ctx, prefix, prefix_len, LY_PREF_SCHEMA, (void *)dflt->mod);
         if (!mod) {
             LOGVAL(ctx->ctx, LYVE_REFERENCE, "Default case prefix \"%.*s\" not found "
-                    "in imports of \"%s\".", prefix_len, prefix, LYSP_MODULE_NAME(dflt->mod));
+                    "in imports of \"%s\".", (int)prefix_len, prefix, LYSP_MODULE_NAME(dflt->mod));
             return LY_EVALID;
         }
     } else {
