Merge branch 'wip/smcv/warnings' into 'master'

Fix and enable more compiler warnings

See merge request GNOME/libglnx!35
This commit is contained in:
Phaedrus Leeds
2022-05-10 18:08:28 +00:00
5 changed files with 11 additions and 10 deletions

View File

@@ -143,7 +143,7 @@ glnx_console_lines (void)
}
static void
on_sigwinch (int signum)
on_sigwinch (G_GNUC_UNUSED int signum)
{
cached_columns = 0;
cached_lines = 0;

View File

@@ -229,7 +229,7 @@ open_tmpfile_core (int dfd, const char *subpath,
const guint count_max = 100;
{ g_autofree char *tmp = g_strconcat (subpath, "/tmp.XXXXXX", NULL);
for (int count = 0; count < count_max; count++)
for (guint count = 0; count < count_max; count++)
{
glnx_gen_temp_name (tmp);
@@ -660,7 +660,7 @@ glnx_file_get_contents_utf8_at (int dfd,
char *
glnx_readlinkat_malloc (int dfd,
const char *subpath,
GCancellable *cancellable,
G_GNUC_UNUSED GCancellable *cancellable,
GError **error)
{
dfd = glnx_dirfd_canonicalize (dfd);
@@ -1106,7 +1106,7 @@ glnx_file_replace_contents_with_perms_at (int dfd,
uid_t uid,
gid_t gid,
GLnxFileReplaceFlags flags,
GCancellable *cancellable,
G_GNUC_UNUSED GCancellable *cancellable,
GError **error)
{
char *dnbuf = strdupa (subpath);
@@ -1130,7 +1130,7 @@ glnx_file_replace_contents_with_perms_at (int dfd,
&tmpf, error))
return FALSE;
if (len == -1)
if (len == (gsize) -1)
len = strlen ((char*)buf);
if (!glnx_try_fallocate (tmpf.fd, 0, len, error))

View File

@@ -141,7 +141,7 @@ static gboolean
get_xattrs_impl (const char *path,
int fd,
GVariant **out_xattrs,
GCancellable *cancellable,
G_GNUC_UNUSED GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
@@ -269,7 +269,7 @@ glnx_dfd_name_get_all_xattrs (int dfd,
static gboolean
set_all_xattrs_for_path (const char *path,
GVariant *xattrs,
GCancellable *cancellable,
G_GNUC_UNUSED GCancellable *cancellable,
GError **error)
{
const guint n = g_variant_n_children (xattrs);
@@ -337,7 +337,7 @@ glnx_dfd_name_set_all_xattrs (int dfd,
gboolean
glnx_fd_set_all_xattrs (int fd,
GVariant *xattrs,
GCancellable *cancellable,
G_GNUC_UNUSED GCancellable *cancellable,
GError **error)
{
const guint n = g_variant_n_children (xattrs);

View File

@@ -7,6 +7,7 @@ project(
'c',
default_options : [
'c_std=gnu99',
'warning_level=3',
],
)

View File

@@ -122,7 +122,7 @@ do_write_run (GLnxDirFdIterator *dfd_iter, GError **error)
if (!glnx_fd_get_all_xattrs (fd, &current_xattrs, NULL, error))
return FALSE;
for (int i = 0; i < g_variant_n_children (current_xattrs); i++)
for (size_t i = 0; i < g_variant_n_children (current_xattrs); i++)
{
const char *name, *value;
g_variant_get_child (current_xattrs, i, "(^&ay^&ay)", &name, &value);
@@ -182,7 +182,7 @@ xattr_thread (gpointer data)
g_autoptr(GError) local_error = NULL;
GError **error = &local_error;
struct XattrWorker *worker = data;
guint64 end_time = g_get_monotonic_time () + XATTR_THREAD_RUN_TIME_USECS;
gint64 end_time = g_get_monotonic_time () + XATTR_THREAD_RUN_TIME_USECS;
guint n_read = 0;
while (g_get_monotonic_time () < end_time)