On 32-bit systems, gsize is an int but size_t is a (32-bit) long. This discrepancy results in compilation errors when attempting to interchange their pointers. The patch below changes gsize to size_t, and vice versa, depending on the surrounding context. For a complete discussion, see: https://gitlab.gnome.org/GNOME/gjs/-/merge_requests/680 --- gi/arg.cpp.orig +++ gi/arg.cpp @@ -1267,7 +1267,7 @@ GITransfer transfer, bool may_be_null, gpointer *contents, - gsize *length_p) + size_t *length_p) { bool ret = false; GITypeInfo *param_info; @@ -1960,7 +1960,7 @@ case GI_TYPE_TAG_ARRAY: { gpointer data; - gsize length; + size_t length; GIArrayType array_type = g_type_info_get_array_type(type_info); /* First, let's handle the case where we're passed an instance --- gi/function.cpp.orig +++ gi/function.cpp @@ -831,12 +831,12 @@ GjsAutoChar name = format_function_name(function, is_method); JS_ReportWarningUTF8(context, "Too many arguments to %s: expected %d, " "got %" G_GSIZE_FORMAT, name.get(), - function->expected_js_argc, args.length()); + function->expected_js_argc, (gsize)args.length()); } else if (args.length() < function->expected_js_argc) { GjsAutoChar name = format_function_name(function, is_method); gjs_throw(context, "Too few arguments to %s: " "expected %d, got %" G_GSIZE_FORMAT, - name.get(), function->expected_js_argc, args.length()); + name.get(), function->expected_js_argc, (gsize)args.length()); return false; } @@ -991,7 +991,7 @@ GIArgInfo array_length_arg; gint array_length_pos = g_type_info_get_array_length(&ainfo); - gsize length; + size_t length; if (!gjs_value_to_explicit_array(context, args[js_arg_pos], &arg_info, in_value, &length)) { @@ -1239,7 +1239,7 @@ arg->v_pointer = NULL; } } else if (param_type == PARAM_ARRAY) { - gsize length; + size_t length; GIArgInfo array_length_arg; GITypeInfo array_length_type; gint array_length_pos = g_type_info_get_array_length(&arg_type_info); --- gjs/byteArray.cpp.orig +++ gjs/byteArray.cpp @@ -269,7 +269,7 @@ gbytes = (GBytes*) gjs_c_struct_from_boxed(context, bytes_obj); - size_t len; + gsize len; const void* data = g_bytes_get_data(gbytes, &len); JS::RootedObject array_buffer( context, --- gjs/context.cpp.orig +++ gjs/context.cpp @@ -994,7 +994,7 @@ GError **error) { char *script; - size_t script_len; + gsize script_len; GjsAutoUnref file = g_file_new_for_commandline_arg(filename); if (!g_file_load_contents(file, nullptr, &script, &script_len, nullptr, --- gjs/module.cpp.orig +++ gjs/module.cpp @@ -145,7 +145,7 @@ { GError *error = nullptr; char *unowned_script; - size_t script_len = 0; + gsize script_len = 0; if (!(g_file_load_contents(file, nullptr, &unowned_script, &script_len, nullptr, &error)))