Run uncrustify

I had to make a few manual edits but other than those the changes look
reasonable.

Closes: #2715
Approved by: matthiasclasen
This commit is contained in:
Matthew Leeds 2019-02-21 23:31:36 -08:00 committed by Atomic Bot
parent 7d72dd713f
commit 8d962a686f
54 changed files with 1021 additions and 945 deletions

View File

@ -474,7 +474,7 @@ flatpak_builtin_build_commit_from (int argc, char **argv, GCancellable *cancella
}
}
g_ptr_array_sort (collection_ids, (GCompareFunc)flatpak_strcmp0_ptr);
g_ptr_array_sort (collection_ids, (GCompareFunc) flatpak_strcmp0_ptr);
/* Copy old metadata */
g_variant_builder_init (&metadata_builder, G_VARIANT_TYPE ("a{sv}"));

View File

@ -296,12 +296,13 @@ find_file_in_tree (GFile *base, const char *filename)
return FALSE;
}
typedef gboolean (* VisitFileFunc) (GFile *file, GError **error);
typedef gboolean (* VisitFileFunc) (GFile *file,
GError **error);
static gboolean
visit_files_in_tree (GFile *base,
visit_files_in_tree (GFile *base,
VisitFileFunc visit_file,
gpointer data)
gpointer data)
{
g_autoptr(GFileEnumerator) enumerator = NULL;
GError **error = data;
@ -383,7 +384,7 @@ validate_icon_file (GFile *file, GError **error)
g_ptr_array_add (args, NULL);
if (!g_spawn_sync (NULL, (char **)args->pdata, NULL, 0, NULL, NULL, NULL, &err, &status, error))
if (!g_spawn_sync (NULL, (char **) args->pdata, NULL, 0, NULL, NULL, NULL, &err, &status, error))
{
g_debug ("Icon validation: %s", (*error)->message);
return FALSE;

View File

@ -59,7 +59,7 @@ static GOptionEntry options[] = {
{ "runtime", 0, 0, G_OPTION_ARG_STRING, &opt_runtime, N_("Change the runtime used for the app"), N_("RUNTIME") },
{ "metadata", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_metadata, N_("Set generic metadata option"), N_("GROUP=KEY[=VALUE]") },
{ "no-inherit-permissions", 0, 0, G_OPTION_ARG_NONE, &opt_no_inherit_permissions, N_("Don't inherit permissions from runtime"), NULL },
{ NULL }
{ NULL }
};
static gboolean

View File

@ -86,7 +86,7 @@ get_flatpak_subpaths_from_deploy_subpaths (const char * const *subpaths)
g_ptr_array_add (resolved_subpaths, g_build_filename ("/files", subpaths[i], NULL));
g_ptr_array_add (resolved_subpaths, NULL);
return (char **)g_ptr_array_free (g_steal_pointer (&resolved_subpaths), FALSE);
return (char **) g_ptr_array_free (g_steal_pointer (&resolved_subpaths), FALSE);
}
/* Add related refs specified in the metadata of @ref to @all_refs, also
@ -168,7 +168,7 @@ add_related (GHashTable *all_refs,
ext_commit = flatpak_deploy_data_get_commit (ext_deploy_data);
ext_subpaths = flatpak_deploy_data_get_subpaths (ext_deploy_data);
resolved_ext_subpaths = get_flatpak_subpaths_from_deploy_subpaths (ext_subpaths);
c_s = commit_and_subpaths_new (ext_commit, (const char * const *)resolved_ext_subpaths);
c_s = commit_and_subpaths_new (ext_commit, (const char * const *) resolved_ext_subpaths);
g_hash_table_insert (all_collection_ids, g_strdup (ext_collection_id), g_strdup (ext_remote));
ext_collection_ref = ostree_collection_ref_new (ext_collection_id, ext->ref);
@ -238,7 +238,7 @@ add_runtime (GHashTable *all_refs,
runtime_commit = flatpak_deploy_data_get_commit (runtime_deploy_data);
runtime_subpaths = flatpak_deploy_data_get_subpaths (runtime_deploy_data);
resolved_runtime_subpaths = get_flatpak_subpaths_from_deploy_subpaths (runtime_subpaths);
c_s = commit_and_subpaths_new (runtime_commit, (const char * const *)resolved_runtime_subpaths);
c_s = commit_and_subpaths_new (runtime_commit, (const char * const *) resolved_runtime_subpaths);
g_hash_table_insert (all_collection_ids, g_strdup (runtime_collection_id), g_strdup (runtime_remote));
runtime_collection_ref = ostree_collection_ref_new (runtime_collection_id, runtime_ref);

View File

@ -53,10 +53,10 @@ static Column all_columns[] = {
};
static gboolean
print_documents (const char *app_id,
Column *columns,
print_documents (const char *app_id,
Column *columns,
GCancellable *cancellable,
GError **error)
GError **error)
{
g_autoptr(GDBusConnection) session_bus = NULL;
XdpDbusDocuments *documents;
@ -129,7 +129,7 @@ print_documents (const char *app_id,
{
g_autofree char *value = NULL;
if (perms)
value = g_strjoinv (" ", (char **)perms);
value = g_strjoinv (" ", (char **) perms);
flatpak_table_printer_add_column (printer, value);
}
else if (just_perms)

View File

@ -117,8 +117,8 @@ flatpak_builtin_enter (int argc,
instances = flatpak_instance_get_all ();
for (j = 0; j < instances->len; j++)
{
FlatpakInstance *instance = (FlatpakInstance *)g_ptr_array_index (instances, j);
FlatpakInstance *instance = (FlatpakInstance *) g_ptr_array_index (instances, j);
if (i == flatpak_instance_get_pid (instance) ||
strcmp (pid_s, flatpak_instance_get_app (instance)) == 0 ||
strcmp (pid_s, flatpak_instance_get_id (instance)) == 0)
@ -277,7 +277,7 @@ flatpak_complete_enter (FlatpakCompletion *completion)
instances = flatpak_instance_get_all ();
for (i = 0; i < instances->len; i++)
{
FlatpakInstance *instance = (FlatpakInstance *)g_ptr_array_index (instances, i);
FlatpakInstance *instance = (FlatpakInstance *) g_ptr_array_index (instances, i);
flatpak_complete_word (completion, "%s ", flatpak_instance_get_app (instance));
flatpak_complete_word (completion, "%s ", flatpak_instance_get_id (instance));
}

View File

@ -76,13 +76,13 @@ static Column all_columns[] = {
static char *
get_field (sd_journal *j,
const char *name,
GError **error)
GError **error)
{
const char *data;
gsize len;
int r;
if ((r = sd_journal_get_data (j, name, (const void **)&data, &len)) < 0)
if ((r = sd_journal_get_data (j, name, (const void **) &data, &len)) < 0)
{
if (r != -ENOENT)
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
@ -97,7 +97,7 @@ get_field (sd_journal *j,
static GDateTime *
get_time (sd_journal *j,
GError **error)
GError **error)
{
g_autofree char *value = NULL;
GError *local_error = NULL;
@ -116,13 +116,13 @@ get_time (sd_journal *j,
}
static gboolean
print_history (GPtrArray *dirs,
Column *columns,
GDateTime *since,
GDateTime *until,
gboolean reverse,
print_history (GPtrArray *dirs,
Column *columns,
GDateTime *since,
GDateTime *until,
gboolean reverse,
GCancellable *cancellable,
GError **error)
GError **error)
{
FlatpakTablePrinter *printer;
sd_journal *j;
@ -159,179 +159,179 @@ print_history (GPtrArray *dirs,
if (ret == 0)
while ((reverse && sd_journal_previous (j) > 0) ||
(!reverse && sd_journal_next (j) > 0))
{
/* determine whether to skip this entry */
{
/* determine whether to skip this entry */
if (dirs)
{
gboolean include = FALSE;
g_autofree char *installation = get_field (j, "INSTALLATION", NULL);
if (dirs)
{
gboolean include = FALSE;
g_autofree char *installation = get_field (j, "INSTALLATION", NULL);
if (installation && installation[0] == '/')
include = TRUE; /* pull to a temp repo */
if (installation && installation[0] == '/')
include = TRUE; /* pull to a temp repo */
for (i = 0; i < dirs->len && !include; i++)
{
g_autofree char *name = flatpak_dir_get_name (dirs->pdata[i]);
if (g_strcmp0 (name, installation) == 0)
include = TRUE;
}
if (!include)
continue;
}
for (i = 0; i < dirs->len && !include; i++)
{
g_autofree char *name = flatpak_dir_get_name (dirs->pdata[i]);
if (g_strcmp0 (name, installation) == 0)
include = TRUE;
}
if (!include)
continue;
}
if (since || until)
{
g_autoptr(GDateTime) time = get_time (j, NULL);
if (since || until)
{
g_autoptr(GDateTime) time = get_time (j, NULL);
if (since && time && g_date_time_difference (since, time) >= 0)
continue;
if (since && time && g_date_time_difference (since, time) >= 0)
continue;
if (until && time && g_date_time_difference (until, time) <= 0)
continue;
}
if (until && time && g_date_time_difference (until, time) <= 0)
continue;
}
for (k = 0; columns[k].name; k++)
{
if (strcmp (columns[k].name, "time") == 0)
{
g_autoptr(GDateTime) time = NULL;
g_autofree char *s = NULL;
for (k = 0; columns[k].name; k++)
{
if (strcmp (columns[k].name, "time") == 0)
{
g_autoptr(GDateTime) time = NULL;
g_autofree char *s = NULL;
time = get_time (j, error);
if (*error)
return FALSE;
time = get_time (j, error);
if (*error)
return FALSE;
s = g_date_time_format (time, "%b %e %T");
flatpak_table_printer_add_column (printer, s);
}
else if (strcmp (columns[k].name, "change") == 0)
{
g_autofree char *op = get_field (j, "OPERATION", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column (printer, op);
}
else if (strcmp (columns[k].name, "ref") == 0 ||
strcmp (columns[k].name, "application") == 0 ||
strcmp (columns[k].name, "arch") == 0 ||
strcmp (columns[k].name, "branch") == 0)
{
g_autofree char *ref = get_field (j, "REF", error);
if (*error)
return FALSE;
if (strcmp (columns[k].name, "ref") == 0)
flatpak_table_printer_add_column (printer, ref);
else
{
g_auto(GStrv) pref = flatpak_decompose_ref (ref, NULL);
if (strcmp (columns[k].name, "application") == 0)
flatpak_table_printer_add_column (printer, pref ? pref[1] : "");
else if (strcmp (columns[k].name, "arch") == 0)
flatpak_table_printer_add_column (printer, pref ? pref[2] : "");
else
flatpak_table_printer_add_column (printer, pref ? pref[3] : "");
}
}
else if (strcmp (columns[k].name, "installation") == 0)
{
g_autofree char *installation = get_field (j, "INSTALLATION", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column (printer, installation);
}
else if (strcmp (columns[k].name, "remote") == 0)
{
g_autofree char *remote = get_field (j, "REMOTE", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column (printer, remote);
}
else if (strcmp (columns[k].name, "commit") == 0)
{
g_autofree char *commit = get_field (j, "COMMIT", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column_len (printer, commit, 12);
}
else if (strcmp (columns[k].name, "old-commit") == 0)
{
g_autofree char *old_commit = get_field (j, "OLD_COMMIT", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column_len (printer, old_commit, 12);
}
else if (strcmp (columns[k].name, "url") == 0)
{
g_autofree char *url = get_field (j, "URL", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column (printer, url);
}
else if (strcmp (columns[k].name, "user") == 0)
{
g_autofree char *id = get_field (j, "_UID", error);
g_autofree char *oid = NULL;
int uid;
struct passwd *pwd;
s = g_date_time_format (time, "%b %e %T");
flatpak_table_printer_add_column (printer, s);
}
else if (strcmp (columns[k].name, "change") == 0)
{
g_autofree char *op = get_field (j, "OPERATION", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column (printer, op);
}
else if (strcmp (columns[k].name, "ref") == 0 ||
strcmp (columns[k].name, "application") == 0 ||
strcmp (columns[k].name, "arch") == 0 ||
strcmp (columns[k].name, "branch") == 0)
{
g_autofree char *ref = get_field (j, "REF", error);
if (*error)
return FALSE;
if (strcmp (columns[k].name, "ref") == 0)
flatpak_table_printer_add_column (printer, ref);
else
{
g_auto(GStrv) pref = flatpak_decompose_ref (ref, NULL);
if (strcmp (columns[k].name, "application") == 0)
flatpak_table_printer_add_column (printer, pref ? pref[1] : "");
else if (strcmp (columns[k].name, "arch") == 0)
flatpak_table_printer_add_column (printer, pref ? pref[2] : "");
else
flatpak_table_printer_add_column (printer, pref ? pref[3] : "");
}
}
else if (strcmp (columns[k].name, "installation") == 0)
{
g_autofree char *installation = get_field (j, "INSTALLATION", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column (printer, installation);
}
else if (strcmp (columns[k].name, "remote") == 0)
{
g_autofree char *remote = get_field (j, "REMOTE", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column (printer, remote);
}
else if (strcmp (columns[k].name, "commit") == 0)
{
g_autofree char *commit = get_field (j, "COMMIT", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column_len (printer, commit, 12);
}
else if (strcmp (columns[k].name, "old-commit") == 0)
{
g_autofree char *old_commit = get_field (j, "OLD_COMMIT", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column_len (printer, old_commit, 12);
}
else if (strcmp (columns[k].name, "url") == 0)
{
g_autofree char *url = get_field (j, "URL", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column (printer, url);
}
else if (strcmp (columns[k].name, "user") == 0)
{
g_autofree char *id = get_field (j, "_UID", error);
g_autofree char *oid = NULL;
int uid;
struct passwd *pwd;
if (*error)
return FALSE;
if (*error)
return FALSE;
uid = g_ascii_strtoll (id, NULL, 10);
pwd = getpwuid (uid);
if (pwd)
{
g_free (id);
id = g_strdup (pwd->pw_name);
}
uid = g_ascii_strtoll (id, NULL, 10);
pwd = getpwuid (uid);
if (pwd)
{
g_free (id);
id = g_strdup (pwd->pw_name);
}
oid = get_field (j, "OBJECT_UID", NULL);
if (oid)
{
/* flatpak-system-helper acting on behalf of sb else */
g_autofree char *str = NULL;
uid = g_ascii_strtoll (oid, NULL, 10);
pwd = getpwuid (uid);
str = g_strdup_printf ("%s (%s)", id, pwd ? pwd->pw_name : oid);
flatpak_table_printer_add_column (printer, str);
}
else
flatpak_table_printer_add_column (printer, id);
}
else if (strcmp (columns[k].name, "tool") == 0)
{
g_autofree char *exe = get_field (j, "_EXE", error);
g_autofree char *oexe = NULL;
g_autofree char *tool = NULL;
if (*error)
return FALSE;
tool = g_path_get_basename (exe);
oexe = get_field (j, "OBJECT_EXE", NULL);
if (oexe)
{
/* flatpak-system-helper acting on behalf of sb else */
g_autofree char *otool = NULL;
g_autofree char *str = NULL;
oid = get_field (j, "OBJECT_UID", NULL);
if (oid)
{
/* flatpak-system-helper acting on behalf of sb else */
g_autofree char *str = NULL;
uid = g_ascii_strtoll (oid, NULL, 10);
pwd = getpwuid (uid);
str = g_strdup_printf ("%s (%s)", id, pwd ? pwd->pw_name : oid);
flatpak_table_printer_add_column (printer, str);
}
else
flatpak_table_printer_add_column (printer, id);
}
else if (strcmp (columns[k].name, "tool") == 0)
{
g_autofree char *exe = get_field (j, "_EXE", error);
g_autofree char *oexe = NULL;
g_autofree char *tool = NULL;
if (*error)
return FALSE;
tool = g_path_get_basename (exe);
oexe = get_field (j, "OBJECT_EXE", NULL);
if (oexe)
{
/* flatpak-system-helper acting on behalf of sb else */
g_autofree char *otool = NULL;
g_autofree char *str = NULL;
otool = g_path_get_basename (oexe);
str = g_strdup_printf ("%s (%s)", tool, otool);
flatpak_table_printer_add_column (printer, str);
}
else
flatpak_table_printer_add_column (printer, tool);
}
else if (strcmp (columns[k].name, "version") == 0)
{
g_autofree char *version = get_field (j, "FLATPAK_VERSION", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column (printer, version);
}
}
otool = g_path_get_basename (oexe);
str = g_strdup_printf ("%s (%s)", tool, otool);
flatpak_table_printer_add_column (printer, str);
}
else
flatpak_table_printer_add_column (printer, tool);
}
else if (strcmp (columns[k].name, "version") == 0)
{
g_autofree char *version = get_field (j, "FLATPAK_VERSION", error);
if (*error)
return FALSE;
flatpak_table_printer_add_column (printer, version);
}
}
flatpak_table_printer_finish_row (printer);
}
flatpak_table_printer_finish_row (printer);
}
flatpak_table_printer_print (printer);
flatpak_table_printer_free (printer);
@ -344,13 +344,13 @@ print_history (GPtrArray *dirs,
#else
static gboolean
print_history (GPtrArray *dirs,
Column *columns,
GDateTime *since,
GDateTime *until,
gboolean reverse,
print_history (GPtrArray *dirs,
Column *columns,
GDateTime *since,
GDateTime *until,
gboolean reverse,
GCancellable *cancellable,
GError **error)
GError **error)
{
if (columns[0].name == NULL)
return TRUE;
@ -364,7 +364,7 @@ print_history (GPtrArray *dirs,
static GDateTime *
parse_time (const char *opt_since)
{
g_autoptr (GDateTime) now = NULL;
g_autoptr(GDateTime) now = NULL;
g_auto(GStrv) parts = NULL;
int i;
int days = 0;
@ -380,7 +380,7 @@ parse_time (const char *opt_since)
now = g_date_time_new_now_local ();
for (i = 0; i < G_N_ELEMENTS(fmts); i++)
for (i = 0; i < G_N_ELEMENTS (fmts); i++)
{
const char *rest;
struct tm tm;
@ -394,7 +394,7 @@ parse_time (const char *opt_since)
rest = strptime (opt_since, fmts[i], &tm);
if (rest && *rest == '\0')
return g_date_time_new_local (tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
return g_date_time_new_local (tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
}
parts = g_strsplit (opt_since, " ", -1);

View File

@ -314,7 +314,7 @@ flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError *
print_aligned (len, _("Date:"), formatted_timestamp);
if (subpaths[0] != NULL)
{
g_autofree char *s = g_strjoinv (",", (char **)subpaths);
g_autofree char *s = g_strjoinv (",", (char **) subpaths);
print_aligned (len, _("Subdirectories:"), s);
}

View File

@ -412,15 +412,15 @@ flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro
}
}
if (remote_dir_pairs->len == 0)
return flatpak_fail (error, _("No remote refs found similar to %s"), argv[1]);
if (remote_dir_pairs->len == 0)
return flatpak_fail (error, _("No remote refs found similar to %s"), argv[1]);
if (!flatpak_resolve_matching_remotes (opt_yes, remote_dir_pairs, argv[1], &chosen_pair, error))
return FALSE;
if (!flatpak_resolve_matching_remotes (opt_yes, remote_dir_pairs, argv[1], &chosen_pair, error))
return FALSE;
remote = g_strdup (chosen_pair->remote_name);
g_clear_object (&dir);
dir = g_object_ref (chosen_pair->dir);
remote = g_strdup (chosen_pair->remote_name);
g_clear_object (&dir);
dir = g_object_ref (chosen_pair->dir);
}
}
@ -479,9 +479,9 @@ flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro
if (opt_no_pull)
refs = flatpak_dir_find_local_refs (dir, remote, id, branch, default_branch, arch,
flatpak_get_default_arch (),
matched_kinds, FIND_MATCHING_REFS_FLAGS_FUZZY,
cancellable, error);
flatpak_get_default_arch (),
matched_kinds, FIND_MATCHING_REFS_FLAGS_FUZZY,
cancellable, error);
else
refs = flatpak_dir_find_remote_refs (dir, remote, id, branch, default_branch, arch,
flatpak_get_default_arch (),
@ -503,7 +503,7 @@ flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro
if (!flatpak_resolve_matching_refs (remote, dir, opt_yes, refs, id, &ref, error))
return FALSE;
if (!flatpak_transaction_add_install (transaction, remote, ref, (const char **)opt_subpaths, error))
if (!flatpak_transaction_add_install (transaction, remote, ref, (const char **) opt_subpaths, error))
{
if (!g_error_matches (*error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED))
return FALSE;

View File

@ -42,7 +42,7 @@ static GOptionEntry options[] = {
static gboolean
kill_instance (const char *id,
GError **error)
GError **error)
{
g_autoptr(GPtrArray) instances = NULL;
int j;
@ -52,7 +52,7 @@ kill_instance (const char *id,
for (j = 0; j < instances->len; j++)
{
FlatpakInstance *instance = (FlatpakInstance *)g_ptr_array_index (instances, j);
FlatpakInstance *instance = (FlatpakInstance *) g_ptr_array_index (instances, j);
if (strcmp (id, flatpak_instance_get_app (instance)) == 0 ||
strcmp (id, flatpak_instance_get_id (instance)) == 0)
{
@ -61,7 +61,7 @@ kill_instance (const char *id,
killed++;
}
}
g_debug ("Killed %d instances", killed);
if (killed == 0)
@ -71,10 +71,10 @@ kill_instance (const char *id,
}
gboolean
flatpak_builtin_kill (int argc,
char **argv,
GCancellable *cancellable,
GError **error)
flatpak_builtin_kill (int argc,
char **argv,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GOptionContext) context = NULL;
const char *instance;
@ -123,7 +123,7 @@ flatpak_complete_kill (FlatpakCompletion *completion)
instances = flatpak_instance_get_all ();
for (i = 0; i < instances->len; i++)
{
FlatpakInstance *instance = (FlatpakInstance *)g_ptr_array_index (instances, i);
FlatpakInstance *instance = (FlatpakInstance *) g_ptr_array_index (instances, i);
flatpak_complete_word (completion, "%s ", flatpak_instance_get_app (instance));
flatpak_complete_word (completion, "%s ", flatpak_instance_get_id (instance));
}

View File

@ -124,11 +124,11 @@ join_strv (char **a, char **b)
}
static gboolean
find_refs_for_dir (FlatpakDir *dir,
GStrv *apps,
GStrv *runtimes,
find_refs_for_dir (FlatpakDir *dir,
GStrv *apps,
GStrv *runtimes,
GCancellable *cancellable,
GError **error)
GError **error)
{
if (flatpak_dir_ensure_repo (dir, cancellable, NULL))
{
@ -142,13 +142,13 @@ find_refs_for_dir (FlatpakDir *dir,
}
static gboolean
print_table_for_refs (gboolean print_apps,
GPtrArray * refs_array,
const char *arch,
const char *app_runtime,
Column *columns,
print_table_for_refs (gboolean print_apps,
GPtrArray * refs_array,
const char *arch,
const char *app_runtime,
Column *columns,
GCancellable *cancellable,
GError **error)
GError **error)
{
FlatpakTablePrinter *printer;
int i;
@ -346,7 +346,7 @@ print_table_for_refs (gboolean print_apps,
subpaths = flatpak_deploy_data_get_subpaths (deploy_data);
if (subpaths[0] != NULL)
{
g_autofree char *paths = g_strjoinv (" ", (char **)subpaths);
g_autofree char *paths = g_strjoinv (" ", (char **) subpaths);
g_autofree char *value = g_strconcat ("partial (", paths, ")", NULL);
flatpak_table_printer_append_with_comma (printer, value);
}
@ -363,7 +363,7 @@ print_table_for_refs (gboolean print_apps,
}
}
flatpak_table_printer_sort (printer, (GCompareFunc)flatpak_compare_ref);
flatpak_table_printer_sort (printer, (GCompareFunc) flatpak_compare_ref);
if (flatpak_table_printer_get_current_row (printer) > 0)
{
@ -378,14 +378,14 @@ print_table_for_refs (gboolean print_apps,
}
static gboolean
print_installed_refs (gboolean app,
gboolean runtime,
GPtrArray *dirs,
const char *arch,
const char *app_runtime,
Column *cols,
print_installed_refs (gboolean app,
gboolean runtime,
GPtrArray *dirs,
const char *arch,
const char *app_runtime,
Column *cols,
GCancellable *cancellable,
GError **error)
GError **error)
{
g_autoptr(GPtrArray) refs_array = NULL;
int i;

View File

@ -95,7 +95,7 @@ remove_for_app (XdpDbusPermissionStore *store,
gboolean
reset_permissions_for_app (const char *app_id,
GError **error)
GError **error)
{
g_autoptr(GDBusConnection) session_bus = NULL;
XdpDbusPermissionStore *store = NULL;

View File

@ -69,7 +69,7 @@ enumerate_instances (Column *columns, GError **error)
printer = flatpak_table_printer_new ();
flatpak_table_printer_set_columns (printer, columns);
instances = flatpak_instance_get_all ();
if (instances->len == 0)
{
@ -79,7 +79,7 @@ enumerate_instances (Column *columns, GError **error)
for (j = 0; j < instances->len; j++)
{
FlatpakInstance *instance = (FlatpakInstance *)g_ptr_array_index (instances, j);
FlatpakInstance *instance = (FlatpakInstance *) g_ptr_array_index (instances, j);
flatpak_table_printer_add_column (printer, flatpak_instance_get_id (instance));
@ -139,10 +139,10 @@ enumerate_instances (Column *columns, GError **error)
}
gboolean
flatpak_builtin_ps (int argc,
char **argv,
GCancellable *cancellable,
GError **error)
flatpak_builtin_ps (int argc,
char **argv,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GOptionContext) context = NULL;
g_autofree char *col_help = NULL;

View File

@ -75,7 +75,7 @@ flatpak_builtin_remote_delete (int argc, char **argv, GCancellable *cancellable,
g_autoptr(GPtrArray) refs_to_remove = NULL;
int i;
refs = flatpak_dir_find_installed_refs (preferred_dir, NULL, NULL, NULL, FLATPAK_KINDS_APP|FLATPAK_KINDS_RUNTIME, 0, error);
refs = flatpak_dir_find_installed_refs (preferred_dir, NULL, NULL, NULL, FLATPAK_KINDS_APP | FLATPAK_KINDS_RUNTIME, 0, error);
if (refs == NULL)
return FALSE;
@ -94,7 +94,7 @@ flatpak_builtin_remote_delete (int argc, char **argv, GCancellable *cancellable,
g_ptr_array_add (refs_to_remove, NULL);
flatpak_format_choices ((const char **)refs_to_remove->pdata,
flatpak_format_choices ((const char **) refs_to_remove->pdata,
_("The following refs are installed from remote '%s':"), remote_name);
if (!flatpak_yes_no_prompt (FALSE, _("Remove them?")))
return flatpak_fail_error (error, FLATPAK_ERROR_REMOTE_USED,

View File

@ -279,7 +279,7 @@ flatpak_builtin_remote_info (int argc, char **argv, GCancellable *cancellable, G
if (parent)
{
g_autofree char *formatted_commit = ellipsize_string (parent, width);
print_aligned (len, _("Parent:"), formatted_commit);
print_aligned (len, _("Parent:"), formatted_commit);
}
if (eol)
{

View File

@ -181,7 +181,7 @@ flatpak_builtin_remote_list (int argc, char **argv, GCancellable *cancellable, G
columns = handle_column_args (all_columns, opt_show_details, opt_cols, error);
if (columns == NULL)
return FALSE;
return list_remotes (dirs, columns, cancellable, error);
}

View File

@ -109,6 +109,7 @@ ls_remote (GHashTable *refs_hash, const char **arches, const char *app_runtime,
guint n_keys;
g_autofree const char **keys = NULL;
int i, j;
g_autoptr(GHashTable) pref_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
FlatpakKinds match_kinds;
g_autofree char *match_id = NULL;
@ -273,9 +274,9 @@ ls_remote (GHashTable *refs_hash, const char **arches, const char *app_runtime,
error))
return FALSE;
metakey = g_key_file_new ();
if (g_key_file_load_from_data (metakey, metadata, -1, 0, NULL))
runtime = g_key_file_get_string (metakey, "Application", "runtime", NULL);
metakey = g_key_file_new ();
if (g_key_file_load_from_data (metakey, metadata, -1, 0, NULL))
runtime = g_key_file_get_string (metakey, "Application", "runtime", NULL);
}
if (need_appstream_data)

View File

@ -79,7 +79,7 @@ fsck_one_object (OstreeRepo *repo,
else
{
g_printerr (_("%s, deleting object\n"), local_error->message);
(void)ostree_repo_delete_object (repo, objtype, checksum, NULL, NULL);
(void) ostree_repo_delete_object (repo, objtype, checksum, NULL, NULL);
}
return FSCK_STATUS_HAS_INVALID_OBJECTS;
}
@ -385,9 +385,11 @@ flatpak_builtin_repair (int argc, char **argv, GCancellable *cancellable, GError
case FSCK_STATUS_HAS_MISSING_OBJECTS:
g_printerr (_("Deleting ref %s due to missing objects\n"), refspec);
break;
case FSCK_STATUS_HAS_INVALID_OBJECTS:
g_printerr (_("Deleting ref %s due to invalid objects\n"), refspec);
break;
default:
g_printerr (_("Deleting ref %s due to %d\n"), refspec, status);
break;
@ -494,9 +496,9 @@ flatpak_builtin_repair (int argc, char **argv, GCancellable *cancellable, GError
g_prefix_error (error, _("While removing appstream for %s: "), remote);
return FALSE;
}
if (!flatpak_dir_deploy_appstream (dir, remote, parts[1], &changed,
cancellable, error))
cancellable, error))
{
g_prefix_error (error, _("While deploying appstream for %s: "), remote);
return FALSE;

View File

@ -35,9 +35,9 @@
static gboolean
ostree_repo_mode_to_string (OstreeRepoMode mode,
const char **out_mode,
GError **error)
ostree_repo_mode_to_string (OstreeRepoMode mode,
const char **out_mode,
GError **error)
{
const char *ret_mode;
@ -46,16 +46,20 @@ ostree_repo_mode_to_string (OstreeRepoMode mode,
case OSTREE_REPO_MODE_BARE:
ret_mode = "bare";
break;
case OSTREE_REPO_MODE_BARE_USER:
ret_mode = "bare-user";
break;
case OSTREE_REPO_MODE_BARE_USER_ONLY:
ret_mode = "bare-user-only";
break;
case OSTREE_REPO_MODE_ARCHIVE:
/* Legacy alias */
ret_mode ="archive-z2";
ret_mode = "archive-z2";
break;
default:
return glnx_throw (error, "Invalid mode '%d'", mode);
}
@ -66,7 +70,7 @@ ostree_repo_mode_to_string (OstreeRepoMode mode,
static void
print_info (OstreeRepo *repo,
GVariant *meta)
GVariant *meta)
{
g_autoptr(GVariant) cache = NULL;
const char *title;
@ -203,7 +207,7 @@ print_metadata (GVariant *meta,
static void
dump_indented_lines (const gchar *data)
{
const char* indent = " ";
const char * indent = " ";
const gchar *pos;
for (;;)
@ -211,7 +215,7 @@ dump_indented_lines (const gchar *data)
pos = strchr (data, '\n');
if (pos)
{
g_print ("%s%.*s", indent, (int)(pos + 1 - data), data);
g_print ("%s%.*s", indent, (int) (pos + 1 - data), data);
data = pos + 1;
}
else
@ -224,7 +228,7 @@ dump_indented_lines (const gchar *data)
}
static void
dump_deltas_for_commit (GPtrArray *deltas,
dump_deltas_for_commit (GPtrArray *deltas,
const char *checksum)
{
int i;
@ -245,7 +249,7 @@ dump_deltas_for_commit (GPtrArray *deltas,
header_printed = TRUE;
}
g_print (" from scratch\n");
}
}
else if (strchr (delta, '-'))
{
g_auto(GStrv) parts = g_strsplit (delta, "-", 0);
@ -268,9 +272,9 @@ dump_deltas_for_commit (GPtrArray *deltas,
static gboolean
dump_commit (const char *commit,
GVariant *variant,
GPtrArray *deltas,
GError **error)
GVariant *variant,
GPtrArray *deltas,
GError **error)
{
const gchar *subject;
const gchar *body;
@ -311,9 +315,9 @@ dump_commit (const char *commit,
static gboolean
log_commit (OstreeRepo *repo,
const char *checksum,
gboolean is_recurse,
GPtrArray *deltas,
GError **error)
gboolean is_recurse,
GPtrArray *deltas,
GError **error)
{
g_autoptr(GVariant) variant = NULL;
g_autofree char *parent = NULL;
@ -352,9 +356,10 @@ out:
static gboolean
print_commits (OstreeRepo *repo,
const char *ref,
GError **error)
GError **error)
{
g_autofree char *checksum = NULL;
g_autoptr(GPtrArray) deltas = NULL;
if (!ostree_repo_list_static_delta_names (repo, &deltas, NULL, error))

View File

@ -118,11 +118,12 @@ uninstall_dir_ensure (GHashTable *uninstall_dirs,
}
static gboolean
flatpak_delete_data (gboolean opt_yes,
flatpak_delete_data (gboolean opt_yes,
const char *app_id,
GError **error)
GError **error)
{
g_autofree char *path = g_build_filename (g_get_home_dir (), ".var", "app", app_id, NULL);
g_autoptr(GFile) file = g_file_new_for_path (path);
if (!opt_yes &&
@ -428,7 +429,7 @@ flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr
if (!flatpak_delete_data (opt_yes, g_file_info_get_name (info), error))
return FALSE;
}
}
}
return TRUE;

View File

@ -408,7 +408,7 @@ flatpak_resolve_duplicate_remotes (GPtrArray *dirs,
FlatpakDir *dir = g_ptr_array_index (dirs_with_remote, i);
names[i] = flatpak_dir_get_name (dir);
}
flatpak_format_choices ((const char **)names,
flatpak_format_choices ((const char **) names,
_("Remote %s found in multiple installations:"), remote_name);
chosen = flatpak_number_prompt (TRUE, 0, dirs_with_remote->len, _("Which do you want to use (0 to abort)?"));
if (chosen == 0)
@ -428,13 +428,13 @@ flatpak_resolve_duplicate_remotes (GPtrArray *dirs,
}
gboolean
flatpak_resolve_matching_refs (const char *remote_name,
FlatpakDir *dir,
gboolean disable_interaction,
char **refs,
const char *opt_search_ref,
char **out_ref,
GError **error)
flatpak_resolve_matching_refs (const char *remote_name,
FlatpakDir *dir,
gboolean disable_interaction,
char **refs,
const char *opt_search_ref,
char **out_ref,
GError **error)
{
guint chosen = 0;
guint refs_len;
@ -473,7 +473,7 @@ flatpak_resolve_matching_refs (const char *remote_name,
}
else
{
flatpak_format_choices ((const char **)refs,
flatpak_format_choices ((const char **) refs,
_("Similar refs found for %s in remote %s (%s):"),
opt_search_ref, remote_name, dir_name);
chosen = flatpak_number_prompt (TRUE, 0, refs_len, _("Which do you want to use (0 to abort)?"));
@ -489,11 +489,11 @@ flatpak_resolve_matching_refs (const char *remote_name,
}
gboolean
flatpak_resolve_matching_installed_refs (gboolean disable_interaction,
GPtrArray *ref_dir_pairs,
const char *opt_search_ref,
GPtrArray *out_pairs,
GError **error)
flatpak_resolve_matching_installed_refs (gboolean disable_interaction,
GPtrArray *ref_dir_pairs,
const char *opt_search_ref,
GPtrArray *out_pairs,
GError **error)
{
guint chosen = 0;
g_autofree int *choices = NULL;
@ -547,7 +547,7 @@ flatpak_resolve_matching_installed_refs (gboolean disable_interaction,
names[i] = g_strdup_printf ("%s (%s)", pair->ref, flatpak_dir_get_name_cached (pair->dir));
}
names[i] = g_strdup_printf (_("All of the above"));
flatpak_format_choices ((const char **)names, _("Similar installed refs found for %s:"), opt_search_ref);
flatpak_format_choices ((const char **) names, _("Similar installed refs found for %s:"), opt_search_ref);
choices = flatpak_numbers_prompt (TRUE, 0, len, _("Which do you want to use (0 to abort)?"));
if (choices[0] == 0)
return flatpak_fail (error, _("No ref chosen to resolve matches for %s"), opt_search_ref);
@ -566,7 +566,7 @@ flatpak_resolve_matching_installed_refs (gboolean disable_interaction,
}
else
g_ptr_array_add (out_pairs, g_ptr_array_index (ref_dir_pairs, chosen - 1));
}
}
}
else
g_ptr_array_add (out_pairs, g_ptr_array_index (ref_dir_pairs, chosen - 1));
@ -610,7 +610,7 @@ flatpak_resolve_matching_remotes (gboolean disable_interaction,
RemoteDirPair *pair = g_ptr_array_index (remote_dir_pairs, i);
names[i] = g_strdup_printf ("%s (%s)", pair->remote_name, flatpak_dir_get_name_cached (pair->dir));
}
flatpak_format_choices ((const char **)names, _("Remotes found with refs similar to %s:"), opt_search_ref);
flatpak_format_choices ((const char **) names, _("Remotes found with refs similar to %s:"), opt_search_ref);
chosen = flatpak_number_prompt (TRUE, 0, remote_dir_pairs->len, _("Which do you want to use (0 to abort)?"));
if (chosen == 0)
return flatpak_fail (error, _("No remote chosen to resolve matches for %s"), opt_search_ref);
@ -820,9 +820,9 @@ get_permission_tables (XdpDbusPermissionStore *store)
/*** column handling ***/
static gboolean
parse_ellipsize_suffix (const char *p,
parse_ellipsize_suffix (const char *p,
FlatpakEllipsizeMode *mode,
GError **error)
GError **error)
{
if (g_str_equal (":", p))
{
@ -851,9 +851,9 @@ parse_ellipsize_suffix (const char *p,
}
int
find_column (Column *columns,
find_column (Column *columns,
const char *name,
GError **error)
GError **error)
{
int i;
int candidate;
@ -894,9 +894,9 @@ find_column (Column *columns,
}
static Column *
column_filter (Column *columns,
column_filter (Column *columns,
const char *col_arg,
GError **error)
GError **error)
{
g_auto(GStrv) cols = g_strsplit (col_arg, ",", 0);
int n_cols = g_strv_length (cols);
@ -960,8 +960,8 @@ column_help (Column *columns)
g_string_append_printf (s, " %-*s %s\n", len, "all", _("Show all columns"));
g_string_append_printf (s, " %-*s %s\n", len, "help", _("Show available columns"));
g_string_append_printf (s, "\n%s\n",
_("Append :s[tart], :m[iddle], :e[nd] or :f[ull] to change ellipsization"));
g_string_append_printf (s, "\n%s\n",
_("Append :s[tart], :m[iddle], :e[nd] or :f[ull] to change ellipsization"));
return g_string_free (s, FALSE);
}
@ -970,10 +970,10 @@ column_help (Column *columns)
* opt_cols should correspond to --columns
*/
Column *
handle_column_args (Column *all_columns,
gboolean opt_show_all,
handle_column_args (Column *all_columns,
gboolean opt_show_all,
const char **opt_cols,
GError **error)
GError **error)
{
g_autofree char *cols = NULL;
gboolean show_help = FALSE;
@ -996,11 +996,11 @@ handle_column_args (Column *all_columns,
{
g_autofree char *col_help = column_help (all_columns);
g_print ("%s", col_help);
return g_new0 (Column, 1);
return g_new0 (Column, 1);
}
if (opt_cols && !show_all)
cols = g_strjoinv (",", (char**)opt_cols);
cols = g_strjoinv (",", (char **) opt_cols);
else
{
GString *s;
@ -1014,7 +1014,7 @@ handle_column_args (Column *all_columns,
}
cols = g_string_free (s, FALSE);
}
return column_filter (all_columns, cols, error);
}
@ -1120,7 +1120,7 @@ as_app_get_version (AsApp *app)
}
AsApp *
as_store_find_app (AsStore *store,
as_store_find_app (AsStore *store,
const char *ref)
{
g_autoptr(FlatpakRef) rref = flatpak_ref_parse (ref, NULL);
@ -1142,7 +1142,7 @@ as_store_find_app (AsStore *store,
AsApp *app = g_ptr_array_index (apps, i);
AsBundle *bundle = as_app_get_bundle_default (app);
if (bundle &&
#if AS_CHECK_VERSION(0,5,15)
#if AS_CHECK_VERSION (0, 5, 15)
as_bundle_get_kind (bundle) == AS_BUNDLE_KIND_FLATPAK &&
#endif
g_str_equal (as_bundle_get_id (bundle), ref))
@ -1172,14 +1172,15 @@ as_store_find_app (AsStore *store,
* otherwise
*/
gboolean
flatpak_dir_load_appstream_store (FlatpakDir *self,
const gchar *remote_name,
const gchar *arch,
AsStore *store,
GCancellable *cancellable,
GError **error)
flatpak_dir_load_appstream_store (FlatpakDir *self,
const gchar *remote_name,
const gchar *arch,
AsStore *store,
GCancellable *cancellable,
GError **error)
{
const char *install_path = flatpak_file_get_path_cached (flatpak_dir_get_path (self));
g_autoptr(GFile) appstream_file = NULL;
g_autofree char *appstream_path = NULL;
g_autoptr(GError) local_error = NULL;
@ -1226,7 +1227,7 @@ print_aligned (int len, const char *title, const char *value)
off = FLATPAK_ANSI_BOLD_OFF;
}
g_print ("%s%*s%s%s %s\n", on, len - (int)g_utf8_strlen (title, -1), "", title, off, value);
g_print ("%s%*s%s%s %s\n", on, len - (int) g_utf8_strlen (title, -1), "", title, off, value);
}
@ -1279,7 +1280,8 @@ cell_width (const char *text)
while (*p && *p == '\x1b')
p = skip_escape_sequence (p);
if (!*p) break;
if (!*p)
break;
width += 1;
p = g_utf8_next_char (p);
@ -1301,7 +1303,8 @@ cell_advance (const char *text,
while (*p && *p == '\x1b')
p = skip_escape_sequence (p);
if (!*p) break;
if (!*p)
break;
width += 1;
p = g_utf8_next_char (p);
@ -1319,29 +1322,30 @@ print_line_wrapped (int cols, const char *line)
for (i = 0; words[i]; i++)
{
int len = g_utf8_strlen (words[i], -1);
int space = col > 0;
int len = g_utf8_strlen (words[i], -1);
int space = col > 0;
if (col + space + len >= cols)
{
g_print ("\n%s", words[i]);
col = len;
}
else
{
g_print ("%*s%s", space, "", words[i]);
col = col + space + len;
}
if (col + space + len >= cols)
{
g_print ("\n%s", words[i]);
col = len;
}
else
{
g_print ("%*s%s", space, "", words[i]);
col = col + space + len;
}
}
}
void
print_wrapped (int cols,
print_wrapped (int cols,
const char *text,
...)
{
va_list args;
g_autofree char *msg = NULL;
g_auto(GStrv) lines = NULL;
int i;

View File

@ -33,8 +33,8 @@
typedef struct RemoteDirPair
{
gchar *remote_name;
FlatpakDir *dir;
gchar *remote_name;
FlatpakDir *dir;
} RemoteDirPair;
typedef struct RefDirPair
@ -85,11 +85,11 @@ gboolean flatpak_resolve_matching_refs (const char *remote_name,
char **out_ref,
GError **error);
gboolean flatpak_resolve_matching_installed_refs (gboolean disable_interaction,
GPtrArray *ref_dir_pairs,
const char *opt_search_ref,
GPtrArray *out_pairs,
GError **error);
gboolean flatpak_resolve_matching_installed_refs (gboolean disable_interaction,
GPtrArray *ref_dir_pairs,
const char *opt_search_ref,
GPtrArray *out_pairs,
GError **error);
gboolean flatpak_resolve_matching_remotes (gboolean disable_interaction,
GPtrArray *remote_dir_pairs,
@ -107,61 +107,70 @@ gboolean update_appstream (GPtrArray *dirs,
char ** get_permission_tables (XdpDbusPermissionStore *store);
gboolean reset_permissions_for_app (const char *app_id,
GError **error);
GError **error);
/* --columns handling */
typedef enum {
FLATPAK_ELLIPSIZE_MODE_NONE,
FLATPAK_ELLIPSIZE_MODE_START,
FLATPAK_ELLIPSIZE_MODE_MIDDLE,
FLATPAK_ELLIPSIZE_MODE_END,
FLATPAK_ELLIPSIZE_MODE_NONE,
FLATPAK_ELLIPSIZE_MODE_START,
FLATPAK_ELLIPSIZE_MODE_MIDDLE,
FLATPAK_ELLIPSIZE_MODE_END,
} FlatpakEllipsizeMode;
typedef struct {
const char *name;
const char *title; /* use N_() */
const char *desc; /* use N_() */
gboolean expand;
typedef struct
{
const char *name;
const char *title; /* use N_() */
const char *desc; /* use N_() */
gboolean expand;
FlatpakEllipsizeMode ellipsize;
gboolean all;
gboolean def;
gboolean all;
gboolean def;
} Column;
int find_column (Column *columns,
int find_column (Column *columns,
const char *name,
GError **error);
char *column_help (Column *columns);
Column *handle_column_args (Column *all_columns,
gboolean opt_show_all,
GError **error);
char *column_help (Column *columns);
Column *handle_column_args (Column *all_columns,
gboolean opt_show_all,
const char **opt_cols,
GError **error);
GError **error);
char * format_timestamp (guint64 timestamp);
char * ellipsize_string (const char *text, int len);
char * ellipsize_string_full (const char *text, int len, FlatpakEllipsizeMode mode);
char * ellipsize_string (const char *text,
int len);
char * ellipsize_string_full (const char *text,
int len,
FlatpakEllipsizeMode mode);
void print_aligned (int len, const char *title, const char *value);
void print_aligned (int len,
const char *title,
const char *value);
AsApp *as_store_find_app (AsStore *store,
AsApp *as_store_find_app (AsStore *store,
const char *ref);
const char *as_app_get_localized_name (AsApp *app);
const char *as_app_get_localized_comment (AsApp *app);
const char *as_app_get_version (AsApp *app);
gboolean flatpak_dir_load_appstream_store (FlatpakDir *self,
const gchar *remote_name,
const gchar *arch,
AsStore *store,
GCancellable *cancellable,
GError **error);
gboolean flatpak_dir_load_appstream_store (FlatpakDir *self,
const gchar *remote_name,
const gchar *arch,
AsStore *store,
GCancellable *cancellable,
GError **error);
int cell_width (const char *text);
const char *cell_advance (const char *text, int num);
int cell_width (const char *text);
const char *cell_advance (const char *text,
int num);
void print_wrapped (int columns, const char *text, ...) G_GNUC_PRINTF (2, 3);
void print_wrapped (int columns,
const char *text,
...) G_GNUC_PRINTF (2, 3);
#endif /* __FLATPAK_BUILTINS_UTILS_H__ */

View File

@ -43,7 +43,7 @@ G_BEGIN_DECLS
* @FLATPAK_BUILTIN_FLAG_ALL_DIRS: Allow repeated use of --user/--system/--installation
* and return multiple dirs. If no option is specified, return all installations,
* starting with system(default)+user
*
*
* Flags affecting the behavior of flatpak_option_context_parse().
*
* If the default system installation is among the returned diretories,
@ -74,7 +74,7 @@ gboolean usage_error (GOptionContext *context,
GError **error);
#define BUILTINPROTO(name) \
gboolean flatpak_builtin_ ## name (int argc, char **argv, GCancellable * cancellable, GError * *error); \
gboolean flatpak_builtin_ ## name (int argc, char **argv, GCancellable * cancellable, GError **error); \
gboolean flatpak_complete_ ## name (FlatpakCompletion * completion);

View File

@ -32,24 +32,24 @@
struct _FlatpakCliTransaction
{
FlatpakTransaction parent;
FlatpakTransaction parent;
gboolean disable_interaction;
gboolean stop_on_first_error;
GError *first_operation_error;
gboolean disable_interaction;
gboolean stop_on_first_error;
GError *first_operation_error;
int rows;
int cols;
int table_width;
int table_height;
int rows;
int cols;
int table_width;
int table_height;
int n_ops;
int op;
int op_progress;
int n_ops;
int op;
int op_progress;
gboolean installing;
gboolean updating;
gboolean uninstalling;
gboolean installing;
gboolean updating;
gboolean uninstalling;
int download_col;
@ -94,7 +94,7 @@ choose_remote_for_ref (FlatpakTransaction *transaction,
}
else
{
flatpak_format_choices ((const char **)remotes,
flatpak_format_choices ((const char **) remotes,
_("Required runtime for %s (%s) found in remotes: %s"),
pref, runtime_ref, remotes[0]);
chosen = flatpak_number_prompt (TRUE, 0, n_remotes, _("Which do you want to install (0 to abort)?"));
@ -199,9 +199,9 @@ redraw (FlatpakCliTransaction *self)
}
static void
set_op_progress (FlatpakCliTransaction *self,
set_op_progress (FlatpakCliTransaction *self,
FlatpakTransactionOperation *op,
const char *progress)
const char *progress)
{
if (flatpak_fancy_output ())
{
@ -212,17 +212,17 @@ set_op_progress (FlatpakCliTransaction *self,
}
static void
spin_op_progress (FlatpakCliTransaction *self,
spin_op_progress (FlatpakCliTransaction *self,
FlatpakTransactionOperation *op)
{
const char *p[] = {
"|",
"/",
"",
"\\",
"|",
"/",
"",
"\\",
};
set_op_progress (self, op, p[self->op_progress++ % G_N_ELEMENTS(p)]);
set_op_progress (self, op, p[self->op_progress++ % G_N_ELEMENTS (p)]);
}
static char *
@ -255,14 +255,14 @@ progress_changed_cb (FlatpakTransactionProgress *progress,
g_autofree char *speed = NULL;
int bar_length;
const char *partial_blocks[] = {
" ",
"",
"",
"",
"",
"",
"",
"",
" ",
"",
"",
"",
"",
"",
"",
"",
};
const char *full_block = "";
@ -278,7 +278,7 @@ progress_changed_cb (FlatpakTransactionProgress *progress,
g_autofree char *remaining = NULL;
if (elapsed_time > 3 && percent > 0)
{
guint64 total_time = elapsed_time * 100 / (double)percent;
guint64 total_time = elapsed_time * 100 / (double) percent;
remaining = format_duration (total_time - elapsed_time);
}
speed = g_strdup_printf ("%s/s%s%s", formatted_bytes_sec, remaining ? " " : "", remaining ? remaining : "");
@ -290,10 +290,10 @@ progress_changed_cb (FlatpakTransactionProgress *progress,
bar_length = MIN (20, cli->table_width - (strlen (cli->progress_msg) + 6 + cli->speed_len));
n_full = (bar_length * percent) / 100;
partial = (((bar_length * percent) % 100) * G_N_ELEMENTS(partial_blocks) ) / 100;
partial = (((bar_length * percent) % 100) * G_N_ELEMENTS (partial_blocks)) / 100;
/* The above should guarantee this: */
g_assert (partial >= 0);
g_assert (partial < G_N_ELEMENTS(partial_blocks));
g_assert (partial < G_N_ELEMENTS (partial_blocks));
g_string_append (str, cli->progress_msg);
g_string_append (str, " ");
@ -350,7 +350,7 @@ progress_changed_cb (FlatpakTransactionProgress *progress,
static void
set_progress (FlatpakCliTransaction *self,
const char *text)
const char *text)
{
flatpak_table_printer_set_cell (self->printer, self->progress_row, 0, text);
}
@ -439,6 +439,7 @@ operation_error (FlatpakTransaction *transaction,
FlatpakCliTransaction *self = FLATPAK_CLI_TRANSACTION (transaction);
FlatpakTransactionOperationType op_type = flatpak_transaction_operation_get_operation_type (op);
const char *ref = flatpak_transaction_operation_get_ref (op);
g_autoptr(FlatpakRef) rref = flatpak_ref_parse (ref, NULL);
g_autofree char *msg = NULL;
gboolean non_fatal = (detail & FLATPAK_TRANSACTION_ERROR_DETAILS_NON_FATAL) != 0;
@ -477,11 +478,11 @@ operation_error (FlatpakTransaction *transaction,
else
msg = g_strdup (error->message);
if (!non_fatal && self->first_operation_error == NULL)
g_propagate_prefixed_error (&self->first_operation_error,
g_error_copy (error),
_("Failed to %s %s: "),
op_type_to_string (op_type), flatpak_ref_get_name (rref));
if (!non_fatal && self->first_operation_error == NULL)
g_propagate_prefixed_error (&self->first_operation_error,
g_error_copy (error),
_("Failed to %s %s: "),
op_type_to_string (op_type), flatpak_ref_get_name (rref));
text = g_strconcat (non_fatal ? _("Warning:") : _("Error:"), " ", msg, NULL);
@ -509,6 +510,7 @@ end_of_lifed (FlatpakTransaction *transaction,
const char *rebase)
{
FlatpakCliTransaction *self = FLATPAK_CLI_TRANSACTION (transaction);
g_autoptr(FlatpakRef) rref = flatpak_ref_parse (ref, NULL);
g_autofree char *msg = NULL;
@ -616,6 +618,7 @@ append_tags (GPtrArray *tags_array,
GKeyFile *old_metadata)
{
gsize i, size = 0;
g_auto(GStrv) tags = g_key_file_get_string_list (metadata, FLATPAK_METADATA_GROUP_APPLICATION, "tags",
&size, NULL);
g_auto(GStrv) old_tags = NULL;
@ -627,20 +630,20 @@ append_tags (GPtrArray *tags_array,
for (i = 0; i < size; i++)
{
const char *tag = tags[i];
if (old_tags == NULL || !g_strv_contains ((const char * const *)old_tags, tag))
if (old_tags == NULL || !g_strv_contains ((const char * const *) old_tags, tag))
g_ptr_array_add (tags_array, g_strdup (tag));
}
}
static void
print_perm_line (int idx,
print_perm_line (int idx,
GPtrArray *items,
int cols)
int cols)
{
g_autoptr(GString) res = g_string_new (NULL);
int i;
g_string_append_printf (res, " [%d] %s", idx, (char *)items->pdata[0]);
g_string_append_printf (res, " [%d] %s", idx, (char *) items->pdata[0]);
for (i = 1; i < items->len; i++)
{
@ -652,10 +655,10 @@ print_perm_line (int idx,
p = res->str;
len = (res->str + strlen (res->str)) - p;
if (len + strlen ((char *)items->pdata[i]) + 2 >= cols)
g_string_append_printf (res, ",\n %s", (char *)items->pdata[i]);
if (len + strlen ((char *) items->pdata[i]) + 2 >= cols)
g_string_append_printf (res, ",\n %s", (char *) items->pdata[i]);
else
g_string_append_printf (res, ", %s", (char *)items->pdata[i]);
g_string_append_printf (res, ", %s", (char *) items->pdata[i]);
}
g_print ("%s\n", res->str);
@ -663,9 +666,9 @@ print_perm_line (int idx,
static void
print_permissions (FlatpakCliTransaction *self,
const char *ref,
GKeyFile *metadata,
GKeyFile *old_metadata)
const char *ref,
GKeyFile *metadata,
GKeyFile *old_metadata)
{
g_autoptr(FlatpakRef) rref = flatpak_ref_parse (ref, NULL);
g_autoptr(GPtrArray) permissions = g_ptr_array_new_with_free_func (g_free);
@ -826,13 +829,16 @@ transaction_ready (FlatpakTransaction *transaction)
case FLATPAK_TRANSACTION_OPERATION_UNINSTALL:
self->uninstalling = TRUE;
break;
case FLATPAK_TRANSACTION_OPERATION_INSTALL:
case FLATPAK_TRANSACTION_OPERATION_INSTALL_BUNDLE:
self->installing = TRUE;
break;
case FLATPAK_TRANSACTION_OPERATION_UPDATE:
self->updating = TRUE;
break;
default:;
}
}

View File

@ -30,6 +30,6 @@ G_DECLARE_FINAL_TYPE (FlatpakCliTransaction, flatpak_cli_transaction, FLATPAK, C
FlatpakTransaction * flatpak_cli_transaction_new (FlatpakDir * dir,
gboolean disable_interaction,
gboolean stop_on_first_error,
GError * *error);
GError **error);
#endif /* __FLATPAK_CLI_TRANSACTION_H__ */

View File

@ -359,7 +359,7 @@ flatpak_complete_options (FlatpakCompletion *completion,
}
else if (strcmp (e->long_name, "columns") == 0)
{
/* columns are treated separately */
/* columns are treated separately */
}
else
flatpak_complete_word (completion, "%s", prefix);
@ -409,8 +409,8 @@ flatpak_complete_options (FlatpakCompletion *completion,
static void
flatpak_complete_column (FlatpakCompletion *completion,
char **used,
const char *column)
char **used,
const char *column)
{
g_autoptr(GString) s = NULL;
@ -420,7 +420,7 @@ flatpak_complete_column (FlatpakCompletion *completion,
{
int i;
if (g_strv_contains ((const char * const *)used, column))
if (g_strv_contains ((const char * const *) used, column))
return;
const char *last = NULL;
@ -447,6 +447,7 @@ flatpak_complete_columns (FlatpakCompletion *completion,
{
int i;
const char *list = NULL;
g_auto(GStrv) used = NULL;
if (!g_str_has_prefix (completion->cur, "--columns="))

View File

@ -35,7 +35,7 @@
#include "flatpak-polkit-agent-text-listener.h"
/* Work with polkit before and after autoptr support was added */
typedef PolkitSubject AutoPolkitSubject;
typedef PolkitSubject AutoPolkitSubject;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AutoPolkitSubject, g_object_unref)
#endif
@ -246,10 +246,10 @@ check_environment (void)
dirs = g_get_system_data_dirs ();
for (i = 0; dirs[i]; i++)
{
if (g_str_has_prefix (dirs[i], system_exports))
has_system = TRUE;
if (g_str_has_prefix (dirs[i], user_exports))
has_user = TRUE;
if (g_str_has_prefix (dirs[i], system_exports))
has_system = TRUE;
if (g_str_has_prefix (dirs[i], user_exports))
has_user = TRUE;
}
flatpak_get_window_size (&rows, &cols);
@ -267,7 +267,7 @@ check_environment (void)
"set by the XDG_DATA_DIRS environment variable, so applications "
"installed by Flatpak may not appear on your desktop until the "
"session is restarted."),
missing);
missing);
g_print ("\n");
}
else if (!has_system || !has_user)
@ -281,7 +281,7 @@ check_environment (void)
"set by the XDG_DATA_DIRS environment variable, so applications "
"installed by Flatpak may not appear on your desktop until the "
"session is restarted."),
missing);
missing);
g_print ("\n");
}
}
@ -302,7 +302,7 @@ flatpak_option_context_parse (GOptionContext *context,
FLATPAK_BUILTIN_FLAG_ONE_DIR |
FLATPAK_BUILTIN_FLAG_STANDARD_DIRS |
FLATPAK_BUILTIN_FLAG_ALL_DIRS)) != 1)
g_assert_not_reached ();
g_assert_not_reached ();
if (!(flags & FLATPAK_BUILTIN_FLAG_NO_DIR))
g_option_context_add_main_entries (context, user_entries, NULL);
@ -590,6 +590,7 @@ flatpak_run (int argc,
g_autofree char *prgname = NULL;
gboolean success = FALSE;
const char *command_name = NULL;
__attribute__((cleanup (uninstall_polkit_agent))) gpointer polkit_agent = NULL;
command = extract_command (&argc, argv, &command_name);

View File

@ -106,8 +106,8 @@ flatpak_quiet_transaction_class_init (FlatpakQuietTransactionClass *class)
}
FlatpakTransaction *
flatpak_quiet_transaction_new (FlatpakDir *dir,
GError **error)
flatpak_quiet_transaction_new (FlatpakDir *dir,
GError **error)
{
g_autoptr(FlatpakQuietTransaction) self = NULL;
g_autoptr(FlatpakInstallation) installation = NULL;

View File

@ -27,7 +27,7 @@
#define FLATPAK_TYPE_QUIET_TRANSACTION flatpak_quiet_transaction_get_type ()
G_DECLARE_FINAL_TYPE (FlatpakQuietTransaction, flatpak_quiet_transaction, FLATPAK, QUIET_TRANSACTION, FlatpakTransaction)
FlatpakTransaction * flatpak_quiet_transaction_new (FlatpakDir *dir,
FlatpakTransaction * flatpak_quiet_transaction_new (FlatpakDir * dir,
GError **error);
#endif /* __FLATPAK_QUIET_TRANSACTION_H__ */

View File

@ -50,7 +50,7 @@ free_cell (gpointer data)
typedef struct
{
GPtrArray *cells;
char *key;
char *key;
} Row;
static void
@ -65,8 +65,8 @@ free_row (gpointer data)
typedef struct
{
char *title;
gboolean expand;
char *title;
gboolean expand;
FlatpakEllipsizeMode ellipsize;
} TableColumn;
@ -83,7 +83,7 @@ struct FlatpakTablePrinter
{
GPtrArray *columns;
GPtrArray *rows;
char *key;
char *key;
GPtrArray *current;
int n_columns;
};
@ -143,6 +143,7 @@ flatpak_table_printer_set_columns (FlatpakTablePrinter *printer,
Column *columns)
{
int i;
for (i = 0; columns[i].name; i++)
{
flatpak_table_printer_set_column_title (printer, i, _(columns[i].title));
@ -262,12 +263,12 @@ flatpak_table_printer_set_key (FlatpakTablePrinter *printer, const char *key)
}
static gint
cmp_row (gconstpointer _row_a,
gconstpointer _row_b,
gpointer user_data)
cmp_row (gconstpointer _row_a,
gconstpointer _row_b,
gpointer user_data)
{
const Row *row_a = *(const Row **)_row_a;
const Row *row_b = *(const Row **)_row_b;
const Row *row_a = *(const Row **) _row_a;
const Row *row_b = *(const Row **) _row_b;
GCompareFunc cmp = user_data;
if (row_a == row_b || (row_a->key == NULL && row_b->key == NULL))
@ -331,7 +332,7 @@ print_row (GString *row_s, gboolean bold, int *skip, int columns)
if (p < end || p == row_s->str)
{
if (bold)
g_print (FLATPAK_ANSI_BOLD_ON"%s"FLATPAK_ANSI_BOLD_OFF, p);
g_print (FLATPAK_ANSI_BOLD_ON "%s" FLATPAK_ANSI_BOLD_OFF, p);
else
g_print ("%s", p);
}
@ -361,15 +362,16 @@ string_add_spaces (GString *str, int count)
*/
void
flatpak_table_printer_print_full (FlatpakTablePrinter *printer,
int skip,
int columns,
int *table_height,
int *table_width)
int skip,
int columns,
int *table_height,
int *table_width)
{
g_autofree int *widths = NULL;
g_autofree int *lwidths = NULL;
g_autofree int *rwidths = NULL;
g_autofree int *shrinks = NULL;
g_autoptr(GString) row_s = g_string_new ("");
int i, j;
int rows = 0;
@ -486,7 +488,7 @@ flatpak_table_printer_print_full (FlatpakTablePrinter *printer,
sh = MAX (0, widths[i] - cell_width (col->title));
else
sh = MAX (0, widths[i] - 5);
shrinks[i] = MIN (shortfall * (sh / (double)shrinkable), widths[i]);
shrinks[i] = MIN (shortfall * (sh / (double) shrinkable), widths[i]);
leftover -= shrinks[i];
}
}
@ -501,8 +503,8 @@ flatpak_table_printer_print_full (FlatpakTablePrinter *printer,
gboolean ellipsize = col ? col->ellipsize : FALSE;
if (ellipsize && shrinks[i] < widths[i])
{
shrinks[i]++;
leftover--;
shrinks[i]++;
leftover--;
}
if (leftover == 0)
break;
@ -629,19 +631,19 @@ flatpak_table_printer_get_current_row (FlatpakTablePrinter *printer)
static void
set_cell (FlatpakTablePrinter *printer,
int r,
int c,
const char *text,
int align)
int r,
int c,
const char *text,
int align)
{
Row *row;
Cell *cell;
row = (Row *)g_ptr_array_index (printer->rows, r);
row = (Row *) g_ptr_array_index (printer->rows, r);
g_assert (row);
cell = (Cell *)g_ptr_array_index (row->cells, c);
cell = (Cell *) g_ptr_array_index (row->cells, c);
g_assert (cell);
g_free (cell->text);
@ -651,18 +653,18 @@ set_cell (FlatpakTablePrinter *printer,
void
flatpak_table_printer_set_cell (FlatpakTablePrinter *printer,
int r,
int c,
const char *text)
int r,
int c,
const char *text)
{
set_cell (printer, r, c, text, -1);
}
void
flatpak_table_printer_set_decimal_cell (FlatpakTablePrinter *printer,
int r,
int c,
const char *text)
int r,
int c,
const char *text)
{
int align = -1;
const char *decimal = find_decimal_point (text);
@ -675,8 +677,8 @@ flatpak_table_printer_set_decimal_cell (FlatpakTablePrinter *printer,
void
flatpak_table_printer_set_column_expand (FlatpakTablePrinter *printer,
int column,
gboolean expand)
int column,
gboolean expand)
{
TableColumn *col = get_table_column (printer, column);
@ -685,7 +687,7 @@ flatpak_table_printer_set_column_expand (FlatpakTablePrinter *printer,
void
flatpak_table_printer_set_column_ellipsize (FlatpakTablePrinter *printer,
int column,
int column,
FlatpakEllipsizeMode mode)
{
TableColumn *col = get_table_column (printer, column);

View File

@ -51,29 +51,31 @@ void flatpak_table_printer_append_with_comma (FlatpakTablePrinter
void flatpak_table_printer_append_with_comma_printf (FlatpakTablePrinter *printer,
const char *format,
...);
void flatpak_table_printer_set_key (FlatpakTablePrinter *printer, const char *key);
void flatpak_table_printer_set_key (FlatpakTablePrinter *printer,
const char *key);
void flatpak_table_printer_finish_row (FlatpakTablePrinter *printer);
void flatpak_table_printer_sort (FlatpakTablePrinter *printer, GCompareFunc cmp);
void flatpak_table_printer_sort (FlatpakTablePrinter *printer,
GCompareFunc cmp);
void flatpak_table_printer_print (FlatpakTablePrinter *printer);
void flatpak_table_printer_print_full (FlatpakTablePrinter *printer,
int skip,
int columns,
int *table_height,
int *table_width);
int skip,
int columns,
int *table_height,
int *table_width);
int flatpak_table_printer_get_current_row (FlatpakTablePrinter *printer);
void flatpak_table_printer_set_cell (FlatpakTablePrinter *printer,
int row,
int col,
const char *cell);
int row,
int col,
const char *cell);
void flatpak_table_printer_set_decimal_cell (FlatpakTablePrinter *printer,
int row,
int col,
const char *cell);
int row,
int col,
const char *cell);
void flatpak_table_printer_set_column_expand (FlatpakTablePrinter *printer,
int col,
gboolean expand);
int col,
gboolean expand);
void flatpak_table_printer_set_column_ellipsize (FlatpakTablePrinter *printer,
int col,
int col,
FlatpakEllipsizeMode mode);
#endif /* __FLATPAK_TABLE_PRINTER_H__ */

View File

@ -25,21 +25,23 @@
#include <gio/gio.h>
#include <stdio.h>
typedef struct {
typedef struct
{
const char *id;
GHashTable *names;
GHashTable *comments;
char *version;
char *license;
char *version;
char *license;
} Component;
typedef struct {
typedef struct
{
GPtrArray *components;
GString *text;
gboolean in_text;
gboolean in_component;
char *lang;
guint64 timestamp;
GString *text;
gboolean in_text;
gboolean in_component;
char *lang;
guint64 timestamp;
} ParserData;
static void
@ -73,10 +75,10 @@ parser_data_free (ParserData *data)
g_string_free (data->text, TRUE);
g_free (data->lang);
g_free (data);
g_free (data);
}
G_DEFINE_AUTOPTR_CLEANUP_FUNC(ParserData, parser_data_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ParserData, parser_data_free)
static ParserData *
parser_data_new (void)
@ -91,11 +93,11 @@ parser_data_new (void)
static void
start_element (GMarkupParseContext *context,
const char *element_name,
const char **attribute_names,
const char **attribute_values,
gpointer user_data,
GError **error)
const char *element_name,
const char **attribute_names,
const char **attribute_values,
gpointer user_data,
GError **error)
{
ParserData *data = user_data;
@ -189,9 +191,9 @@ start_element (GMarkupParseContext *context,
static void
end_element (GMarkupParseContext *context,
const char *element_name,
gpointer user_data,
GError **error)
const char *element_name,
gpointer user_data,
GError **error)
{
ParserData *data = user_data;
g_autofree char *text = NULL;
@ -201,7 +203,7 @@ end_element (GMarkupParseContext *context,
elements = g_markup_parse_context_get_element_stack (context);
if (elements->next)
parent = (const char *)elements->next->data;
parent = (const char *) elements->next->data;
g_assert (data->components->len > 0);
@ -236,10 +238,10 @@ end_element (GMarkupParseContext *context,
static void
text (GMarkupParseContext *context,
const char *text,
gsize text_len,
gpointer user_data,
GError **error)
const char *text,
gsize text_len,
gpointer user_data,
GError **error)
{
ParserData *data = user_data;

View File

@ -102,7 +102,7 @@ typedef struct
GError *summary_fetch_error;
GVariant *metadata;
GError *metadata_fetch_error;
int refcount;
int refcount;
} FlatpakRemoteState;
FlatpakRemoteState *flatpak_remote_state_ref (FlatpakRemoteState *remote_state);
@ -163,12 +163,12 @@ typedef enum {
FLATPAK_HELPER_DEPLOY_FLAGS_INSTALL_HINT = 1 << 6,
} FlatpakHelperDeployFlags;
#define FLATPAK_HELPER_DEPLOY_FLAGS_ALL (FLATPAK_HELPER_DEPLOY_FLAGS_UPDATE |\
FLATPAK_HELPER_DEPLOY_FLAGS_NO_DEPLOY |\
FLATPAK_HELPER_DEPLOY_FLAGS_LOCAL_PULL |\
FLATPAK_HELPER_DEPLOY_FLAGS_REINSTALL |\
FLATPAK_HELPER_DEPLOY_FLAGS_NO_INTERACTION |\
FLATPAK_HELPER_DEPLOY_FLAGS_APP_HINT |\
#define FLATPAK_HELPER_DEPLOY_FLAGS_ALL (FLATPAK_HELPER_DEPLOY_FLAGS_UPDATE | \
FLATPAK_HELPER_DEPLOY_FLAGS_NO_DEPLOY | \
FLATPAK_HELPER_DEPLOY_FLAGS_LOCAL_PULL | \
FLATPAK_HELPER_DEPLOY_FLAGS_REINSTALL | \
FLATPAK_HELPER_DEPLOY_FLAGS_NO_INTERACTION | \
FLATPAK_HELPER_DEPLOY_FLAGS_APP_HINT | \
FLATPAK_HELPER_DEPLOY_FLAGS_INSTALL_HINT)
typedef enum {
@ -178,8 +178,8 @@ typedef enum {
FLATPAK_HELPER_UNINSTALL_FLAGS_NO_INTERACTION = 1 << 2,
} FlatpakHelperUninstallFlags;
#define FLATPAK_HELPER_UNINSTALL_FLAGS_ALL (FLATPAK_HELPER_UNINSTALL_FLAGS_KEEP_REF |\
FLATPAK_HELPER_UNINSTALL_FLAGS_FORCE_REMOVE |\
#define FLATPAK_HELPER_UNINSTALL_FLAGS_ALL (FLATPAK_HELPER_UNINSTALL_FLAGS_KEEP_REF | \
FLATPAK_HELPER_UNINSTALL_FLAGS_FORCE_REMOVE | \
FLATPAK_HELPER_UNINSTALL_FLAGS_NO_INTERACTION)
typedef enum {
@ -188,7 +188,7 @@ typedef enum {
FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_NO_INTERACTION = 1 << 1,
} FlatpakHelperConfigureRemoteFlags;
#define FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_ALL (FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_FORCE_REMOVE |\
#define FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_ALL (FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_FORCE_REMOVE | \
FLATPAK_HELPER_CONFIGURE_REMOTE_FLAGS_NO_INTERACTION)
typedef enum {
@ -197,7 +197,7 @@ typedef enum {
FLATPAK_HELPER_CONFIGURE_FLAGS_NO_INTERACTION = 1 << 1,
} FlatpakHelperConfigureFlags;
#define FLATPAK_HELPER_CONFIGURE_FLAGS_ALL (FLATPAK_HELPER_CONFIGURE_FLAGS_UNSET |\
#define FLATPAK_HELPER_CONFIGURE_FLAGS_ALL (FLATPAK_HELPER_CONFIGURE_FLAGS_UNSET | \
FLATPAK_HELPER_CONFIGURE_FLAGS_NO_INTERACTION)
typedef enum {
@ -314,9 +314,9 @@ gboolean flatpak_save_override_keyfile (GKeyFile *metakey,
const char *app_id,
gboolean user,
GError **error);
gboolean flatpak_remove_override_keyfile (const char *app_id,
gboolean user,
GError **error);
gboolean flatpak_remove_override_keyfile (const char *app_id,
gboolean user,
GError **error);
int flatpak_deploy_data_get_version (GVariant *deploy_data);
const char * flatpak_deploy_data_get_origin (GVariant *deploy_data);
@ -418,17 +418,17 @@ char * flatpak_dir_find_remote_ref (FlatpakDir *self,
FlatpakKinds *out_kind,
GCancellable *cancellable,
GError **error);
char ** flatpak_dir_find_remote_refs (FlatpakDir *self,
const char *remote,
const char *name,
const char *opt_branch,
const char *opt_default_branch,
const char *opt_arch,
const char *opt_default_arch,
FlatpakKinds kinds,
FindMatchingRefsFlags flags,
GCancellable *cancellable,
GError **error);
char ** flatpak_dir_find_remote_refs (FlatpakDir *self,
const char *remote,
const char *name,
const char *opt_branch,
const char *opt_default_branch,
const char *opt_arch,
const char *opt_default_arch,
FlatpakKinds kinds,
FindMatchingRefsFlags flags,
GCancellable *cancellable,
GError **error);
char ** flatpak_dir_find_local_refs (FlatpakDir *self,
const char *remote,
const char *name,
@ -438,8 +438,8 @@ char ** flatpak_dir_find_local_refs (FlatpakDir *self,
const char *opt_default_arch,
FlatpakKinds kinds,
FindMatchingRefsFlags flags,
GCancellable *cancellable,
GError **error);
GCancellable *cancellable,
GError **error);
char * flatpak_dir_find_installed_ref (FlatpakDir *self,
const char *opt_name,
const char *opt_branch,
@ -447,13 +447,13 @@ char * flatpak_dir_find_installed_ref (FlatpakDir *self,
FlatpakKinds kinds,
FlatpakKinds *out_kind,
GError **error);
char ** flatpak_dir_find_installed_refs (FlatpakDir *self,
const char *opt_name,
const char *opt_branch,
const char *opt_arch,
FlatpakKinds kinds,
FindMatchingRefsFlags flags,
GError **error);
char ** flatpak_dir_find_installed_refs (FlatpakDir *self,
const char *opt_name,
const char *opt_branch,
const char *opt_arch,
FlatpakKinds kinds,
FindMatchingRefsFlags flags,
GError **error);
FlatpakDeploy *flatpak_dir_load_deployed (FlatpakDir *self,
const char *ref,
const char *checksum,
@ -752,7 +752,7 @@ char *flatpak_dir_find_remote_by_uri (FlatpakDir *self,
const char *collection_id);
gboolean flatpak_dir_has_remote (FlatpakDir *self,
const char *remote_name,
GError **error);
GError **error);
char **flatpak_dir_list_remotes (FlatpakDir *self,
GCancellable *cancellable,
GError **error);
@ -899,7 +899,7 @@ char ** flatpak_dir_get_locale_languages (FlatpakDir *self);
char ** flatpak_dir_get_locale_subpaths (FlatpakDir *self);
void flatpak_dir_set_source_pid (FlatpakDir *self,
pid_t pid);
pid_t pid);
pid_t flatpak_dir_get_source_pid (FlatpakDir *self);
#endif /* __FLATPAK_DIR_H__ */

View File

@ -113,7 +113,7 @@ static void ensure_soup_session (FlatpakDir *self);
static void flatpak_dir_log (FlatpakDir *self,
const char *file,
int line,
int line,
const char *func,
const char *source,
const char *change,
@ -125,11 +125,13 @@ static void flatpak_dir_log (FlatpakDir *self,
const char *format,
...);
#define flatpak_dir_log(self,change,remote,ref,commit,old_commit,url,format,...) \
(flatpak_dir_log) (self,__FILE__, __LINE__, __FUNCTION__, \
NULL, change, remote, ref, commit, old_commit, url, format, __VA_ARGS__)
#define flatpak_dir_log(self, change, remote, ref, commit, old_commit, url, format, ...) \
(flatpak_dir_log) (self, __FILE__, __LINE__, __FUNCTION__, \
NULL, change, remote, ref, commit, old_commit, url, format, __VA_ARGS__)
static GVariant *upgrade_deploy_data (GVariant *deploy_data, GFile *deploy_dir, const char *ref);
static GVariant *upgrade_deploy_data (GVariant *deploy_data,
GFile *deploy_dir,
const char *ref);
typedef struct
{
@ -227,6 +229,7 @@ static FlatpakRemoteState *
flatpak_remote_state_new (void)
{
FlatpakRemoteState *state = g_new0 (FlatpakRemoteState, 1);
state->refcount = 1;
return state;
}
@ -245,18 +248,18 @@ flatpak_remote_state_unref (FlatpakRemoteState *remote_state)
g_assert (remote_state->refcount > 0);
remote_state->refcount--;
if (remote_state->refcount == 0)
{
g_free (remote_state->remote_name);
g_free (remote_state->collection_id);
g_clear_pointer (&remote_state->summary, g_variant_unref);
g_clear_pointer (&remote_state->summary_sig_bytes, g_bytes_unref);
g_clear_error (&remote_state->summary_fetch_error);
g_clear_pointer (&remote_state->metadata, g_variant_unref);
g_clear_error (&remote_state->metadata_fetch_error);
if (remote_state->refcount == 0)
{
g_free (remote_state->remote_name);
g_free (remote_state->collection_id);
g_clear_pointer (&remote_state->summary, g_variant_unref);
g_clear_pointer (&remote_state->summary_sig_bytes, g_bytes_unref);
g_clear_error (&remote_state->summary_fetch_error);
g_clear_pointer (&remote_state->metadata, g_variant_unref);
g_clear_error (&remote_state->metadata_fetch_error);
g_free (remote_state);
}
g_free (remote_state);
}
}
gboolean
@ -265,7 +268,7 @@ flatpak_remote_state_ensure_summary (FlatpakRemoteState *self,
{
if (self->summary == NULL)
return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Unable to load summary from remote %s: %s"), self->remote_name,
self->summary_fetch_error != NULL ? self->summary_fetch_error->message : "unknown error");
self->summary_fetch_error != NULL ? self->summary_fetch_error->message : "unknown error");
return TRUE;
}
@ -285,7 +288,7 @@ flatpak_remote_state_ensure_metadata (FlatpakRemoteState *self,
error_msg = g_strdup_printf ("summary fetch error: %s", self->summary_fetch_error->message);
return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Unable to load metadata from remote %s: %s"), self->remote_name,
error_msg != NULL ? error_msg : "unknown error");
error_msg != NULL ? error_msg : "unknown error");
}
return TRUE;
@ -1537,7 +1540,7 @@ flatpak_dir_finalize (GObject *object)
g_clear_object (&self->basedir);
g_clear_pointer (&self->extra_data, dir_extra_data_free);
if (self->system_helper_bus != (gpointer)1)
if (self->system_helper_bus != (gpointer) 1)
g_clear_object (&self->system_helper_bus);
g_clear_object (&self->soup_session);
@ -1707,7 +1710,7 @@ flatpak_dir_get_name_cached (FlatpakDir *self)
g_object_set_data_full (G_OBJECT (self), "cached-name", name, g_free);
}
return (const char *)name;
return (const char *) name;
}
char *
@ -2181,13 +2184,13 @@ flatpak_deploy_data_get_appdata_summary (GVariant *deploy_data)
const char *
flatpak_deploy_data_get_appdata_version (GVariant *deploy_data)
{
return flatpak_deploy_data_get_string (deploy_data, "appdata-version");
return flatpak_deploy_data_get_string (deploy_data, "appdata-version");
}
const char *
flatpak_deploy_data_get_appdata_license (GVariant *deploy_data)
{
return flatpak_deploy_data_get_string (deploy_data, "appdata-license");
return flatpak_deploy_data_get_string (deploy_data, "appdata-license");
}
/*<private>
@ -2241,35 +2244,37 @@ read_appdata_xml_from_deploy_dir (GFile *deploy_dir, const char *id)
static void
add_locale_metadata_string (GVariantBuilder *metadata_builder,
const char *keyname,
GHashTable *values)
const char *keyname,
GHashTable *values)
{
if (values == NULL)
return;
GLNX_HASH_TABLE_FOREACH_KV (values, const char *, locale, const char *, value)
{
const char *key;
g_autofree char *key_free = NULL;
if (strcmp (locale, "C") == 0)
key = keyname;
else
{
key_free = g_strdup_printf ("%s@%s", keyname, locale);
key = key_free;
}
{
const char *key;
g_autofree char *key_free = NULL;
g_variant_builder_add (metadata_builder, "{s@v}", key,
g_variant_new_variant (g_variant_new_string (value)));
}
if (strcmp (locale, "C") == 0)
key = keyname;
else
{
key_free = g_strdup_printf ("%s@%s", keyname, locale);
key = key_free;
}
g_variant_builder_add (metadata_builder, "{s@v}", key,
g_variant_new_variant (g_variant_new_string (value)));
}
}
static void
add_appdata_to_deploy_data (GVariantBuilder *metadata_builder,
GFile *deploy_dir,
const char *id)
GFile *deploy_dir,
const char *id)
{
g_autofree char *appdata_xml = NULL;
g_autoptr(GHashTable) names = NULL;
g_autoptr(GHashTable) comments = NULL;
g_autofree char *version = NULL;
@ -3069,7 +3074,7 @@ flatpak_dir_find_latest_rev (FlatpakDir *self,
if (latest_rev == NULL)
{
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("No such ref (%s, %s) in remote %s or elsewhere"),
collection_ref.collection_id, collection_ref.ref_name, state->remote_name);
collection_ref.collection_id, collection_ref.ref_name, state->remote_name);
return FALSE;
}
@ -3086,7 +3091,7 @@ flatpak_dir_find_latest_rev (FlatpakDir *self,
{
if (error != NULL && *error == NULL)
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Couldn't find latest checksum for ref %s in remote %s"),
ref, state->remote_name);
ref, state->remote_name);
return FALSE;
}
@ -3165,7 +3170,7 @@ flatpak_dir_resolve_data_free (FlatpakDirResolveData *data)
static void
resolve_p2p_update_from_commit (FlatpakDirResolve *resolve,
GVariant *commit_data)
GVariant *commit_data)
{
g_autoptr(GVariant) commit_metadata = NULL;
const char *xa_metadata = NULL;
@ -4269,7 +4274,7 @@ flatpak_dir_pull_extra_data (FlatpakDir *self,
if (!g_file_load_contents (extra_local_file, cancellable, &extra_local_contents, &extra_local_size, NULL, &my_error))
return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Failed to load local extra-data %s: %s"),
flatpak_file_get_path_cached (extra_local_file), my_error->message);
flatpak_file_get_path_cached (extra_local_file), my_error->message);
if (extra_local_size != download_size)
return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Wrong size for extra-data %s"), flatpak_file_get_path_cached (extra_local_file));
@ -4456,7 +4461,7 @@ flatpak_dir_mirror_oci (FlatpakDir *self,
{
if (error != NULL && *error == NULL)
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Couldn't find latest checksum for ref %s in remote %s"),
ref, state->remote_name);
ref, state->remote_name);
return FALSE;
}
@ -4529,7 +4534,7 @@ flatpak_dir_pull_oci (FlatpakDir *self,
{
if (error != NULL && *error == NULL)
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Couldn't find latest checksum for ref %s in remote %s"),
ref, state->remote_name);
ref, state->remote_name);
return FALSE;
}
@ -4589,7 +4594,7 @@ flatpak_dir_pull_oci (FlatpakDir *self,
(flatpak_dir_log) (self, __FILE__, __LINE__, __FUNCTION__, name,
"pull oci", registry_uri, ref, NULL, NULL, NULL,
"Pulled %s from %s", ref, registry_uri);
"Pulled %s from %s", ref, registry_uri);
return TRUE;
}
@ -4717,14 +4722,14 @@ flatpak_dir_pull (FlatpakDir *self,
if (rev == NULL)
return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("No such ref (%s, %s) in remote %s or elsewhere"),
collection_ref.collection_id, collection_ref.ref_name, state->remote_name);
collection_ref.collection_id, collection_ref.ref_name, state->remote_name);
}
else
{
flatpak_remote_state_lookup_ref (state, ref, &rev, NULL, error);
if (rev == NULL && error != NULL && *error == NULL)
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Couldn't find latest checksum for ref %s in remote %s"),
ref, state->remote_name);
ref, state->remote_name);
results = NULL;
}
@ -4804,7 +4809,7 @@ flatpak_dir_pull (FlatpakDir *self,
(flatpak_dir_log) (self, __FILE__, __LINE__, __FUNCTION__, name,
"pull", state->remote_name, ref, rev, current_checksum, NULL,
"Pulled %s from %s", ref, state->remote_name);
"Pulled %s from %s", ref, state->remote_name);
out:
if (!ret)
@ -4831,6 +4836,7 @@ repo_pull_local_untrusted (FlatpakDir *self,
/* The latter flag was introduced in https://github.com/ostreedev/ostree/pull/926 */
const OstreeRepoPullFlags flags = OSTREE_REPO_PULL_FLAGS_UNTRUSTED | OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES;
GVariantBuilder builder;
g_autoptr(GVariant) options = NULL;
g_auto(GVariantBuilder) refs_builder = FLATPAK_VARIANT_BUILDER_INITIALIZER;
gboolean res;
@ -5015,7 +5021,7 @@ flatpak_dir_pull_untrusted_local (FlatpakDir *self,
ref,
&checksum, NULL))
return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("No such ref '%s' in remote %s"),
ref, remote_name);
ref, remote_name);
}
else
@ -5077,7 +5083,7 @@ flatpak_dir_pull_untrusted_local (FlatpakDir *self,
_("Commit has collection ID %s in collection binding "
"metadata, while the remote it came from has "
"collection ID %s"),
commit_collection_id, collection_id);
commit_collection_id, collection_id);
}
}
@ -6828,8 +6834,8 @@ apply_extra_data (FlatpakDir *self,
return FALSE;
if (!flatpak_canonicalize_permissions (AT_FDCWD, flatpak_file_get_path_cached (extra_files),
getuid() == 0 ? 0 : -1,
getuid() == 0 ? 0 : -1,
getuid () == 0 ? 0 : -1,
getuid () == 0 ? 0 : -1,
error))
return FALSE;
@ -6857,10 +6863,10 @@ apply_extra_data (FlatpakDir *self,
/* We create a deploy ref for the currently deployed version of all refs to avoid
deployed commits being pruned when e.g. we pull --no-deploy. */
static gboolean
flatpak_dir_update_deploy_ref (FlatpakDir *self,
const char *ref,
const char *checksum,
GError **error)
flatpak_dir_update_deploy_ref (FlatpakDir *self,
const char *ref,
const char *checksum,
GError **error)
{
g_autofree char *deploy_ref = g_strconcat ("deploy/", ref, NULL);
@ -9464,7 +9470,7 @@ flatpak_dir_remote_make_oci_summary (FlatpakDir *self,
}
if (out_summary)
*out_summary = g_steal_pointer (&summary_bytes);
*out_summary = g_steal_pointer (&summary_bytes);
return TRUE;
}
}
@ -10108,19 +10114,20 @@ flatpak_dir_get_remote_collection_id (FlatpakDir *self,
}
char **
flatpak_dir_find_remote_refs (FlatpakDir *self,
const char *remote,
const char *name,
const char *opt_branch,
const char *opt_default_branch,
const char *opt_arch,
const char *opt_default_arch,
FlatpakKinds kinds,
FindMatchingRefsFlags flags,
GCancellable *cancellable,
GError **error)
flatpak_dir_find_remote_refs (FlatpakDir *self,
const char *remote,
const char *name,
const char *opt_branch,
const char *opt_default_branch,
const char *opt_arch,
const char *opt_default_arch,
FlatpakKinds kinds,
FindMatchingRefsFlags flags,
GCancellable *cancellable,
GError **error)
{
g_autofree char *collection_id = NULL;
g_autoptr(GHashTable) remote_refs = NULL;
g_autoptr(FlatpakRemoteState) state = NULL;
GPtrArray *matched_refs;
@ -10300,10 +10307,11 @@ flatpak_dir_find_local_refs (FlatpakDir *self,
const char *opt_default_arch,
FlatpakKinds kinds,
FindMatchingRefsFlags flags,
GCancellable *cancellable,
GError **error)
GCancellable *cancellable,
GError **error)
{
g_autofree char *collection_id = NULL;
g_autoptr(GHashTable) local_refs = NULL;
g_autoptr(GError) my_error = NULL;
g_autofree char *refspec_prefix = g_strconcat (remote, ":.", NULL);
@ -10403,13 +10411,13 @@ flatpak_dir_get_all_installed_refs (FlatpakDir *self,
}
char **
flatpak_dir_find_installed_refs (FlatpakDir *self,
const char *opt_name,
const char *opt_branch,
const char *opt_arch,
FlatpakKinds kinds,
FindMatchingRefsFlags flags,
GError **error)
flatpak_dir_find_installed_refs (FlatpakDir *self,
const char *opt_name,
const char *opt_branch,
const char *opt_arch,
FlatpakKinds kinds,
FindMatchingRefsFlags flags,
GError **error)
{
g_autoptr(GHashTable) local_refs = NULL;
GPtrArray *matched_refs;
@ -10944,6 +10952,7 @@ create_origin_remote_config (OstreeRepo *repo,
GKeyFile **new_config)
{
g_autofree char *remote = NULL;
g_auto(GStrv) remotes = NULL;
int version = 0;
g_autofree char *group = NULL;
@ -11572,7 +11581,7 @@ flatpak_dir_remove_remote (FlatpakDir *self,
return FALSE;
ostree_repo_remote_get_url (self->repo, remote_name, &url, NULL);
if (!ostree_repo_remote_change (self->repo, NULL,
OSTREE_REPO_REMOTE_CHANGE_DELETE,
remote_name, NULL,
@ -12805,11 +12814,11 @@ get_locale_langs_from_localed_dbus (GDBusProxy *proxy, GPtrArray *langs)
g_autofree char *lang = NULL;
/* See locale(7) for these categories */
const char* const categories[] = { "LANG=", "LC_ALL=", "LC_MESSAGES=", "LC_ADDRESS=",
"LC_COLLATE=", "LC_CTYPE=", "LC_IDENTIFICATION=",
"LC_MONETARY=", "LC_MEASUREMENT=", "LC_NAME=",
"LC_NUMERIC=", "LC_PAPER=", "LC_TELEPHONE=",
"LC_TIME=", NULL };
const char * const categories[] = { "LANG=", "LC_ALL=", "LC_MESSAGES=", "LC_ADDRESS=",
"LC_COLLATE=", "LC_CTYPE=", "LC_IDENTIFICATION=",
"LC_MONETARY=", "LC_MEASUREMENT=", "LC_NAME=",
"LC_NUMERIC=", "LC_PAPER=", "LC_TELEPHONE=",
"LC_TIME=", NULL };
for (j = 0; categories[j]; j++)
{
@ -12851,6 +12860,7 @@ get_locale_langs_from_accounts_dbus (GDBusProxy *proxy, GPtrArray *langs)
{
const char *accounts_bus_name = "org.freedesktop.Accounts";
const char *accounts_interface_name = "org.freedesktop.Accounts.User";
g_auto(GStrv) object_paths = NULL;
int i;
g_autoptr(GVariant) ret = NULL;
@ -13030,7 +13040,7 @@ flatpak_collection_ref_equal (gconstpointer ref1,
void
flatpak_dir_set_source_pid (FlatpakDir *self,
pid_t pid)
pid_t pid)
{
self->source_pid = pid;
}
@ -13042,19 +13052,19 @@ flatpak_dir_get_source_pid (FlatpakDir *self)
}
static void
(flatpak_dir_log) (FlatpakDir *self,
const char *file,
int line,
const char *func,
const char *source, /* overrides self->name */
const char *change,
const char *remote,
const char *ref,
const char *commit,
const char *old_commit,
const char *url,
const char *format,
...)
(flatpak_dir_log) (FlatpakDir * self,
const char *file,
int line,
const char *func,
const char *source, /* overrides self->name */
const char *change,
const char *remote,
const char *ref,
const char *commit,
const char *old_commit,
const char *url,
const char *format,
...)
{
#ifdef HAVE_LIBSYSTEMD
const char *installation = source ? source : flatpak_dir_get_name_cached (self);

View File

@ -28,7 +28,7 @@
/**
* SECTION:flatpak-error
* @Title: Error codes
*
*
* The FlatpakError and FlatpakPortalError enumerations contain error codes
* for some common errors.
*/

View File

@ -78,7 +78,7 @@ struct _FlatpakInstallationPrivate
flatpak_installation_drop_caches(), so every user needs to keep its own reference alive until
done. */
FlatpakDir *dir_unlocked;
char *display_name;
char *display_name;
};
G_DEFINE_TYPE_WITH_PRIVATE (FlatpakInstallation, flatpak_installation, G_TYPE_OBJECT)
@ -167,7 +167,7 @@ flatpak_installation_new_for_dir (FlatpakDir *dir,
*/
void
flatpak_installation_set_no_interaction (FlatpakInstallation *self,
gboolean no_interaction)
gboolean no_interaction)
{
FlatpakInstallationPrivate *priv = flatpak_installation_get_instance_private (self);
@ -534,12 +534,13 @@ const char *
flatpak_installation_get_display_name (FlatpakInstallation *self)
{
FlatpakInstallationPrivate *priv = flatpak_installation_get_instance_private (self);
g_autoptr(FlatpakDir) dir = flatpak_installation_get_dir_maybe_no_repo (self);
if (priv->display_name == NULL)
priv->display_name = flatpak_dir_get_display_name (dir);
return (const char *)priv->display_name;
return (const char *) priv->display_name;
}
/**
@ -1345,7 +1346,7 @@ flatpak_installation_list_remotes_by_type (FlatpakInstallation *self,
if (default_repo_finders != NULL && num_types == 0)
{
g_autofree char *default_repo_finders_str = g_strjoinv (" ", (gchar **)default_repo_finders);
g_autofree char *default_repo_finders_str = g_strjoinv (" ", (gchar **) default_repo_finders);
g_debug ("Using default repo finder list: %s", default_repo_finders_str);
for (const char * const *iter = default_repo_finders; iter && *iter; iter++)
@ -2897,12 +2898,13 @@ find_used_refs (FlatpakDir *dir,
* Since: 1.1.2
*/
GPtrArray *
flatpak_installation_list_unused_refs (FlatpakInstallation *self,
const char *arch,
GCancellable *cancellable,
GError **error)
flatpak_installation_list_unused_refs (FlatpakInstallation *self,
const char *arch,
GCancellable *cancellable,
GError **error)
{
FlatpakDir *dir;
g_autoptr(GHashTable) refs_hash = NULL;
g_autoptr(GPtrArray) refs = NULL;
g_auto(GStrv) app_refs = NULL;
@ -2958,34 +2960,34 @@ flatpak_installation_list_unused_refs (FlatpakInstallation *self,
}
GLNX_HASH_TABLE_FOREACH (used_runtimes, const char *, runtime)
{
g_autofree char *runtime_ref = g_strconcat ("runtime/", runtime, NULL);
{
g_autofree char *runtime_ref = g_strconcat ("runtime/", runtime, NULL);
g_autoptr(FlatpakDeploy) deploy = NULL;
g_autofree char *origin = NULL;
g_autofree char *sdk = NULL;
g_autoptr(GKeyFile) metakey = NULL;
g_autoptr(FlatpakDeploy) deploy = NULL;
g_autofree char *origin = NULL;
g_autofree char *sdk = NULL;
g_autoptr(GKeyFile) metakey = NULL;
deploy = flatpak_dir_load_deployed (dir, runtime_ref, NULL, NULL, NULL);
if (deploy == NULL)
continue;
deploy = flatpak_dir_load_deployed (dir, runtime_ref, NULL, NULL, NULL);
if (deploy == NULL)
continue;
origin = flatpak_dir_get_origin (dir, runtime_ref, NULL, NULL);
if (origin == NULL)
continue;
origin = flatpak_dir_get_origin (dir, runtime_ref, NULL, NULL);
if (origin == NULL)
continue;
find_used_refs (dir, used_refs, runtime_ref, origin);
find_used_refs (dir, used_refs, runtime_ref, origin);
metakey = flatpak_deploy_get_metadata (deploy);
sdk = g_key_file_get_string (metakey, "Runtime", "sdk", NULL);
if (sdk)
{
g_autofree char *sdk_ref = g_strconcat ("runtime/", sdk, NULL);
g_autofree char *sdk_origin = flatpak_dir_get_origin (dir, sdk_ref, NULL, NULL);
if (sdk_origin)
find_used_refs (dir, used_refs, sdk_ref, sdk_origin);
}
}
metakey = flatpak_deploy_get_metadata (deploy);
sdk = g_key_file_get_string (metakey, "Runtime", "sdk", NULL);
if (sdk)
{
g_autofree char *sdk_ref = g_strconcat ("runtime/", sdk, NULL);
g_autofree char *sdk_origin = flatpak_dir_get_origin (dir, sdk_ref, NULL, NULL);
if (sdk_origin)
find_used_refs (dir, used_refs, sdk_ref, sdk_origin);
}
}
for (i = 0; runtime_refs[i] != NULL; i++)
{
@ -2997,10 +2999,10 @@ flatpak_installation_list_unused_refs (FlatpakInstallation *self,
if (!g_hash_table_contains (used_refs, ref))
{
if (g_hash_table_add (refs_hash, (gpointer)ref))
if (g_hash_table_add (refs_hash, (gpointer) ref))
g_ptr_array_add (refs, get_ref (dir, ref, NULL, NULL));
}
}
return g_steal_pointer (&refs);
return g_steal_pointer (&refs);
}

View File

@ -223,10 +223,10 @@ FLATPAK_EXTERN GPtrArray *flatpak_installation_list_installed_refs_by_
FLATPAK_EXTERN GPtrArray *flatpak_installation_list_installed_refs_for_update (FlatpakInstallation *self,
GCancellable *cancellable,
GError **error);
FLATPAK_EXTERN GPtrArray *flatpak_installation_list_unused_refs (FlatpakInstallation *self,
const char *arch,
GCancellable *cancellable,
GError **error);
FLATPAK_EXTERN GPtrArray *flatpak_installation_list_unused_refs (FlatpakInstallation *self,
const char *arch,
GCancellable *cancellable,
GError **error);
FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_get_installed_ref (FlatpakInstallation *self,
FlatpakRefKind kind,
const char *name,

View File

@ -480,8 +480,8 @@ flatpak_installed_ref_load_metadata (FlatpakInstalledRef *self,
*/
GBytes *
flatpak_installed_ref_load_appdata (FlatpakInstalledRef *self,
GCancellable *cancellable,
GError **error)
GCancellable *cancellable,
GError **error)
{
FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
char *data;

View File

@ -262,7 +262,7 @@ static int get_child_pid (const char *dir);
* Gets the PID of the application process in the sandbox.
*
* See flatpak_instance_get_pid().
*
*
* Note that this function may return 0 immediately after launching
* a sandbox, for a short amount of time.
*
@ -308,6 +308,7 @@ static GKeyFile *
get_instance_info (const char *dir)
{
g_autofree char *file = NULL;
g_autoptr(GKeyFile) key_file = NULL;
g_autoptr(GError) error = NULL;
@ -329,6 +330,7 @@ get_child_pid (const char *dir)
g_autofree char *file = NULL;
g_autofree char *contents = NULL;
gsize length;
g_autoptr(GError) error = NULL;
g_autoptr(JsonParser) parser = NULL;
JsonNode *node;
@ -366,6 +368,7 @@ get_pid (const char *dir)
{
g_autofree char *file = NULL;
g_autofree char *contents = NULL;
g_autoptr(GError) error = NULL;
file = g_build_filename (dir, "pid", NULL);
@ -397,24 +400,24 @@ flatpak_instance_new (const char *dir)
if (g_key_file_has_group (priv->info, FLATPAK_METADATA_GROUP_APPLICATION))
{
priv->app = g_key_file_get_string (priv->info,
FLATPAK_METADATA_GROUP_APPLICATION, FLATPAK_METADATA_KEY_NAME, NULL);
FLATPAK_METADATA_GROUP_APPLICATION, FLATPAK_METADATA_KEY_NAME, NULL);
priv->runtime = g_key_file_get_string (priv->info,
FLATPAK_METADATA_GROUP_APPLICATION, FLATPAK_METADATA_KEY_RUNTIME, NULL);
FLATPAK_METADATA_GROUP_APPLICATION, FLATPAK_METADATA_KEY_RUNTIME, NULL);
}
else
{
priv->runtime = g_key_file_get_string (priv->info,
FLATPAK_METADATA_GROUP_RUNTIME, FLATPAK_METADATA_KEY_RUNTIME, NULL);
FLATPAK_METADATA_GROUP_RUNTIME, FLATPAK_METADATA_KEY_RUNTIME, NULL);
}
priv->arch = g_key_file_get_string (priv->info,
FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_ARCH, NULL);
FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_ARCH, NULL);
priv->branch = g_key_file_get_string (priv->info,
FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_BRANCH, NULL);
FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_BRANCH, NULL);
priv->commit = g_key_file_get_string (priv->info,
FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_APP_COMMIT, NULL);
FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_APP_COMMIT, NULL);
priv->runtime_commit = g_key_file_get_string (priv->info,
FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_RUNTIME_COMMIT, NULL);
FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_RUNTIME_COMMIT, NULL);
}
return self;
@ -510,4 +513,3 @@ flatpak_instance_is_running (FlatpakInstance *self)
return FALSE;
}

View File

@ -50,19 +50,19 @@ typedef struct
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakInstance, g_object_unref)
#endif
FLATPAK_EXTERN GPtrArray * flatpak_instance_get_all (void);
FLATPAK_EXTERN GPtrArray * flatpak_instance_get_all (void);
FLATPAK_EXTERN const char * flatpak_instance_get_id (FlatpakInstance *self);
FLATPAK_EXTERN const char * flatpak_instance_get_app (FlatpakInstance *self);
FLATPAK_EXTERN const char * flatpak_instance_get_arch (FlatpakInstance *self);
FLATPAK_EXTERN const char * flatpak_instance_get_branch (FlatpakInstance *self);
FLATPAK_EXTERN const char * flatpak_instance_get_commit (FlatpakInstance *self);
FLATPAK_EXTERN const char * flatpak_instance_get_runtime (FlatpakInstance *self);
FLATPAK_EXTERN const char * flatpak_instance_get_id (FlatpakInstance *self);
FLATPAK_EXTERN const char * flatpak_instance_get_app (FlatpakInstance *self);
FLATPAK_EXTERN const char * flatpak_instance_get_arch (FlatpakInstance *self);
FLATPAK_EXTERN const char * flatpak_instance_get_branch (FlatpakInstance *self);
FLATPAK_EXTERN const char * flatpak_instance_get_commit (FlatpakInstance *self);
FLATPAK_EXTERN const char * flatpak_instance_get_runtime (FlatpakInstance *self);
FLATPAK_EXTERN const char * flatpak_instance_get_runtime_commit (FlatpakInstance *self);
FLATPAK_EXTERN int flatpak_instance_get_pid (FlatpakInstance *self);
FLATPAK_EXTERN int flatpak_instance_get_child_pid (FlatpakInstance *self);
FLATPAK_EXTERN GKeyFile * flatpak_instance_get_info (FlatpakInstance *self);
FLATPAK_EXTERN int flatpak_instance_get_pid (FlatpakInstance *self);
FLATPAK_EXTERN int flatpak_instance_get_child_pid (FlatpakInstance *self);
FLATPAK_EXTERN GKeyFile * flatpak_instance_get_info (FlatpakInstance *self);
FLATPAK_EXTERN gboolean flatpak_instance_is_running (FlatpakInstance *self);
FLATPAK_EXTERN gboolean flatpak_instance_is_running (FlatpakInstance *self);
#endif /* __FLATPAK_INSTANCE_H__ */

View File

@ -1934,6 +1934,7 @@ flatpak_oci_index_ensure_cached (SoupSession *soup_session,
GError **error)
{
g_autofree char *index_path = g_file_get_path (index);
g_autoptr(SoupURI) base_uri = NULL;
g_autoptr(SoupURI) query_uri = NULL;
g_autofree char *query_uri_s = NULL;
@ -2150,7 +2151,7 @@ flatpak_oci_index_make_summary (GFile *index,
g_variant_builder_add_value (refs_builder,
g_variant_new ("(s(t@ay@a{sv}))", ref,
(guint64)0,
(guint64) 0,
ostree_checksum_to_bytes_v (fake_commit),
g_variant_builder_end (ref_metadata_builder)));
g_variant_builder_add (ref_data_builder, "{s(tts)}",

View File

@ -521,7 +521,7 @@ flatpak_remote_get_main_ref (FlatpakRemote *self)
*/
void
flatpak_remote_set_main_ref (FlatpakRemote *self,
const char *main_ref)
const char *main_ref)
{
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
@ -874,7 +874,7 @@ flatpak_remote_commit (FlatpakRemote *self,
if (priv->name[0] == '\0' ||
!g_key_file_is_group_name (group))
return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Bad remote name: %s"), priv->name);
url = flatpak_remote_get_url (self);
if (url == NULL || *url == 0)
return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("No url specified"));

View File

@ -1750,10 +1750,10 @@ flatpak_run_allocate_id (int *lock_fd_out)
#ifdef HAVE_DCONF
static void
add_dconf_key_to_keyfile (GKeyFile *keyfile,
DConfClient *client,
const char *key,
DConfReadFlags flags)
add_dconf_key_to_keyfile (GKeyFile *keyfile,
DConfClient *client,
const char *key,
DConfReadFlags flags)
{
g_autofree char *group = g_path_get_dirname (key);
g_autofree char *k = g_path_get_basename (key);
@ -1767,10 +1767,10 @@ add_dconf_key_to_keyfile (GKeyFile *keyfile,
}
static void
add_dconf_dir_to_keyfile (GKeyFile *keyfile,
DConfClient *client,
const char *dir,
DConfReadFlags flags)
add_dconf_dir_to_keyfile (GKeyFile *keyfile,
DConfClient *client,
const char *dir,
DConfReadFlags flags)
{
g_auto(GStrv) keys = NULL;
int i;
@ -1938,10 +1938,10 @@ get_dconf_data (const char *app_id,
}
static gboolean
flatpak_run_add_dconf_args (FlatpakBwrap *bwrap,
const char *app_id,
GKeyFile *metakey,
GError **error)
flatpak_run_add_dconf_args (FlatpakBwrap *bwrap,
const char *app_id,
GKeyFile *metakey,
GError **error)
{
g_auto(GStrv) paths = NULL;
g_autofree char *migrate_path = NULL;
@ -1965,7 +1965,7 @@ flatpak_run_add_dconf_args (FlatpakBwrap *bwrap,
}
get_dconf_data (app_id,
(const char **)paths,
(const char **) paths,
migrate_path,
&defaults, &defaults_size,
&values, &values_size,
@ -2000,7 +2000,7 @@ flatpak_run_add_dconf_args (FlatpakBwrap *bwrap,
NULL);
if (values_size != 0 && !g_file_test (filename, G_FILE_TEST_EXISTS))
{
{
g_autofree char *dir = g_path_get_dirname (filename);
if (g_mkdir_with_parents (dir, 0700) == -1)
@ -2209,7 +2209,7 @@ flatpak_run_add_app_info_args (FlatpakBwrap *bwrap,
flatpak_bwrap_add_args_data_fd (bwrap, "--info-fd", fd3, NULL);
if (app_info_path_out != NULL)
if (app_info_path_out != NULL)
*app_info_path_out = g_strdup_printf ("/proc/self/fd/%d", fd);
if (instance_id_host_dir_out != NULL)

View File

@ -131,7 +131,7 @@ struct _FlatpakTransactionPrivate
GList *ops;
GPtrArray *added_origin_remotes;
GList *flatpakrefs; /* GKeyFiles */
GList *flatpakrefs; /* GKeyFiles */
GList *bundles; /* BundleData */
FlatpakTransactionOperation *current_op;
@ -238,8 +238,8 @@ flatpak_transaction_progress_set_update_frequency (FlatpakTransactionProgress *s
* @self: a #FlatpakTransactionProgress
*
* Gets the current status string
*
* Returns: (transfer none): the current status
*
* Returns: (transfer none): the current status
*/
char *
flatpak_transaction_progress_get_status (FlatpakTransactionProgress *self)
@ -266,7 +266,7 @@ flatpak_transaction_progress_get_is_estimating (FlatpakTransactionProgress *self
* @self: a #FlatpakTransactionProgress
*
* Gets the current progress.
*
*
* Returns: the current progress, as an integer between 0 and 100
*/
int
@ -612,7 +612,7 @@ flatpak_transaction_operation_get_operation_type (FlatpakTransactionOperation *s
* Gets the ref that the operation applies to.
*
* Returns: (transfer none): the ref
*/
*/
const char *
flatpak_transaction_operation_get_ref (FlatpakTransactionOperation *self)
{
@ -626,7 +626,7 @@ flatpak_transaction_operation_get_ref (FlatpakTransactionOperation *self)
* Gets the remote that the operation applies to.
*
* Returns: (transfer none): the remote
*/
*/
const char *
flatpak_transaction_operation_get_remote (FlatpakTransactionOperation *self)
{
@ -897,9 +897,9 @@ flatpak_transaction_add_new_remote (FlatpakTransaction *transaction,
return FALSE;
}
static gboolean flatpak_transaction_real_run (FlatpakTransaction *transaction,
GCancellable *cancellable,
GError **error);
static gboolean flatpak_transaction_real_run (FlatpakTransaction *transaction,
GCancellable *cancellable,
GError **error);
static void
flatpak_transaction_class_init (FlatpakTransactionClass *klass)
@ -1277,7 +1277,7 @@ flatpak_transaction_set_force_uninstall (FlatpakTransaction *self,
* @arch: the arch to make default
*
* Sets the architecture to default to where it is unspecified.
*/
*/
void
flatpak_transaction_set_default_arch (FlatpakTransaction *self,
const char *arch)
@ -1452,6 +1452,7 @@ add_related (FlatpakTransaction *self,
GError **error)
{
FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (self);
g_autoptr(FlatpakRemoteState) state = NULL;
g_autoptr(GPtrArray) related = NULL;
g_autoptr(GError) local_error = NULL;
@ -1667,6 +1668,7 @@ flatpak_transaction_add_ref (FlatpakTransaction *self,
{
FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (self);
g_autofree char *origin = NULL;
g_auto(GStrv) parts = NULL;
const char *pref;
g_autofree char *origin_remote = NULL;
@ -2136,7 +2138,7 @@ resolve_ops (FlatpakTransaction *self,
if (op->kind == FLATPAK_TRANSACTION_OPERATION_INSTALL)
priv->max_op = MAX (priv->max_op, RUNTIME_INSTALL);
}
state = flatpak_transaction_ensure_remote_state (self, op->kind, op->remote, error);
if (state == NULL)
return FALSE;
@ -2750,7 +2752,7 @@ flatpak_transaction_real_run (FlatpakTransaction *self,
return flatpak_fail (error, _("Transaction already executed"));
priv->can_run = FALSE;
priv->current_op = NULL;
if (flatpak_dir_is_user (priv->dir) && getuid () == 0)

View File

@ -122,10 +122,10 @@ struct _FlatpakTransactionClass
const char *remote_name,
const char *url);
gboolean (*run) (FlatpakTransaction *transaction,
GCancellable *cancellable,
GError **error);
gboolean (*run) (FlatpakTransaction *transaction,
GCancellable *cancellable,
GError **error);
gpointer padding[9];
};

View File

@ -57,8 +57,10 @@ typedef enum {
#define FLATPAK_ANSI_ROW_N "\x1b[%d;1H"
#define FLATPAK_ANSI_CLEAR "\x1b[0J"
void flatpak_get_window_size (int *rows, int *cols);
gboolean flatpak_get_cursor_pos (int *row, int *col);
void flatpak_get_window_size (int *rows,
int *cols);
gboolean flatpak_get_cursor_pos (int *row,
int *col);
void flatpak_hide_cursor (void);
void flatpak_show_cursor (void);
@ -80,9 +82,10 @@ void flatpak_disable_raw_mode (void);
*/
#define flatpak_fail glnx_throw
gboolean flatpak_fail_error (GError **error,
gboolean flatpak_fail_error (GError **error,
FlatpakError code,
const char *fmt, ...) G_GNUC_PRINTF (3,4);
const char *fmt,
...) G_GNUC_PRINTF (3, 4);
void flatpak_debug2 (const char *format,
...) G_GNUC_PRINTF (1, 2);
@ -132,16 +135,16 @@ gboolean flatpak_write_update_checksum (GOutputStream *out,
GError **error);
gboolean flatpak_splice_update_checksum (GOutputStream *out,
gboolean flatpak_splice_update_checksum (GOutputStream * out,
GInputStream *in,
GChecksum *checksum,
FlatpakLoadUriProgress progress,
gpointer progress_data,
gpointer progress_data,
GCancellable *cancellable,
GError **error);
GBytes * flatpak_read_stream (GInputStream *in,
gboolean null_terminate,
GBytes * flatpak_read_stream (GInputStream * in,
gboolean null_terminate,
GError **error);
gboolean flatpak_variant_save (GFile *dest,
@ -205,7 +208,8 @@ gboolean flatpak_split_partial_ref_arg_novalidate (const char *partial_ref,
char **out_arch,
char **out_branch);
int flatpak_compare_ref (const char *ref1, const char *ref2);
int flatpak_compare_ref (const char *ref1,
const char *ref2);
char * flatpak_compose_ref (gboolean app,
const char *name,
@ -261,12 +265,12 @@ gboolean flatpak_remove_dangling_symlinks (GFile *dir,
GCancellable *cancellable,
GError **error);
gboolean flatpak_utils_ascii_string_to_unsigned (const gchar *str,
guint base,
guint64 min,
guint64 max,
guint64 *out_num,
GError **error);
gboolean flatpak_utils_ascii_string_to_unsigned (const gchar *str,
guint base,
guint64 min,
guint64 max,
guint64 *out_num,
GError **error);
#if !GLIB_CHECK_VERSION (2, 40, 0)
@ -304,7 +308,8 @@ g_key_file_load_from_bytes (GKeyFile *key_file,
#if !GLIB_CHECK_VERSION (2, 56, 0)
GDateTime *flatpak_g_date_time_new_from_iso8601 (const gchar *text, GTimeZone *default_tz);
GDateTime *flatpak_g_date_time_new_from_iso8601 (const gchar *text,
GTimeZone *default_tz);
static inline GDateTime *
g_date_time_new_from_iso8601 (const gchar *text, GTimeZone *default_tz)
@ -512,11 +517,11 @@ gboolean flatpak_rm_rf (GFile *dir,
GCancellable *cancellable,
GError **error);
gboolean flatpak_canonicalize_permissions (int parent_dfd,
const char *rel_path,
int uid,
int gid,
GError **error);
gboolean flatpak_canonicalize_permissions (int parent_dfd,
const char *rel_path,
int uid,
int gid,
GError **error);
char * flatpak_readlink (const char *path,
GError **error);
@ -656,8 +661,8 @@ FlatpakXml *flatpak_xml_new_text (const gchar *text);
void flatpak_xml_add (FlatpakXml *parent,
FlatpakXml *node);
void flatpak_xml_free (FlatpakXml *node);
FlatpakXml *flatpak_xml_parse (GInputStream *in,
gboolean compressed,
FlatpakXml *flatpak_xml_parse (GInputStream * in,
gboolean compressed,
GCancellable *cancellable,
GError **error);
void flatpak_xml_to_string (FlatpakXml *node,
@ -698,10 +703,10 @@ gboolean flatpak_allocate_tmpdir (int tmpdir_dfd,
GError **error);
gboolean flatpak_yes_no_prompt (gboolean default_yes,
gboolean flatpak_yes_no_prompt (gboolean default_yes,
const char *prompt,
...) G_GNUC_PRINTF (2, 3);
long flatpak_number_prompt (gboolean default_yes,
int min,
int max,
@ -717,7 +722,7 @@ int *flatpak_parse_numbers (const char *buf,
int max);
void flatpak_format_choices (const char **choices,
const char *prompt,
const char *prompt,
...) G_GNUC_PRINTF (2, 3);
typedef void (*FlatpakProgressCallback)(const char *status,
@ -734,8 +739,9 @@ gboolean flatpak_check_required_version (const char *ref,
GKeyFile *metakey,
GError **error);
int flatpak_levenshtein_distance (const char *s, const char *t);
int flatpak_levenshtein_distance (const char *s,
const char *t);
#define FLATPAK_MESSAGE_ID "c7b39b1e006b464599465e105b361485"
#define FLATPAK_MESSAGE_ID "c7b39b1e006b464599465e105b361485"
#endif /* __FLATPAK_UTILS_H__ */

View File

@ -673,7 +673,7 @@ flatpak_get_timezone (void)
/* Final fall-back is UTC */
return g_strdup ("UTC");
}
}
static gboolean
is_valid_initial_name_character (gint c, gboolean allow_dash)
@ -1003,7 +1003,7 @@ flatpak_is_valid_branch (const char *string,
len = strlen (string);
if (G_UNLIKELY (len == 0))
{
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_NAME,
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_NAME,
_("Branch can't be empty"));
goto out;
}
@ -1013,7 +1013,7 @@ flatpak_is_valid_branch (const char *string,
s = string;
if (G_UNLIKELY (!is_valid_initial_branch_character (*s)))
{
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_NAME,
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_NAME,
_("Branch can't start with %c"), *s);
goto out;
}
@ -1023,7 +1023,7 @@ flatpak_is_valid_branch (const char *string,
{
if (G_UNLIKELY (!is_valid_branch_character (*s)))
{
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_NAME,
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_NAME,
_("Branch can't contain %c"), *s);
goto out;
}
@ -1088,8 +1088,9 @@ compare_segment (const char *s1, const char *s2)
c1 = *s1;
c2 = *s2;
if (c1 != c2)
return (c1 - c2);
s1++; s2++;
return c1 - c2;
s1++;
s2++;
}
c1 = *s1;
@ -1633,12 +1634,13 @@ flatpak_find_deploy_for_ref_in (GPtrArray *dirs,
{
FlatpakDeploy *deploy = NULL;
int i;
g_autoptr(GError) my_error = NULL;
for (i = 0; deploy == NULL && i < dirs->len; i++)
{
FlatpakDir *dir = g_ptr_array_index (dirs, i);
flatpak_log_dir_access (dir);
g_clear_error (&my_error);
deploy = flatpak_dir_load_deployed (dir, ref, commit, cancellable, &my_error);
@ -2075,12 +2077,12 @@ out:
}
static gboolean
_flatpak_canonicalize_permissions (int parent_dfd,
const char *rel_path,
gboolean toplevel,
int uid,
int gid,
GError **error)
_flatpak_canonicalize_permissions (int parent_dfd,
const char *rel_path,
gboolean toplevel,
int uid,
int gid,
GError **error)
{
struct stat stbuf;
gboolean res = TRUE;
@ -2150,9 +2152,9 @@ _flatpak_canonicalize_permissions (int parent_dfd,
res = FALSE;
}
return res;
return res;
}
else if (S_ISREG(stbuf.st_mode))
else if (S_ISREG (stbuf.st_mode))
{
mode_t mode;
@ -2168,14 +2170,14 @@ _flatpak_canonicalize_permissions (int parent_dfd,
res = FALSE;
}
}
else if (S_ISLNK(stbuf.st_mode))
else if (S_ISLNK (stbuf.st_mode))
{
/* symlinks have no permissions */
}
else
{
/* some weird non-canonical type, lets delete it */
if (unlinkat(parent_dfd, rel_path, 0) != 0)
if (unlinkat (parent_dfd, rel_path, 0) != 0)
{
glnx_set_error_from_errno (error);
res = FALSE;
@ -2187,11 +2189,11 @@ _flatpak_canonicalize_permissions (int parent_dfd,
/* Canonicalizes files to the same permissions as bare-user-only checkouts */
gboolean
flatpak_canonicalize_permissions (int parent_dfd,
const char *rel_path,
int uid,
int gid,
GError **error)
flatpak_canonicalize_permissions (int parent_dfd,
const char *rel_path,
int uid,
int gid,
GError **error)
{
return _flatpak_canonicalize_permissions (parent_dfd, rel_path, TRUE, uid, gid, error);
}
@ -4120,6 +4122,7 @@ flatpak_extension_matches_reason (const char *extension_id,
gboolean default_value)
{
const char *extension_basename;
g_auto(GStrv) reason_list = NULL;
size_t i;
@ -4831,7 +4834,7 @@ flatpak_pull_from_bundle (OstreeRepo *repo,
if (remote_collection_id != NULL && collection_id != NULL &&
strcmp (remote_collection_id, collection_id) != 0)
return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Collection %s of bundle doesnt match collection %s of remote"),
collection_id, remote_collection_id);
collection_id, remote_collection_id);
if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
return FALSE;
@ -5474,7 +5477,7 @@ flatpak_parse_numbers (const char *buf,
}
else if (is_number (parts[i]))
{
int res = (int)strtol (parts[i], NULL, 10);
int res = (int) strtol (parts[i], NULL, 10);
if (min <= res && res <= max)
add_number (numbers, res);
else
@ -5538,7 +5541,7 @@ flatpak_numbers_prompt (gboolean default_yes, int min, int max, const char *prom
void
flatpak_format_choices (const char **choices,
const char *prompt,
const char *prompt,
...)
{
va_list var_args;
@ -5551,7 +5554,7 @@ flatpak_format_choices (const char **choices,
g_print ("%s\n\n", s);
for (i = 0; choices[i]; i++)
g_print (" %2d) %s\n", i+1, choices[i]);
g_print (" %2d) %s\n", i + 1, choices[i]);
g_print ("\n");
}
@ -5693,6 +5696,7 @@ progress_cb (OstreeAsyncProgress *progress, gpointer user_data)
guint requested;
guint64 total_transferred;
g_autofree gchar *formatted_bytes_total_transferred = NULL;
g_autoptr(GVariant) outstanding_fetchesv = NULL;
/* We get some extra calls before we've really started due to the initialization of the
@ -5963,12 +5967,12 @@ str_has_hex_prefix (const gchar *str)
* make sure to remove str_has_hex_prefix and str_has_sign helpers too.
*/
gboolean
flatpak_utils_ascii_string_to_unsigned (const gchar *str,
guint base,
guint64 min,
guint64 max,
guint64 *out_num,
GError **error)
flatpak_utils_ascii_string_to_unsigned (const gchar *str,
guint base,
guint64 min,
guint64 max,
guint64 *out_num,
GError **error)
{
guint64 number;
const gchar *end_ptr = NULL;
@ -5988,24 +5992,24 @@ flatpak_utils_ascii_string_to_unsigned (const gchar *str,
}
errno = 0;
number = g_ascii_strtoull (str, (gchar **)&end_ptr, base);
number = g_ascii_strtoull (str, (gchar **) &end_ptr, base);
saved_errno = errno;
if (/* We do not allow leading whitespace, but g_ascii_strtoull
* accepts it and just skips it, so we need to check for it
* ourselves.
*/
g_ascii_isspace (str[0]) ||
/* Unsigned number should have no sign.
*/
str_has_sign (str) ||
/* We don't support hexadecimal numbers prefixed with 0x or
* 0X.
*/
(base == 16 && str_has_hex_prefix (str)) ||
(saved_errno != 0 && saved_errno != ERANGE) ||
end_ptr == NULL ||
*end_ptr != '\0')
g_ascii_isspace (str[0]) ||
/* Unsigned number should have no sign.
*/
str_has_sign (str) ||
/* We don't support hexadecimal numbers prefixed with 0x or
* 0X.
*/
(base == 16 && str_has_hex_prefix (str)) ||
(saved_errno != 0 && saved_errno != ERANGE) ||
end_ptr == NULL ||
*end_ptr != '\0')
{
g_set_error (error,
G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
@ -6043,7 +6047,7 @@ dist (const char *s, int ls, const char *t, int lt, int i, int j, int *d)
else if (j == lt)
x = ls - i;
else if (s[i] == t[j])
x = dist(s, ls, t, lt, i + 1, j + 1, d);
x = dist (s, ls, t, lt, i + 1, j + 1, d);
else
{
x = dist (s, ls, t, lt, i + 1, j + 1, d);
@ -6101,7 +6105,7 @@ flatpak_get_window_size (int *rows, int *cols)
}
gboolean
flatpak_get_cursor_pos (int* row, int *col)
flatpak_get_cursor_pos (int * row, int *col)
{
fd_set readset;
struct timeval time;
@ -6419,7 +6423,7 @@ parse_iso8601_timezone (const gchar *text, gsize length, gssize *tz_offset)
tz_length = length - i;
/* +hh:mm or -hh:mm */
if (tz_length == 6 && text[i+3] == ':')
if (tz_length == 6 && text[i + 3] == ':')
{
if (!get_iso8601_int (text + i + 1, 2, &offset_hours) ||
!get_iso8601_int (text + i + 4, 2, &offset_minutes))
@ -6512,8 +6516,8 @@ flatpak_g_date_time_new_from_iso8601 (const gchar *text, GTimeZone *default_tz)
datetime = parse_iso8601_date (text, date_length, hour, minute, seconds, tz ? tz : default_tz);
out:
if (tz != NULL)
g_time_zone_unref (tz);
return datetime;
if (tz != NULL)
g_time_zone_unref (tz);
return datetime;
}
#endif

View File

@ -32,6 +32,7 @@ validate_icon (const char *arg_width,
int width, height;
const char *name;
const char *allowed_formats[] = { "png", "jpeg", "svg", NULL };
g_autoptr(GdkPixbuf) pixbuf = NULL;
g_autoptr(GError) error = NULL;
@ -50,7 +51,7 @@ validate_icon (const char *arg_width,
}
format = gdk_pixbuf_get_file_info (filename, &width, &height);
if (format == NULL)
if (format == NULL)
{
g_printerr ("Format not recognized\n");
return 1;
@ -128,6 +129,7 @@ rerun_in_sandbox (const char *arg_width,
{
const char * const usrmerged_dirs[] = { "bin", "lib64", "lib", "sbin" };
int i;
g_autoptr(GPtrArray) args = g_ptr_array_new_with_free_func (g_free);
g_autofree char *err = NULL;
int status;
@ -154,7 +156,7 @@ rerun_in_sandbox (const char *arg_width,
"--ro-bind", validate_icon, validate_icon,
NULL);
/* These directories might be symlinks into /usr/... */
/* These directories might be symlinks into /usr/... */
for (i = 0; i < G_N_ELEMENTS (usrmerged_dirs); i++)
{
g_autofree char *absolute_dir = g_strdup_printf ("/%s", usrmerged_dirs[i]);
@ -198,7 +200,7 @@ rerun_in_sandbox (const char *arg_width,
g_ptr_array_add (args, NULL);
{
g_autofree char *cmdline = g_strjoinv (" ", (char **)args->pdata);
g_autofree char *cmdline = g_strjoinv (" ", (char **) args->pdata);
g_debug ("Icon validation: Spawning %s", cmdline);
}

View File

@ -114,9 +114,9 @@ schedule_idle_callback (void)
typedef struct
{
GPid pid;
char *client;
guint child_watch;
GPid pid;
char *client;
guint child_watch;
gboolean watch_bus;
} PidData;
@ -236,7 +236,7 @@ child_setup_func (gpointer user_data)
static gboolean
is_valid_expose (const char *expose,
GError **error)
GError **error)
{
/* No subdirs or absolute paths */
if (expose[0] == '/')

View File

@ -53,9 +53,9 @@ handle_sigterm (int signum)
typedef struct
{
GPid pid;
char *client;
guint child_watch;
GPid pid;
char *client;
guint child_watch;
gboolean watch_bus;
} PidData;
@ -227,7 +227,7 @@ handle_host_command (FlatpakDevelopment *object,
if (!g_variant_is_of_type (arg_fds, G_VARIANT_TYPE ("a{uh}")) ||
!g_variant_is_of_type (arg_envs, G_VARIANT_TYPE ("a{ss}")) ||
(flags & ~(FLATPAK_HOST_COMMAND_FLAGS_CLEAR_ENV|
(flags & ~(FLATPAK_HOST_COMMAND_FLAGS_CLEAR_ENV |
FLATPAK_HOST_COMMAND_FLAGS_WATCH_BUS)) != 0)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,

View File

@ -122,7 +122,7 @@ schedule_idle_callback (void)
static FlatpakDir *
dir_get_system (const char *installation,
pid_t source_pid,
GError **error)
GError **error)
{
FlatpakDir *system = NULL;
@ -554,7 +554,7 @@ handle_deploy_appstream (FlatpakSystemHelper *object,
NULL,
NULL,
&error))
{
{
flatpak_invocation_return_error (invocation, error, "Error updating appstream");
return TRUE;
}

View File

@ -24,16 +24,16 @@ main (int argc, char *argv[])
}
else
{
g_printerr("Usage httpcache [--compressed] URL DEST\n");
g_printerr ("Usage httpcache [--compressed] URL DEST\n");
return 1;
}
if (!flatpak_cache_http_uri (session,
url,
flags,
AT_FDCWD, dest,
NULL, NULL, NULL, &error))
url,
flags,
AT_FDCWD, dest,
NULL, NULL, NULL, &error))
{
g_print ("%s\n", error->message);
return 1;

View File

@ -96,30 +96,30 @@ test_valid_name (void)
typedef struct
{
const gchar *str;
guint base;
gint min;
gint max;
gint expected;
gboolean should_fail;
guint base;
gint min;
gint max;
gint expected;
gboolean should_fail;
} TestData;
const TestData test_data[] = {
/* typical cases for unsigned */
{ "-1",10, 0, 2, 0, TRUE },
{ "-1", 10, 0, 2, 0, TRUE },
{ "1", 10, 0, 2, 1, FALSE },
{ "+1",10, 0, 2, 0, TRUE },
{ "+1", 10, 0, 2, 0, TRUE },
{ "0", 10, 0, 2, 0, FALSE },
{ "+0",10, 0, 2, 0, TRUE },
{ "-0",10, 0, 2, 0, TRUE },
{ "+0", 10, 0, 2, 0, TRUE },
{ "-0", 10, 0, 2, 0, TRUE },
{ "2", 10, 0, 2, 2, FALSE },
{ "+2",10, 0, 2, 0, TRUE },
{ "+2", 10, 0, 2, 0, TRUE },
{ "3", 10, 0, 2, 0, TRUE },
{ "+3",10, 0, 2, 0, TRUE },
{ "+3", 10, 0, 2, 0, TRUE },
/* min == max cases for unsigned */
{ "2",10, 2, 2, 2, FALSE },
{ "3",10, 2, 2, 0, TRUE },
{ "1",10, 2, 2, 0, TRUE },
{ "2", 10, 2, 2, 2, FALSE },
{ "3", 10, 2, 2, 0, TRUE },
{ "1", 10, 2, 2, 0, TRUE },
/* invalid inputs */
{ "", 10, 0, 2, 0, TRUE },
@ -127,16 +127,16 @@ const TestData test_data[] = {
{ "1a", 10, 0, 2, 0, TRUE },
/* leading/trailing whitespace */
{ " 1",10, 0, 2, 0, TRUE },
{ "1 ",10, 0, 2, 0, TRUE },
{ " 1", 10, 0, 2, 0, TRUE },
{ "1 ", 10, 0, 2, 0, TRUE },
/* hexadecimal numbers */
{ "a", 16, 0, 15, 10, FALSE },
{ "0xa", 16, 0, 15, 0, TRUE },
{ "-0xa", 16, 0, 15, 0, TRUE },
{ "+0xa", 16, 0, 15, 0, TRUE },
{ "- 0xa",16, 0, 15, 0, TRUE },
{ "+ 0xa",16, 0, 15, 0, TRUE },
{ "- 0xa", 16, 0, 15, 0, TRUE },
{ "+ 0xa", 16, 0, 15, 0, TRUE },
};
static void
@ -175,10 +175,11 @@ test_string_to_unsigned (void)
}
}
typedef struct {
typedef struct
{
const char *a;
const char *b;
int distance;
int distance;
} Levenshtein;
static Levenshtein levenshtein_tests[] = {
@ -343,18 +344,18 @@ test_parse_numbers (void)
numbers = flatpak_parse_numbers ("1", 0, 10);
assert_numbers (numbers, 1, 0);
g_clear_pointer (&numbers, g_free);
numbers = flatpak_parse_numbers ("1 3 2", 0, 10);
assert_numbers (numbers, 1, 3, 2, 0);
g_clear_pointer (&numbers, g_free);
numbers = flatpak_parse_numbers ("1-3", 0, 10);
assert_numbers (numbers, 1, 2, 3, 0);
g_clear_pointer (&numbers, g_free);
numbers = flatpak_parse_numbers ("1", 2, 4);
g_assert_null (numbers);
numbers = flatpak_parse_numbers ("2-6", 2, 4);
g_assert_null (numbers);
@ -391,28 +392,29 @@ test_subpaths_merge (void)
char *bla[] = { "bla", "ba", NULL };
char *bla_sorted[] = { "ba", "bla", NULL };
char *bubabla[] = { "ba", "bla", "bu", NULL };
g_auto(GStrv) res = NULL;
res = flatpak_subpaths_merge (NULL, bla);
assert_strv_equal (res, bla);
g_clear_pointer (&res, g_strfreev);
res = flatpak_subpaths_merge (bla, NULL);
assert_strv_equal (res, bla);
g_clear_pointer (&res, g_strfreev);
res = flatpak_subpaths_merge (empty, bla);
assert_strv_equal (res, empty);
g_clear_pointer (&res, g_strfreev);
res = flatpak_subpaths_merge (bla, empty);
assert_strv_equal (res, empty);
g_clear_pointer (&res, g_strfreev);
res = flatpak_subpaths_merge (buba, bla);
assert_strv_equal (res, bubabla);
g_clear_pointer (&res, g_strfreev);
res = flatpak_subpaths_merge (bla, buba);
assert_strv_equal (res, bubabla);
g_clear_pointer (&res, g_strfreev);
@ -478,6 +480,7 @@ test_parse_appdata (void)
" <project_license>anything goes</project_license>\n"
" </component>\n"
"</components>";
g_autoptr(GHashTable) names = NULL;
g_autoptr(GHashTable) comments = NULL;
g_autofree char *version = NULL;
@ -485,7 +488,7 @@ test_parse_appdata (void)
gboolean res;
char *name;
char *comment;
res = flatpak_parse_appdata (appdata1, "org.test.Hello", &names, &comments, &version, &license);
g_assert_true (res);
g_assert_cmpstr (version, ==, "0.0.1");
@ -531,57 +534,57 @@ test_name_matching (void)
res = flatpak_name_matches_one_wildcard_prefix ("org.sparkleshare.SparkleShare.Invites",
(const char *[]){"org.sparkleshare.SparkleShare.*", NULL},
FALSE);
FALSE);
g_assert_true (res);
res = flatpak_name_matches_one_wildcard_prefix ("org.sparkleshare.SparkleShare-symbolic",
(const char *[]){"org.sparkleshare.SparkleShare.*", NULL},
FALSE);
FALSE);
g_assert_true (res);
res = flatpak_name_matches_one_wildcard_prefix ("org.libreoffice.LibreOffice",
(const char *[]){"org.libreoffice.LibreOffice.*", NULL},
FALSE);
FALSE);
g_assert_true (res);
res = flatpak_name_matches_one_wildcard_prefix ("org.libreoffice.LibreOffice-impress",
(const char *[]){"org.libreoffice.LibreOffice.*", NULL},
FALSE);
FALSE);
g_assert_true (res);
res = flatpak_name_matches_one_wildcard_prefix ("org.libreoffice.LibreOffice-writer",
(const char *[]){"org.libreoffice.LibreOffice.*", NULL},
FALSE);
FALSE);
g_assert_true (res);
res = flatpak_name_matches_one_wildcard_prefix ("org.libreoffice.LibreOffice-calc",
(const char *[]){"org.libreoffice.LibreOffice.*", NULL},
FALSE);
FALSE);
g_assert_true (res);
res = flatpak_name_matches_one_wildcard_prefix ("com.github.bajoja.indicator-kdeconnect",
(const char *[]){"com.github.bajoja.indicator-kdeconnect.*", NULL},
FALSE);
FALSE);
g_assert_true (res);
res = flatpak_name_matches_one_wildcard_prefix ("com.github.bajoja.indicator-kdeconnect.settings",
(const char *[]){"com.github.bajoja.indicator-kdeconnect.*", NULL},
FALSE);
FALSE);
g_assert_true (res);
res = flatpak_name_matches_one_wildcard_prefix ("com.github.bajoja.indicator-kdeconnect.tablettrusted",
(const char *[]){"com.github.bajoja.indicator-kdeconnect.*", NULL},
FALSE);
FALSE);
g_assert_true (res);
res = flatpak_name_matches_one_wildcard_prefix ("org.gnome.Characters.BackgroundService",
(const char *[]){"org.gnome.Characters.*", NULL},
TRUE);
TRUE);
g_assert_true (res);
res = flatpak_name_matches_one_wildcard_prefix ("org.example.Example.Tracker1.Miner.Applications",
(const char *[]){"org.example.Example.*", NULL},
TRUE);
TRUE);
g_assert_true (res);
}
@ -607,6 +610,7 @@ test_columns (void)
};
Column *cols;
g_autofree char *help = NULL;
g_autoptr(GError) error = NULL;
const char *args[3];
@ -673,11 +677,12 @@ test_columns (void)
g_clear_error (&error);
}
typedef struct {
const char *in;
int len;
typedef struct
{
const char *in;
int len;
FlatpakEllipsizeMode mode;
const char *out;
const char *out;
} EllipsizeData;
static EllipsizeData ellipsize[] = {
@ -871,7 +876,7 @@ test_table_shrink (void)
"Column1 Column2 Column3" FLATPAK_ANSI_BOLD_OFF "\n"
"a very … text2 long…too" "\n"
"short short short" "\n"
"0123456789012345678902345");
"0123456789012345678902345");
g_string_truncate (g_print_buffer, 0);
flatpak_table_printer_free (printer);
@ -930,6 +935,7 @@ test_parse_datetime (void)
struct timespec ts;
struct timespec now;
gboolean ret;
g_autoptr(GDateTime) dt = NULL;
GTimeVal tv;

View File

@ -314,16 +314,16 @@ test_ref (void)
g_clear_error (&error);
ref = flatpak_ref_parse ("app/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"/m68k/master", &error);
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"/m68k/master", &error);
g_assert_null (ref);
g_assert_error (error, FLATPAK_ERROR, FLATPAK_ERROR_INVALID_REF);
g_clear_error (&error);
@ -481,7 +481,7 @@ test_remote_by_name (void)
"name", &name,
"type", &type,
NULL);
g_assert_cmpstr (name, ==, repo_name);
g_assert_cmpint (type, ==, FLATPAK_REMOTE_TYPE_STATIC);
@ -573,7 +573,7 @@ test_remote (void)
g_assert_null (flatpak_remote_get_default_branch (remote));
flatpak_remote_set_default_branch (remote, "master");
g_assert_cmpstr (flatpak_remote_get_default_branch (remote), ==, "master");
res = flatpak_installation_modify_remote (inst, remote, NULL, &error);
g_assert_no_error (error);
g_assert_true (res);
@ -618,7 +618,7 @@ test_remote_new (void)
g_clear_error (&error);
remote = flatpak_remote_new ("my-first-remote");
g_assert_null (flatpak_remote_get_appstream_dir (remote, NULL));
g_assert_null (flatpak_remote_get_appstream_timestamp (remote, NULL));
g_assert_null (flatpak_remote_get_url (remote));
@ -874,8 +874,8 @@ test_list_remote_related_refs (void)
g_assert_true (flatpak_related_ref_should_download (ref));
g_assert_true (flatpak_related_ref_should_delete (ref));
g_assert_false (flatpak_related_ref_should_autoprune (ref));
g_assert (g_strv_length ((char **)flatpak_related_ref_get_subpaths (ref)) == 1);
g_assert_cmpstr (flatpak_related_ref_get_subpaths (ref)[0], ==, "/de");
g_assert (g_strv_length ((char **) flatpak_related_ref_get_subpaths (ref)) == 1);
g_assert_cmpstr (flatpak_related_ref_get_subpaths (ref)[0], ==, "/de");
g_object_get (ref,
"subpaths", &subpaths,
@ -1417,6 +1417,7 @@ static void
add_flatpakrepo (void)
{
g_autofree char *data = NULL;
g_autoptr(GError) error = NULL;
data = g_strconcat ("[Flatpak Repo]\n"
@ -1501,7 +1502,7 @@ setup_repo (void)
configure_languages ();
/* another copy of the same repo, with different url */
symlink("test", "repos/copy-of-test");
symlink ("test", "repos/copy-of-test");
/* another repo, with only the app */
make_test_app2 ();
@ -1655,7 +1656,9 @@ global_teardown (void)
static void
test_misc_transaction (void)
{
struct { int op; const char *name; } kinds[] = {
struct { int op;
const char *name;
} kinds[] = {
{ FLATPAK_TRANSACTION_OPERATION_INSTALL, "install" },
{ FLATPAK_TRANSACTION_OPERATION_UPDATE, "update" },
{ FLATPAK_TRANSACTION_OPERATION_INSTALL_BUNDLE, "install-bundle" },
@ -1738,9 +1741,9 @@ static int new_op_count;
static int op_done_count;
static gboolean
op_error (FlatpakTransaction *transaction,
FlatpakTransactionOperation *op,
GError *error,
op_error (FlatpakTransaction *transaction,
FlatpakTransactionOperation *op,
GError *error,
FlatpakTransactionErrorDetails *details)
{
g_assert_not_reached ();
@ -1749,29 +1752,29 @@ op_error (FlatpakTransaction *transaction,
static gboolean
choose_remote (FlatpakTransaction *transaction,
const char *ref,
const char *runtime,
const char **remotes)
const char *ref,
const char *runtime,
const char **remotes)
{
g_assert_cmpint (g_strv_length ((char **)remotes), ==, 1);
g_assert_cmpint (g_strv_length ((char **) remotes), ==, 1);
return 0;
}
static void
end_of_lifed (FlatpakTransaction *transaction,
const char *ref,
const char *reason,
const char *rebase)
const char *ref,
const char *reason,
const char *rebase)
{
g_assert_not_reached ();
}
static gboolean
add_new_remote (FlatpakTransaction *transaction,
const char *reason,
const char *from_id,
const char *suggested_name,
const char *url)
const char *reason,
const char *from_id,
const char *suggested_name,
const char *url)
{
g_assert_not_reached ();
return TRUE;
@ -1797,15 +1800,16 @@ ready (FlatpakTransaction *transaction)
g_list_free_full (ops, g_object_unref);
return TRUE;
return TRUE;
}
static void
new_op (FlatpakTransaction *transaction,
new_op (FlatpakTransaction *transaction,
FlatpakTransactionOperation *op,
FlatpakTransactionProgress *progress)
FlatpakTransactionProgress *progress)
{
g_autofree char *status = NULL;
g_autoptr(FlatpakTransactionOperation) current = NULL;
g_auto(GStrv) refs = NULL;
@ -1833,10 +1837,10 @@ new_op (FlatpakTransaction *transaction,
}
static void
op_done (FlatpakTransaction *transaction,
op_done (FlatpakTransaction *transaction,
FlatpakTransactionOperation *op,
const char *commit,
int result)
const char *commit,
int result)
{
g_auto(GStrv) refs = NULL;
@ -1858,10 +1862,10 @@ op_done (FlatpakTransaction *transaction,
}
static void
op_done_no_change (FlatpakTransaction *transaction,
op_done_no_change (FlatpakTransaction *transaction,
FlatpakTransactionOperation *op,
const char *commit,
int result)
const char *commit,
int result)
{
g_autofree char *app = NULL;
@ -1873,10 +1877,10 @@ op_done_no_change (FlatpakTransaction *transaction,
}
static void
op_done_with_change (FlatpakTransaction *transaction,
op_done_with_change (FlatpakTransaction *transaction,
FlatpakTransactionOperation *op,
const char *commit,
int result)
const char *commit,
int result)
{
g_autofree char *app = NULL;
@ -1958,10 +1962,10 @@ test_transaction_install_uninstall (void)
g_assert_true (res);
g_assert (!flatpak_transaction_is_empty (transaction));
list = flatpak_transaction_get_operations (transaction);
g_assert_cmpint (g_list_length (list), ==, 1);
op = (FlatpakTransactionOperation *)list->data;
op = (FlatpakTransactionOperation *) list->data;
g_list_free (list);
@ -2038,7 +2042,7 @@ test_transaction_install_uninstall (void)
&error);
g_assert_no_error (error);
g_assert_cmpint (refs->len, ==, 2);
ref = g_object_ref (g_ptr_array_index (refs, 0));
bytes = flatpak_installed_ref_load_metadata (ref, NULL, &error);
g_assert_no_error (error);
@ -2213,10 +2217,10 @@ static int remote_added;
static gboolean
add_new_remote2 (FlatpakTransaction *transaction,
const char *reason,
const char *from_id,
const char *suggested_name,
const char *url)
const char *reason,
const char *from_id,
const char *suggested_name,
const char *url)
{
remote_added++;
g_assert_cmpstr (suggested_name, ==, "my-little-repo");
@ -2323,7 +2327,7 @@ check_ready1_abort (FlatpakTransaction *transaction)
ops = flatpak_transaction_get_operations (transaction);
g_assert_cmpint (g_list_length (ops), ==, 1);
op = ops->data;
g_assert_cmpint (flatpak_transaction_operation_get_operation_type (op), ==, FLATPAK_TRANSACTION_OPERATION_INSTALL);
g_assert_cmpstr (flatpak_transaction_operation_get_ref (op), ==, app);
@ -2353,7 +2357,7 @@ check_ready3_abort (FlatpakTransaction *transaction)
op = ops->data;
g_assert_cmpint (flatpak_transaction_operation_get_operation_type (op), ==, FLATPAK_TRANSACTION_OPERATION_INSTALL);
g_assert_cmpstr (flatpak_transaction_operation_get_ref (op), ==, runtime);
op = ops->next->data;
g_assert_cmpint (flatpak_transaction_operation_get_operation_type (op), ==, FLATPAK_TRANSACTION_OPERATION_INSTALL);
g_assert_cmpstr (flatpak_transaction_operation_get_ref (op), ==, app);
@ -2449,7 +2453,7 @@ test_transaction_install_local (void)
dir = g_get_current_dir ();
path = g_build_filename (dir, "repos", "test", NULL);
url = g_strconcat ("file://", path, NULL);
url = g_strconcat ("file://", path, NULL);
res = flatpak_transaction_add_install (transaction, url, app, NULL, &error);
g_assert_no_error (error);
g_assert_true (res);
@ -2462,7 +2466,7 @@ test_transaction_install_local (void)
res = flatpak_transaction_run (transaction, NULL, &error);
g_assert_no_error (error);
g_assert_true (res);
remote = flatpak_installation_get_remote_by_name (inst, "hello-origin", NULL, &error);
g_assert_no_error (error);
g_assert_nonnull (remote);
@ -2471,9 +2475,9 @@ test_transaction_install_local (void)
typedef struct
{
GMainLoop *loop;
guint stop_waiting_id;
guint hello_dead_cb_id;
gboolean hello_dead;
guint stop_waiting_id;
guint hello_dead_cb_id;
gboolean hello_dead;
} TestInstanceContext;
static gboolean
@ -2488,8 +2492,8 @@ stop_waiting (gpointer data)
}
static void
hello_dead_cb (GPid pid,
int status,
hello_dead_cb (GPid pid,
int status,
gpointer data)
{
TestInstanceContext *context = data;
@ -2576,10 +2580,10 @@ test_instance (void)
g_assert_nonnull (info);
value = g_key_file_get_string (info, "Application", "name", &error);
g_assert_cmpstr (value, ==, "org.test.Hello");
g_clear_pointer (&value, g_free);
g_clear_pointer (&value, g_free);
value = g_key_file_get_string (info, "Instance", "instance-id", &error);
g_assert_cmpstr (value, ==, flatpak_instance_get_id (instance));
g_clear_pointer (&value, g_free);
g_clear_pointer (&value, g_free);
g_assert_cmpstr (flatpak_instance_get_app (instance), ==, "org.test.Hello");
g_assert_cmpstr (flatpak_instance_get_arch (instance), ==,
@ -2667,7 +2671,7 @@ test_update_subpaths (void)
g_assert_no_error (error);
subpaths = flatpak_installed_ref_get_subpaths (ref);
g_assert_cmpint (g_strv_length ((char **)subpaths), ==, 1);
g_assert_cmpint (g_strv_length ((char **) subpaths), ==, 1);
g_assert_cmpstr (subpaths[0], ==, "/de");
g_clear_object (&transaction);
@ -2677,7 +2681,7 @@ test_update_subpaths (void)
g_assert_no_error (error);
subpaths = flatpak_installed_ref_get_subpaths (ref);
g_assert_cmpint (g_strv_length ((char **)subpaths), ==, 2);
g_assert_cmpint (g_strv_length ((char **) subpaths), ==, 2);
g_assert_cmpstr (subpaths[0], ==, "/de");
g_assert_cmpstr (subpaths[1], ==, "/fr");
}
@ -2694,7 +2698,7 @@ test_overrides (void)
g_autoptr(FlatpakInstalledRef) ref = NULL;
g_auto(GStrv) list = NULL;
gsize len;
if (!check_bwrap_support ())
{
g_test_skip ("bwrap not supported");
@ -2761,15 +2765,15 @@ test_overrides (void)
list = g_key_file_get_string_list (overrides, "Context", "filesystems", &len, &error);
g_assert_cmpint (len, ==, 3);
g_assert_true (g_strv_contains ((const char * const *)list, "xdg-download/subdir:create"));
g_assert_true (g_strv_contains ((const char * const *)list, "xdg-music"));
g_assert_true (g_strv_contains ((const char * const *)list, "~/foo:ro"));
g_assert_true (g_strv_contains ((const char * const *) list, "xdg-download/subdir:create"));
g_assert_true (g_strv_contains ((const char * const *) list, "xdg-music"));
g_assert_true (g_strv_contains ((const char * const *) list, "~/foo:ro"));
g_clear_pointer (&list, g_strfreev);
list = g_key_file_get_string_list (overrides, "Context", "sockets", &len, &error);
g_assert_cmpint (len, ==, 2);
g_assert_true (g_strv_contains ((const char * const *)list, "wayland"));
g_assert_true (g_strv_contains ((const char * const *)list, "!pulseaudio"));
g_assert_true (g_strv_contains ((const char * const *) list, "wayland"));
g_assert_true (g_strv_contains ((const char * const *) list, "!pulseaudio"));
g_clear_pointer (&list, g_strfreev);
value = g_key_file_get_string (overrides, "Session Bus Policy", "hello.bla.bla.*", &error);
@ -2823,7 +2827,7 @@ test_bundle (void)
g_assert_cmpstr (flatpak_ref_get_branch (FLATPAK_REF (ref)), ==, "master");
g_assert_cmpint (flatpak_ref_get_kind (FLATPAK_REF (ref)), ==, FLATPAK_REF_KIND_APP);
g_assert_cmpstr (flatpak_ref_get_collection_id (FLATPAK_REF (ref)), ==, "com.example.Test");
file2 = flatpak_bundle_ref_get_file (ref);
g_assert (g_file_equal (file, file2));
@ -2841,7 +2845,7 @@ test_bundle (void)
appstream = flatpak_bundle_ref_get_appstream (ref);
g_assert_nonnull (appstream);
/* FIXME verify format */
icon = flatpak_bundle_ref_get_icon (ref, 64);
g_assert_nonnull (icon);
/* FIXME verify format */
@ -2974,8 +2978,8 @@ test_list_installed_related_refs (void)
g_assert_true (flatpak_related_ref_should_download (ref));
g_assert_true (flatpak_related_ref_should_delete (ref));
g_assert_false (flatpak_related_ref_should_autoprune (ref));
g_assert (g_strv_length ((char **)flatpak_related_ref_get_subpaths (ref)) == 1);
g_assert_cmpstr (flatpak_related_ref_get_subpaths (ref)[0], ==, "/de");
g_assert (g_strv_length ((char **) flatpak_related_ref_get_subpaths (ref)) == 1);
g_assert_cmpstr (flatpak_related_ref_get_subpaths (ref)[0], ==, "/de");
}
static void
@ -3122,7 +3126,7 @@ test_installation_no_interaction (void)
inst = flatpak_installation_new_user (NULL, &error);
g_assert_no_error (error);
g_assert_false (flatpak_installation_get_no_interaction (inst));
flatpak_installation_set_no_interaction (inst, TRUE);
g_assert_true (flatpak_installation_get_no_interaction (inst));
@ -3138,7 +3142,7 @@ test_installation_unused_refs (void)
inst = flatpak_installation_new_user (NULL, &error);
g_assert_no_error (error);
empty_installation (inst);
iref = flatpak_installation_install (inst, repo_name, FLATPAK_REF_KIND_APP, "org.test.Hello", NULL, "master", NULL, NULL, NULL, &error);