summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2018-01-17 11:06:32 +0000
committerRichard Hughes <richard@hughsie.com>2018-01-17 16:24:34 +0000
commit8106be83b3359f9f70f664c1a79f20a362b830bd (patch)
tree307cc06daab88b6bba7b92c8c15e2f3fe9ea640d
parent5a81bc21366215b344053839085685d6c5c2c6bd (diff)
downloadappstream-glib-wip/hughsie/introspection-fixes.tar.gz
Don't expect an enum when really passing a bitfieldwip/hughsie/introspection-fixes
The size of an enum is undefined for most compilers (although, GCC normally does something sensible) but be explicit to avoid changing ABI accidentally.
-rw-r--r--libappstream-glib/as-app-validate.c2
-rw-r--r--libappstream-glib/as-app.c41
-rw-r--r--libappstream-glib/as-app.h16
-rw-r--r--libappstream-glib/as-store.c67
-rw-r--r--libappstream-glib/as-store.h22
5 files changed, 71 insertions, 77 deletions
diff --git a/libappstream-glib/as-app-validate.c b/libappstream-glib/as-app-validate.c
index 8fc95d2..70c4920 100644
--- a/libappstream-glib/as-app-validate.c
+++ b/libappstream-glib/as-app-validate.c
@@ -1135,7 +1135,7 @@ as_app_validate_check_id (AsAppValidateHelper *helper, const gchar *id)
* Since: 0.1.4
**/
GPtrArray *
-as_app_validate (AsApp *app, AsAppValidateFlags flags, GError **error)
+as_app_validate (AsApp *app, guint32 flags, GError **error)
{
AsAppProblems problems;
AsFormat *format;
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c
index 637a362..bdf4d24 100644
--- a/libappstream-glib/as-app.c
+++ b/libappstream-glib/as-app.c
@@ -96,9 +96,9 @@ typedef struct
AsAppScope scope;
AsAppMergeKind merge_kind;
AsAppState state;
- AsAppTrustFlags trust_flags;
+ guint32 trust_flags;
AsAppQuirk quirk;
- AsAppSearchMatch search_match;
+ guint16 search_match;
AsRefString *icon_path;
AsRefString *id_filename;
AsRefString *id;
@@ -1768,7 +1768,7 @@ as_app_get_state (AsApp *app)
*
* Since: 0.2.2
**/
-AsAppTrustFlags
+guint32
as_app_get_trust_flags (AsApp *app)
{
AsAppPrivate *priv = GET_PRIVATE (app);
@@ -2322,7 +2322,7 @@ as_app_set_state (AsApp *app, AsAppState state)
* Since: 0.2.2
**/
void
-as_app_set_trust_flags (AsApp *app, AsAppTrustFlags trust_flags)
+as_app_set_trust_flags (AsApp *app, guint32 trust_flags)
{
AsAppPrivate *priv = GET_PRIVATE (app);
priv->trust_flags = trust_flags;
@@ -3810,7 +3810,7 @@ as_app_add_addon (AsApp *app, AsApp *addon)
static void
-as_app_subsume_dict (GHashTable *dest, GHashTable *src, AsAppSubsumeFlags flags)
+as_app_subsume_dict (GHashTable *dest, GHashTable *src, guint64 flags)
{
GList *l;
const gchar *tmp;
@@ -3892,7 +3892,7 @@ as_app_subsume_icon (AsApp *app, AsIcon *icon)
}
static void
-as_app_subsume_private (AsApp *app, AsApp *donor, AsAppSubsumeFlags flags)
+as_app_subsume_private (AsApp *app, AsApp *donor, guint64 flags)
{
AsAppPrivate *priv = GET_PRIVATE (donor);
AsAppPrivate *papp = GET_PRIVATE (app);
@@ -4215,14 +4215,14 @@ as_app_subsume_private (AsApp *app, AsApp *donor, AsAppSubsumeFlags flags)
* as_app_subsume_full:
* @app: a #AsApp instance.
* @donor: the donor.
- * @flags: any optional flags, e.g. %AS_APP_SUBSUME_FLAG_NO_OVERWRITE
+ * @flags: any optional #AsAppSubsumeFlags, e.g. %AS_APP_SUBSUME_FLAG_NO_OVERWRITE
*
* Copies information from the donor to the application object.
*
* Since: 0.1.4
**/
void
-as_app_subsume_full (AsApp *app, AsApp *donor, AsAppSubsumeFlags flags)
+as_app_subsume_full (AsApp *app, AsApp *donor, guint64 flags)
{
g_assert (app != donor);
@@ -4703,7 +4703,7 @@ as_app_node_insert (AsApp *app, GNode *parent, AsNodeContext *ctx)
}
static gboolean
-as_app_node_parse_child (AsApp *app, GNode *n, AsAppParseFlags flags,
+as_app_node_parse_child (AsApp *app, GNode *n, guint32 flags,
AsNodeContext *ctx, GError **error)
{
AsAppPrivate *priv = GET_PRIVATE (app);
@@ -5236,7 +5236,7 @@ as_app_check_for_hidpi_icons (AsApp *app)
}
static gboolean
-as_app_node_parse_full (AsApp *app, GNode *node, AsAppParseFlags flags,
+as_app_node_parse_full (AsApp *app, GNode *node, guint32 flags,
AsNodeContext *ctx, GError **error)
{
AsAppPrivate *priv = GET_PRIVATE (app);
@@ -5656,7 +5656,7 @@ as_app_value_tokenize (const gchar *value)
static void
as_app_add_token_internal (AsApp *app,
const gchar *value,
- AsAppSearchMatch match_flag)
+ guint16 match_flag)
{
AsAppPrivate *priv = GET_PRIVATE (app);
AsAppTokenType *match_pval;
@@ -5696,7 +5696,7 @@ static void
as_app_add_token (AsApp *app,
const gchar *value,
gboolean allow_split,
- AsAppSearchMatch match_flag)
+ guint16 match_flag)
{
/* add extra tokens for names like x-plane or half-life */
if (allow_split && g_strstr_len (value, -1, "-") != NULL) {
@@ -5727,7 +5727,7 @@ as_app_add_tokens (AsApp *app,
const gchar *value,
const gchar *locale,
gboolean allow_split,
- AsAppSearchMatch match_flag)
+ guint16 match_flag)
{
guint i;
g_auto(GStrv) values_utf8 = NULL;
@@ -5862,7 +5862,7 @@ as_app_search_matches (AsApp *app, const gchar *search)
AsAppPrivate *priv = GET_PRIVATE (app);
AsAppTokenType *match_pval;
GList *l;
- AsAppSearchMatch result = 0;
+ guint16 result = 0;
g_autoptr(GList) keys = NULL;
g_autoptr(AsRefString) search_stem = NULL;
@@ -6061,7 +6061,7 @@ as_app_parse_appdata_guess_project_group (AsApp *app)
* Since: 0.7.5
**/
gboolean
-as_app_parse_data (AsApp *app, GBytes *data, AsAppParseFlags flags, GError **error)
+as_app_parse_data (AsApp *app, GBytes *data, guint32 flags, GError **error)
{
AsAppPrivate *priv = GET_PRIVATE (app);
AsNodeFromXmlFlags from_xml_flags = AS_NODE_FROM_XML_FLAG_NONE;
@@ -6138,7 +6138,7 @@ as_app_parse_data (AsApp *app, GBytes *data, AsAppParseFlags flags, GError **err
static gboolean
as_app_parse_appdata_file (AsApp *app,
const gchar *filename,
- AsAppParseFlags flags,
+ guint32 flags,
GError **error)
{
gsize len;
@@ -6183,10 +6183,7 @@ as_app_parse_appdata_file (AsApp *app,
* Since: 0.1.2
**/
gboolean
-as_app_parse_file (AsApp *app,
- const gchar *filename,
- AsAppParseFlags flags,
- GError **error)
+as_app_parse_file (AsApp *app, const gchar *filename, guint32 flags, GError **error)
{
GPtrArray *vetos;
g_autoptr(AsFormat) format = as_format_new ();
@@ -6514,7 +6511,7 @@ as_app_set_search_blacklist (AsApp *app, GHashTable *search_blacklist)
* Since: 0.6.13
**/
void
-as_app_set_search_match (AsApp *app, AsAppSearchMatch search_match)
+as_app_set_search_match (AsApp *app, guint16 search_match)
{
AsAppPrivate *priv = GET_PRIVATE (app);
priv->search_match = search_match;
@@ -6531,7 +6528,7 @@ as_app_set_search_match (AsApp *app, AsAppSearchMatch search_match)
*
* Since: 0.6.13
**/
-AsAppSearchMatch
+guint16
as_app_get_search_match (AsApp *app)
{
AsAppPrivate *priv = GET_PRIVATE (app);
diff --git a/libappstream-glib/as-app.h b/libappstream-glib/as-app.h
index 4d374c0..3b4f1e0 100644
--- a/libappstream-glib/as-app.h
+++ b/libappstream-glib/as-app.h
@@ -482,8 +482,8 @@ AsAppKind as_app_get_kind (AsApp *app);
AsAppScope as_app_get_scope (AsApp *app);
AsAppMergeKind as_app_get_merge_kind (AsApp *app);
AsAppState as_app_get_state (AsApp *app);
-AsAppTrustFlags as_app_get_trust_flags (AsApp *app);
-AsAppSearchMatch as_app_get_search_match (AsApp *app);
+guint32 as_app_get_trust_flags (AsApp *app);
+guint16 as_app_get_search_match (AsApp *app);
GList *as_app_get_languages (AsApp *app);
GPtrArray *as_app_get_addons (AsApp *app);
GPtrArray *as_app_get_categories (AsApp *app);
@@ -576,9 +576,9 @@ void as_app_set_merge_kind (AsApp *app,
void as_app_set_state (AsApp *app,
AsAppState state);
void as_app_set_trust_flags (AsApp *app,
- AsAppTrustFlags trust_flags);
+ guint32 trust_flags);
void as_app_set_search_match (AsApp *app,
- AsAppSearchMatch search_match);
+ guint16 search_match);
void as_app_set_origin (AsApp *app,
const gchar *origin);
void as_app_set_project_group (AsApp *app,
@@ -678,13 +678,13 @@ void as_app_add_quirk (AsApp *app,
/* object methods */
GPtrArray *as_app_validate (AsApp *app,
- AsAppValidateFlags flags,
+ guint32 flags,
GError **error);
void as_app_subsume (AsApp *app,
AsApp *donor);
void as_app_subsume_full (AsApp *app,
AsApp *donor,
- AsAppSubsumeFlags flags);
+ guint64 flags);
void as_app_add_veto (AsApp *app,
const gchar *fmt,
...)
@@ -697,11 +697,11 @@ guint as_app_search_matches (AsApp *app,
const gchar *search);
gboolean as_app_parse_file (AsApp *app,
const gchar *filename,
- AsAppParseFlags flags,
+ guint32 flags,
GError **error);
gboolean as_app_parse_data (AsApp *app,
GBytes *data,
- AsAppParseFlags flags,
+ guint32 flags,
GError **error);
gboolean as_app_to_file (AsApp *app,
GFile *file,
diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
index 8816f5d..8ce7e5e 100644
--- a/libappstream-glib/as-store.c
+++ b/libappstream-glib/as-store.c
@@ -74,10 +74,10 @@ typedef struct
GHashTable *metadata_indexes; /* GHashTable{key} */
GHashTable *appinfo_dirs; /* GHashTable{path:AsStorePathData} */
GHashTable *search_blacklist; /* GHashTable{AsRefString:1} */
- AsStoreAddFlags add_flags;
- AsStoreWatchFlags watch_flags;
- AsStoreProblems problems;
- AsAppSearchMatch search_match;
+ guint32 add_flags;
+ guint32 watch_flags;
+ guint32 problems;
+ guint16 search_match;
guint32 filter;
guint changed_block_refcnt;
gboolean is_pending_changed_signal;
@@ -117,8 +117,8 @@ static gboolean as_store_from_file_internal (AsStore *store,
GFile *file,
AsAppScope scope,
const gchar *arch,
- AsStoreLoadFlags load_flags,
- AsStoreWatchFlags watch_flags,
+ guint32 load_flags,
+ guint32 watch_flags,
GCancellable *cancellable,
GError **error);
@@ -604,7 +604,7 @@ as_store_get_app_by_app (AsStore *store, AsApp *app)
AsApp *
as_store_get_app_by_unique_id (AsStore *store,
const gchar *unique_id,
- AsStoreSearchFlags search_flags)
+ guint32 search_flags)
{
AsStorePrivate *priv = GET_PRIVATE (store);
g_autoptr(AsApp) app_tmp = NULL;
@@ -1135,7 +1135,7 @@ as_store_add_app (AsStore *store, AsApp *app)
/* this is a special merge component */
if (as_app_has_quirk (app, AS_APP_QUIRK_MATCH_ANY_PREFIX)) {
- AsAppSubsumeFlags flags = AS_APP_SUBSUME_FLAG_MERGE;
+ guint64 flags = AS_APP_SUBSUME_FLAG_MERGE;
AsAppMergeKind merge_kind = as_app_get_merge_kind (app);
apps = g_hash_table_lookup (priv->hash_merge_id, id);
@@ -1176,7 +1176,7 @@ as_store_add_app (AsStore *store, AsApp *app)
for (i = 0; i < apps->len; i++) {
AsApp *app_tmp = g_ptr_array_index (apps, i);
AsAppMergeKind merge_kind = as_app_get_merge_kind (app_tmp);
- AsAppSubsumeFlags flags = AS_APP_SUBSUME_FLAG_MERGE;
+ guint64 flags = AS_APP_SUBSUME_FLAG_MERGE;
g_debug ("using %s merge component %s on %s",
as_app_merge_kind_to_string (merge_kind),
as_app_get_unique_id (app_tmp),
@@ -1435,7 +1435,7 @@ as_store_from_root (AsStore *store,
const gchar *icon_prefix,
const gchar *source_filename,
const gchar *arch,
- AsStoreLoadFlags load_flags,
+ guint32 load_flags,
GError **error)
{
AsStorePrivate *priv = GET_PRIVATE (store);
@@ -1936,13 +1936,13 @@ as_store_from_file_internal (AsStore *store,
GFile *file,
AsAppScope scope,
const gchar *arch,
- AsStoreLoadFlags load_flags,
- AsStoreWatchFlags watch_flags,
+ guint32 load_flags,
+ guint32 watch_flags,
GCancellable *cancellable,
GError **error)
{
AsStorePrivate *priv = GET_PRIVATE (store);
- AsNodeFromXmlFlags flags = AS_NODE_FROM_XML_FLAG_LITERAL_TEXT;
+ guint32 flags = AS_NODE_FROM_XML_FLAG_LITERAL_TEXT;
g_autofree gchar *filename = NULL;
g_autofree gchar *icon_prefix = NULL;
g_autoptr(GError) error_local = NULL;
@@ -2118,7 +2118,7 @@ as_store_from_xml (AsStore *store,
GError **error)
{
AsStorePrivate *priv = GET_PRIVATE (store);
- AsNodeFromXmlFlags flags = AS_NODE_FROM_XML_FLAG_LITERAL_TEXT;
+ guint32 flags = AS_NODE_FROM_XML_FLAG_LITERAL_TEXT;
g_autoptr(GError) error_local = NULL;
g_autoptr(AsNode) root = NULL;
@@ -2237,7 +2237,7 @@ as_store_remove_apps_with_veto (AsStore *store)
* Since: 0.1.0
**/
GString *
-as_store_to_xml (AsStore *store, AsNodeToXmlFlags flags)
+as_store_to_xml (AsStore *store, guint32 flags)
{
AsApp *app;
AsStorePrivate *priv = GET_PRIVATE (store);
@@ -2337,7 +2337,7 @@ as_store_convert_icons (AsStore *store, AsIconKind kind, GError **error)
gboolean
as_store_to_file (AsStore *store,
GFile *file,
- AsNodeToXmlFlags flags,
+ guint32 flags,
GCancellable *cancellable,
GError **error)
{
@@ -2559,7 +2559,7 @@ as_store_set_api_version (AsStore *store, gdouble api_version)
*
* Since: 0.2.2
**/
-AsStoreAddFlags
+guint32
as_store_get_add_flags (AsStore *store)
{
AsStorePrivate *priv = GET_PRIVATE (store);
@@ -2579,7 +2579,7 @@ as_store_get_add_flags (AsStore *store)
* Since: 0.2.2
**/
void
-as_store_set_add_flags (AsStore *store, AsStoreAddFlags add_flags)
+as_store_set_add_flags (AsStore *store, guint32 add_flags)
{
AsStorePrivate *priv = GET_PRIVATE (store);
priv->add_flags = add_flags;
@@ -2595,7 +2595,7 @@ as_store_set_add_flags (AsStore *store, AsStoreAddFlags add_flags)
*
* Since: 0.4.2
**/
-AsStoreWatchFlags
+guint32
as_store_get_watch_flags (AsStore *store)
{
AsStorePrivate *priv = GET_PRIVATE (store);
@@ -2612,7 +2612,7 @@ as_store_get_watch_flags (AsStore *store)
* Since: 0.4.2
**/
void
-as_store_set_watch_flags (AsStore *store, AsStoreWatchFlags watch_flags)
+as_store_set_watch_flags (AsStore *store, guint32 watch_flags)
{
AsStorePrivate *priv = GET_PRIVATE (store);
priv->watch_flags = watch_flags;
@@ -2654,7 +2654,7 @@ as_store_load_app_info_file (AsStore *store,
AsAppScope scope,
const gchar *path_xml,
const gchar *arch,
- AsStoreLoadFlags flags,
+ guint32 flags,
GCancellable *cancellable,
GError **error)
{
@@ -2688,7 +2688,7 @@ as_store_load_app_info (AsStore *store,
AsAppScope scope,
const gchar *path,
const gchar *arch,
- AsStoreLoadFlags flags,
+ guint32 flags,
GCancellable *cancellable,
GError **error)
{
@@ -2787,13 +2787,13 @@ as_store_load_installed_file_is_valid (const gchar *filename)
static gboolean
as_store_load_installed (AsStore *store,
- AsStoreLoadFlags flags,
+ guint32 flags,
AsAppScope scope,
const gchar *path,
GCancellable *cancellable,
GError **error)
{
- AsAppParseFlags parse_flags = AS_APP_PARSE_FLAG_USE_HEURISTICS;
+ guint32 parse_flags = AS_APP_PARSE_FLAG_USE_HEURISTICS;
AsStorePrivate *priv = GET_PRIVATE (store);
GError *error_local = NULL;
const gchar *tmp;
@@ -2922,7 +2922,7 @@ as_store_load_path (AsStore *store, const gchar *path,
static gboolean
as_store_search_installed (AsStore *store,
- AsStoreLoadFlags flags,
+ guint32 flags,
AsAppScope scope,
const gchar *path,
GCancellable *cancellable,
@@ -2940,7 +2940,7 @@ as_store_search_installed (AsStore *store,
static gboolean
as_store_search_app_info (AsStore *store,
- AsStoreLoadFlags flags,
+ guint32 flags,
AsAppScope scope,
const gchar *path,
GCancellable *cancellable,
@@ -2965,7 +2965,7 @@ as_store_search_app_info (AsStore *store,
static gboolean
as_store_search_per_system (AsStore *store,
- AsStoreLoadFlags flags,
+ guint32 flags,
GCancellable *cancellable,
GError **error)
{
@@ -3055,7 +3055,7 @@ as_store_search_per_system (AsStore *store,
static gboolean
as_store_search_per_user (AsStore *store,
- AsStoreLoadFlags flags,
+ guint32 flags,
GCancellable *cancellable,
GError **error)
{
@@ -3162,10 +3162,7 @@ as_store_load_search_cache (AsStore *store)
* Since: 0.1.2
**/
gboolean
-as_store_load (AsStore *store,
- AsStoreLoadFlags flags,
- GCancellable *cancellable,
- GError **error)
+as_store_load (AsStore *store, guint32 flags, GCancellable *cancellable, GError **error)
{
AsStorePrivate *priv = GET_PRIVATE (store);
g_autoptr(AsProfileTask) ptask = NULL;
@@ -3252,7 +3249,7 @@ as_store_get_unique_name_app_key (AsApp *app)
* Since: 0.2.4
**/
GPtrArray *
-as_store_validate (AsStore *store, AsAppValidateFlags flags, GError **error)
+as_store_validate (AsStore *store, guint32 flags, GError **error)
{
AsStorePrivate *priv = GET_PRIVATE (store);
AsApp *app;
@@ -3523,7 +3520,7 @@ as_store_create_search_blacklist (AsStore *store)
* Since: 0.6.5
**/
void
-as_store_set_search_match (AsStore *store, AsAppSearchMatch search_match)
+as_store_set_search_match (AsStore *store, guint16 search_match)
{
AsStorePrivate *priv = GET_PRIVATE (store);
priv->search_match = search_match;
@@ -3540,7 +3537,7 @@ as_store_set_search_match (AsStore *store, AsAppSearchMatch search_match)
*
* Since: 0.6.13
**/
-AsAppSearchMatch
+guint16
as_store_get_search_match (AsStore *store)
{
AsStorePrivate *priv = GET_PRIVATE (store);
diff --git a/libappstream-glib/as-store.h b/libappstream-glib/as-store.h
index e0ed107..dbe41a5 100644
--- a/libappstream-glib/as-store.h
+++ b/libappstream-glib/as-store.h
@@ -177,7 +177,7 @@ gboolean as_store_from_xml (AsStore *store,
const gchar *icon_root,
GError **error);
gboolean as_store_load (AsStore *store,
- AsStoreLoadFlags flags,
+ guint32 flags,
GCancellable *cancellable,
GError **error);
gboolean as_store_load_path (AsStore *store,
@@ -186,8 +186,8 @@ gboolean as_store_load_path (AsStore *store,
GError **error);
void as_store_load_search_cache (AsStore *store);
void as_store_set_search_match (AsStore *store,
- AsAppSearchMatch search_match);
-AsAppSearchMatch as_store_get_search_match (AsStore *store);
+ guint16 search_match);
+guint16 as_store_get_search_match (AsStore *store);
void as_store_remove_all (AsStore *store);
GPtrArray *as_store_get_apps (AsStore *store);
GPtrArray *as_store_get_apps_by_id (AsStore *store,
@@ -201,7 +201,7 @@ AsApp *as_store_get_app_by_id (AsStore *store,
const gchar *id);
AsApp *as_store_get_app_by_unique_id (AsStore *store,
const gchar *unique_id,
- AsStoreSearchFlags search_flags);
+ guint32 search_flags);
AsApp *as_store_get_app_by_id_ignore_prefix
(AsStore *store,
const gchar *id);
@@ -227,10 +227,10 @@ void as_store_remove_app_by_id (AsStore *store,
const gchar *id);
void as_store_remove_apps_with_veto (AsStore *store);
GString *as_store_to_xml (AsStore *store,
- AsNodeToXmlFlags flags);
+ guint32 flags);
gboolean as_store_to_file (AsStore *store,
GFile *file,
- AsNodeToXmlFlags flags,
+ guint32 flags,
GCancellable *cancellable,
GError **error);
gboolean as_store_convert_icons (AsStore *store,
@@ -248,14 +248,14 @@ void as_store_set_destdir (AsStore *store,
gdouble as_store_get_api_version (AsStore *store);
void as_store_set_api_version (AsStore *store,
gdouble api_version);
-AsStoreAddFlags as_store_get_add_flags (AsStore *store);
+guint32 as_store_get_add_flags (AsStore *store);
void as_store_set_add_flags (AsStore *store,
- AsStoreAddFlags add_flags);
-AsStoreWatchFlags as_store_get_watch_flags (AsStore *store);
+ guint32 add_flags);
+guint32 as_store_get_watch_flags (AsStore *store);
void as_store_set_watch_flags (AsStore *store,
- AsStoreWatchFlags watch_flags);
+ guint32 watch_flags);
GPtrArray *as_store_validate (AsStore *store,
- AsAppValidateFlags flags,
+ guint32 flags,
GError **error);
void as_store_add_metadata_index (AsStore *store,
const gchar *key);