summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2015-08-03 12:49:04 +0100
committerRichard Hughes <richard@hughsie.com>2015-08-03 12:49:04 +0100
commit2f715d9c7612473e4f7cbea843e3b3079df8bb3e (patch)
treeb41d1f96dd39d0ab96f9941476dacac3a512c5df
parent6ad012a9fa6f02e7da85fb9bb9155920149b8465 (diff)
downloadappstream-glib-2f715d9c7612473e4f7cbea843e3b3079df8bb3e.tar.gz
Drop the unused _len arguments on many functions
Using the length of -1 for 'unknown' breaks the GIR-generated bindings. This breaks API and ABI and the soname has been updated to reflect this.
-rw-r--r--client/as-util.c88
-rw-r--r--configure.ac8
-rw-r--r--contrib/libappstream-glib.spec.in4
-rw-r--r--libappstream-builder/asb-app.c8
-rw-r--r--libappstream-builder/asb-context.c8
-rw-r--r--libappstream-builder/asb-package-rpm.c2
-rw-r--r--libappstream-builder/asb-task.c12
-rw-r--r--libappstream-builder/plugins/asb-plugin-absorb.c2
-rw-r--r--libappstream-builder/plugins/asb-plugin-appdata.c14
-rw-r--r--libappstream-builder/plugins/asb-plugin-dbus.c2
-rw-r--r--libappstream-builder/plugins/asb-plugin-desktop.c4
-rw-r--r--libappstream-builder/plugins/asb-plugin-firmware.c2
-rw-r--r--libappstream-builder/plugins/asb-plugin-font.c30
-rw-r--r--libappstream-builder/plugins/asb-plugin-gettext.c2
-rw-r--r--libappstream-builder/plugins/asb-plugin-gstreamer.c12
-rw-r--r--libappstream-builder/plugins/asb-plugin-hardcoded.c32
-rw-r--r--libappstream-builder/plugins/asb-plugin-ibus-sql.c14
-rw-r--r--libappstream-builder/plugins/asb-plugin-ibus-xml.c20
-rw-r--r--libappstream-builder/plugins/asb-plugin-ostree.c6
-rw-r--r--libappstream-glib/as-app-desktop.c50
-rw-r--r--libappstream-glib/as-app-inf.c18
-rw-r--r--libappstream-glib/as-app.c295
-rw-r--r--libappstream-glib/as-app.h69
-rw-r--r--libappstream-glib/as-bundle.c7
-rw-r--r--libappstream-glib/as-bundle.h3
-rw-r--r--libappstream-glib/as-checksum.c4
-rw-r--r--libappstream-glib/as-icon.c11
-rw-r--r--libappstream-glib/as-icon.h3
-rw-r--r--libappstream-glib/as-image.c8
-rw-r--r--libappstream-glib/as-image.h3
-rw-r--r--libappstream-glib/as-node.c28
-rw-r--r--libappstream-glib/as-node.h7
-rw-r--r--libappstream-glib/as-provide.c5
-rw-r--r--libappstream-glib/as-provide.h3
-rw-r--r--libappstream-glib/as-release.c32
-rw-r--r--libappstream-glib/as-release.h15
-rw-r--r--libappstream-glib/as-screenshot.c17
-rw-r--r--libappstream-glib/as-screenshot.h3
-rw-r--r--libappstream-glib/as-self-test.c130
-rw-r--r--libappstream-glib/as-store.c14
-rw-r--r--libappstream-glib/as-utils-private.h5
-rw-r--r--libappstream-glib/as-utils.c59
-rw-r--r--libappstream-glib/as-utils.h2
43 files changed, 442 insertions, 619 deletions
diff --git a/client/as-util.c b/client/as-util.c
index 2fb5d56..0deca94 100644
--- a/client/as-util.c
+++ b/client/as-util.c
@@ -240,7 +240,7 @@ as_util_convert_appdata (GFile *file_input,
if (n2 != NULL) {
tmp = as_node_get_attribute (n2, "type");
if (tmp != NULL)
- as_node_add_attribute (n, "type", tmp, -1);
+ as_node_add_attribute (n, "type", tmp);
as_node_remove_attribute (n2, "type");
}
}
@@ -270,22 +270,22 @@ as_util_convert_appdata (GFile *file_input,
/* convert the old license defines */
if (g_strcmp0 (tmp, "CC0") == 0)
- as_node_set_data (n2, "CC0-1.0", -1,
+ as_node_set_data (n2, "CC0-1.0",
AS_NODE_INSERT_FLAG_NONE);
else if (g_strcmp0 (tmp, "CC-BY") == 0)
- as_node_set_data (n2, "CC-BY-3.0", -1,
+ as_node_set_data (n2, "CC-BY-3.0",
AS_NODE_INSERT_FLAG_NONE);
else if (g_strcmp0 (tmp, "CC-BY-SA") == 0)
- as_node_set_data (n2, "CC-BY-SA-3.0", -1,
+ as_node_set_data (n2, "CC-BY-SA-3.0",
AS_NODE_INSERT_FLAG_NONE);
else if (g_strcmp0 (tmp, "GFDL") == 0)
- as_node_set_data (n2, "GFDL-1.3", -1,
+ as_node_set_data (n2, "GFDL-1.3",
AS_NODE_INSERT_FLAG_NONE);
/* ensure in SPDX format */
if (!as_utils_is_spdx_license_id (as_node_get_data (n2))) {
action_required = TRUE;
- as_node_set_comment (n2, "FIXME: convert to an SPDX ID", -1);
+ as_node_set_comment (n2, "FIXME: convert to an SPDX ID");
}
}
@@ -295,12 +295,12 @@ as_util_convert_appdata (GFile *file_input,
action_required = TRUE;
n2 = as_node_insert (n, "project_license", "<!-- Insert SPDX ID Here -->",
AS_NODE_INSERT_FLAG_PRE_ESCAPED, NULL);
- as_node_set_comment (n2, "FIXME: Use https://spdx.org/licenses/", -1);
+ as_node_set_comment (n2, "FIXME: Use https://spdx.org/licenses/");
} else {
/* ensure in SPDX format */
if (!as_utils_is_spdx_license_id (as_node_get_data (n2))) {
action_required = TRUE;
- as_node_set_comment (n2, "FIXME: convert to an SPDX ID", -1);
+ as_node_set_comment (n2, "FIXME: convert to an SPDX ID");
}
}
@@ -319,31 +319,31 @@ as_util_convert_appdata (GFile *file_input,
if (g_strcmp0 (as_node_get_data (n3), "GNOME") == 0) {
n3 = as_node_insert (n, "developer_name", "The GNOME Project",
flags_translate, NULL);
- as_node_set_comment (n3, "FIXME: this is a translatable version of project_group", -1);
+ as_node_set_comment (n3, "FIXME: this is a translatable version of project_group");
} else if (g_strcmp0 (as_node_get_data (n3), "KDE") == 0) {
n3 = as_node_insert (n, "developer_name", "The KDE Community",
AS_NODE_INSERT_FLAG_NONE, NULL);
- as_node_set_comment (n3, "FIXME: this is a translatable version of project_group", -1);
+ as_node_set_comment (n3, "FIXME: this is a translatable version of project_group");
} else if (g_strcmp0 (as_node_get_data (n3), "XFCE") == 0) {
n3 = as_node_insert (n, "developer_name", "Xfce Development Team",
flags_translate, NULL);
- as_node_set_comment (n3, "FIXME: this is a translatable version of project_group", -1);
+ as_node_set_comment (n3, "FIXME: this is a translatable version of project_group");
} else if (g_strcmp0 (as_node_get_data (n3), "MATE") == 0) {
n3 = as_node_insert (n, "developer_name", "The MATE Project",
flags_translate, NULL);
- as_node_set_comment (n3, "FIXME: this is a translatable version of project_group", -1);
+ as_node_set_comment (n3, "FIXME: this is a translatable version of project_group");
} else {
action_required = TRUE;
n3 = as_node_insert (n, "developer_name", "<!-- Company Name -->",
AS_NODE_INSERT_FLAG_PRE_ESCAPED, NULL);
- as_node_set_comment (n3, "FIXME: compulsory_for_desktop was not recognised", -1);
+ as_node_set_comment (n3, "FIXME: compulsory_for_desktop was not recognised");
}
} else {
action_required = TRUE;
n3 = as_node_insert (n, "developer_name", "<!-- Company Name -->",
AS_NODE_INSERT_FLAG_PRE_ESCAPED, NULL);
as_node_set_comment (n3, "FIXME: You can use a project or "
- "developer name if there's no company", -1);
+ "developer name if there's no company");
}
}
@@ -362,7 +362,7 @@ as_util_convert_appdata (GFile *file_input,
AS_NODE_INSERT_FLAG_PRE_ESCAPED,
"type", "homepage", NULL);
}
- as_node_set_comment (n3, "FIXME: homepage for the application", -1);
+ as_node_set_comment (n3, "FIXME: homepage for the application");
}
if (as_node_find_with_attribute (n, "url", "type", "bugtracker") == NULL) {
if (g_strcmp0 (project_group, "GNOME") == 0) {
@@ -383,19 +383,19 @@ as_util_convert_appdata (GFile *file_input,
"type", "bugtracker", NULL);
}
as_node_set_comment (n3, "FIXME: where to report bugs for "
- "the application", -1);
+ "the application");
}
if (as_node_find_with_attribute (n, "url", "type", "donation") == NULL) {
if (g_strcmp0 (project_group, "GNOME") == 0) {
n3 = as_node_insert (n, "url", "http://www.gnome.org/friends/",
AS_NODE_INSERT_FLAG_NONE,
"type", "donation", NULL);
- as_node_set_comment (n3, "GNOME Projects usually have no per-app donation page", -1);
+ as_node_set_comment (n3, "GNOME Projects usually have no per-app donation page");
} else {
n3 = as_node_insert (n, "url", "<!-- http://www.homepage.com/donation.html -->",
AS_NODE_INSERT_FLAG_PRE_ESCAPED,
"type", "donation", NULL);
- as_node_set_comment (n3, "FIXME: where to donate to the application", -1);
+ as_node_set_comment (n3, "FIXME: where to donate to the application");
}
}
if (as_node_find_with_attribute (n, "url", "type", "help") == NULL) {
@@ -404,13 +404,13 @@ as_util_convert_appdata (GFile *file_input,
AS_NODE_INSERT_FLAG_PRE_ESCAPED,
"type", "help", NULL);
as_node_set_comment (n3, "FIXME: where on the internet users "
- "can find help", -1);
+ "can find help");
} else {
n3 = as_node_insert (n, "url", "<!-- http://www.homepage.com/docs/ -->",
AS_NODE_INSERT_FLAG_PRE_ESCAPED,
"type", "help", NULL);
as_node_set_comment (n3, "FIXME: where to report bugs for "
- "the application", -1);
+ "the application");
}
}
@@ -428,7 +428,7 @@ as_util_convert_appdata (GFile *file_input,
action_required = TRUE;
n3 = as_node_insert (n, "update_contact", "<!-- upstream-contact_at_email.com -->",
AS_NODE_INSERT_FLAG_PRE_ESCAPED, NULL);
- as_node_set_comment (n3, "FIXME: this is optional, but recommended", -1);
+ as_node_set_comment (n3, "FIXME: this is optional, but recommended");
}
/* convert from <screenshot>url</screenshot> to:
@@ -446,8 +446,8 @@ as_util_convert_appdata (GFile *file_input,
continue;
n3 = as_node_insert (n2, "image", tmp,
AS_NODE_INSERT_FLAG_NONE, NULL);
- as_node_set_data (n3, tmp, -1, AS_NODE_INSERT_FLAG_NONE);
- as_node_set_data (n2, NULL, -1, AS_NODE_INSERT_FLAG_NONE);
+ as_node_set_data (n3, tmp, AS_NODE_INSERT_FLAG_NONE);
+ as_node_set_data (n2, NULL, AS_NODE_INSERT_FLAG_NONE);
action_required = TRUE;
as_node_insert (n2, "caption", "<!-- Describe this "
"screenshot in less than ~10 words -->",
@@ -682,7 +682,7 @@ as_util_appdata_to_news (AsUtilPrivate *priv, gchar **values, GError **error)
tmp = as_release_get_description (rel, NULL);
if (tmp != NULL) {
_cleanup_free_ gchar *md = NULL;
- md = as_markup_convert (tmp, -1,
+ md = as_markup_convert (tmp,
AS_MARKUP_CONVERT_FORMAT_MARKDOWN,
error);
if (md == NULL)
@@ -1119,16 +1119,16 @@ as_util_appdata_from_desktop (AsUtilPrivate *priv, gchar **values, GError **erro
/* set some initial values */
as_app_set_description (app, NULL,
"\n <p>\n This should be long prose.\n </p>\n"
- " <p>\n This should a second paragraph.\n </p>\n", -1);
- as_app_set_developer_name (app, NULL, "XXX: Insert Company or Developer Name", -1);
- as_app_set_project_group (app, "XXX: Values valid are none, GNOME, KDE or XFCE", -1);
+ " <p>\n This should a second paragraph.\n </p>\n");
+ as_app_set_developer_name (app, NULL, "XXX: Insert Company or Developer Name");
+ as_app_set_project_group (app, "XXX: Values valid are none, GNOME, KDE or XFCE");
/* fix the ID */
id_new = g_strdup (as_app_get_id (app));
instr = g_strstr_len (id_new, -1, ".desktop.in");
if (instr != NULL) {
instr[8] = '\0';
- as_app_set_id (app, id_new, -1);
+ as_app_set_id (app, id_new);
}
/* set things that don't belong in the AppData file */
@@ -1139,24 +1139,24 @@ as_util_appdata_from_desktop (AsUtilPrivate *priv, gchar **values, GError **erro
/* add urls */
as_app_add_url (app, AS_URL_KIND_HOMEPAGE,
- "XXX: http://www.homepage.com/", -1);
+ "XXX: http://www.homepage.com/");
as_app_add_url (app, AS_URL_KIND_BUGTRACKER,
- "XXX: http://www.homepage.com/where-to-report_bug.html", -1);
+ "XXX: http://www.homepage.com/where-to-report_bug.html");
as_app_add_url (app, AS_URL_KIND_FAQ,
- "XXX: http://www.homepage.com/faq.html", -1);
+ "XXX: http://www.homepage.com/faq.html");
as_app_add_url (app, AS_URL_KIND_DONATION,
- "XXX: http://www.homepage.com/donation.html", -1);
+ "XXX: http://www.homepage.com/donation.html");
as_app_add_url (app, AS_URL_KIND_HELP,
- "XXX: http://www.homepage.com/docs/", -1);
- as_app_set_project_license (app, "XXX: Insert SPDX value here", -1);
- as_app_set_metadata_license (app, "XXX: Insert SPDX value here", -1);
+ "XXX: http://www.homepage.com/docs/");
+ as_app_set_project_license (app, "XXX: Insert SPDX value here");
+ as_app_set_metadata_license (app, "XXX: Insert SPDX value here");
/* add first screenshot */
ss1 = as_screenshot_new ();
as_screenshot_set_kind (ss1, AS_SCREENSHOT_KIND_DEFAULT);
- as_screenshot_set_caption (ss1, NULL, "XXX: Describe the default screenshot", -1);
+ as_screenshot_set_caption (ss1, NULL, "XXX: Describe the default screenshot");
im1 = as_image_new ();
- as_image_set_url (im1, "XXX: http://www.my-screenshot-default.png", -1);
+ as_image_set_url (im1, "XXX: http://www.my-screenshot-default.png");
as_image_set_width (im1, 1120);
as_image_set_height (im1, 630);
as_screenshot_add_image (ss1, im1);
@@ -1165,9 +1165,9 @@ as_util_appdata_from_desktop (AsUtilPrivate *priv, gchar **values, GError **erro
/* add second screenshot */
ss2 = as_screenshot_new ();
as_screenshot_set_kind (ss2, AS_SCREENSHOT_KIND_NORMAL);
- as_screenshot_set_caption (ss2, NULL, "XXX: Describe another screenshot", -1);
+ as_screenshot_set_caption (ss2, NULL, "XXX: Describe another screenshot");
im2 = as_image_new ();
- as_image_set_url (im2, "XXX: http://www.my-screenshot.png", -1);
+ as_image_set_url (im2, "XXX: http://www.my-screenshot.png");
as_image_set_width (im2, 1120);
as_image_set_height (im2, 630);
as_screenshot_add_image (ss2, im2);
@@ -2945,7 +2945,7 @@ as_util_mirror_screenshots_thumb (AsScreenshot *ss, AsImage *im_src,
size_str,
as_image_get_basename (im_src),
NULL);
- as_image_set_url (im_tmp, url_tmp, -1);
+ as_image_set_url (im_tmp, url_tmp);
as_image_set_kind (im_tmp, AS_IMAGE_KIND_THUMBNAIL);
as_image_set_basename (im_tmp, as_image_get_basename (im_src));
as_screenshot_add_image (ss, im_tmp);
@@ -3079,7 +3079,7 @@ as_util_mirror_screenshots_app_url (AsUtilPrivate *priv,
basename = g_path_get_basename (url);
url_new = g_build_filename (mirror_uri, "source", basename, NULL);
im = as_image_new ();
- as_image_set_url (im, url_new, -1);
+ as_image_set_url (im, url_new);
as_image_set_kind (im, AS_IMAGE_KIND_SOURCE);
ss = as_screenshot_new ();
as_screenshot_set_kind (ss, AS_SCREENSHOT_KIND_DEFAULT);
@@ -3144,7 +3144,7 @@ as_util_mirror_screenshots_app_url (AsUtilPrivate *priv,
as_screenshot_set_kind (ss, is_default ? AS_SCREENSHOT_KIND_DEFAULT :
AS_SCREENSHOT_KIND_NORMAL);
im = as_image_new ();
- as_image_set_url (im, url, -1);
+ as_image_set_url (im, url);
as_image_set_kind (im, AS_IMAGE_KIND_SOURCE);
as_screenshot_add_image (ss, im);
as_app_add_screenshot (app, ss);
@@ -3387,7 +3387,7 @@ as_util_mirror_local_firmware (AsUtilPrivate *priv, gchar **values, GError **err
}
loc = g_build_filename (values[1], fn, NULL);
g_ptr_array_set_size (as_release_get_locations (rel), 0);
- as_release_add_location (rel, loc, -1);
+ as_release_add_location (rel, loc);
}
}
@@ -3436,7 +3436,7 @@ as_util_replace_screenshots (AsUtilPrivate *priv, gchar **values, GError **error
_cleanup_object_unref_ AsImage *im = NULL;
_cleanup_object_unref_ AsScreenshot *ss = NULL;
im = as_image_new ();
- as_image_set_url (im, values[i], -1);
+ as_image_set_url (im, values[i]);
as_image_set_kind (im, AS_IMAGE_KIND_SOURCE);
ss = as_screenshot_new ();
as_screenshot_add_image (ss, im);
diff --git a/configure.ac b/configure.ac
index c363c6a..1e06113 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
AC_PREREQ(2.63)
m4_define([as_major_version], [0])
-m4_define([as_minor_version], [4])
-m4_define([as_micro_version], [2])
+m4_define([as_minor_version], [5])
+m4_define([as_micro_version], [0])
m4_define([as_version],
[as_major_version.as_minor_version.as_micro_version])
@@ -50,8 +50,8 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
# - If the interface is the same as the previous version, but bugs are
# fixed, change:
# REVISION += 1
-LT_CURRENT=7
-LT_REVISION=5
+LT_CURRENT=8
+LT_REVISION=0
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
diff --git a/contrib/libappstream-glib.spec.in b/contrib/libappstream-glib.spec.in
index 7247f6f..f420bbd 100644
--- a/contrib/libappstream-glib.spec.in
+++ b/contrib/libappstream-glib.spec.in
@@ -98,7 +98,7 @@ make install DESTDIR=$RPM_BUILD_ROOT
%files -f appstream-glib.lang
%doc README.md AUTHORS NEWS COPYING
-%{_libdir}/libappstream-glib.so.7*
+%{_libdir}/libappstream-glib.so.8*
%{_libdir}/girepository-1.0/*.typelib
%{_bindir}/appstream-util
%{_bindir}/appdata-validate
@@ -121,7 +121,7 @@ make install DESTDIR=$RPM_BUILD_ROOT
%{_bindir}/appstream-builder
%{_datadir}/bash-completion/completions/appstream-builder
%{_libdir}/asb-plugins-%{as_plugin_version}/*.so
-%{_libdir}/libappstream-builder.so.7*
+%{_libdir}/libappstream-builder.so.8*
%{_mandir}/man1/appstream-builder.1.gz
%files builder-devel
diff --git a/libappstream-builder/asb-app.c b/libappstream-builder/asb-app.c
index 8cc33de..0e93183 100644
--- a/libappstream-builder/asb-app.c
+++ b/libappstream-builder/asb-app.c
@@ -331,7 +331,7 @@ asb_app_add_screenshot_source (AsbApp *app, const gchar *filename, GError **erro
/* fonts only have full sized screenshots */
url_src = g_build_filename ("file://", basename, NULL);
- as_image_set_url (im_src, url_src, -1);
+ as_image_set_url (im_src, url_src);
as_image_set_kind (im_src, AS_IMAGE_KIND_SOURCE);
as_screenshot_add_image (ss, im_src);
as_app_add_screenshot (AS_APP (app), ss);
@@ -362,13 +362,13 @@ asb_app_new (AsbPackage *pkg, const gchar *id)
switch (asb_package_get_kind (pkg)) {
case ASB_PACKAGE_KIND_DEFAULT:
as_app_add_pkgname (AS_APP (app),
- asb_package_get_name (pkg), -1);
+ asb_package_get_name (pkg));
break;
case ASB_PACKAGE_KIND_BUNDLE:
{
_cleanup_object_unref_ AsBundle *bundle = NULL;
bundle = as_bundle_new ();
- as_bundle_set_id (bundle, asb_package_get_source (pkg), -1);
+ as_bundle_set_id (bundle, asb_package_get_source (pkg));
as_bundle_set_kind (bundle, AS_BUNDLE_KIND_XDG_APP);
as_app_add_bundle (AS_APP (app), bundle);
};
@@ -377,6 +377,6 @@ asb_app_new (AsbPackage *pkg, const gchar *id)
}
}
if (id != NULL)
- as_app_set_id (AS_APP (app), id, -1);
+ as_app_set_id (AS_APP (app), id);
return ASB_APP (app);
}
diff --git a/libappstream-builder/asb-context.c b/libappstream-builder/asb-context.c
index a986486..faf67ee 100644
--- a/libappstream-builder/asb-context.c
+++ b/libappstream-builder/asb-context.c
@@ -1446,16 +1446,16 @@ asb_context_add_app_ignore (AsbContext *ctx, AsbPackage *pkg)
app_tmp = as_store_get_app_by_id (priv->store_ignore, name_arch);
if (app_tmp != NULL) {
as_app_add_metadata (AS_APP (app_tmp), "X-CacheID",
- asb_package_get_basename (pkg), -1);
+ asb_package_get_basename (pkg));
return;
}
/* never encountered before, so add */
app = as_app_new ();
- as_app_set_id (app, name_arch, -1);
- as_app_add_pkgname (app, asb_package_get_name (pkg), -1);
+ as_app_set_id (app, name_arch);
+ as_app_add_pkgname (app, asb_package_get_name (pkg));
as_app_add_metadata (app, "X-CacheID",
- asb_package_get_basename (pkg), -1);
+ asb_package_get_basename (pkg));
as_store_add_app (priv->store_ignore, app);
}
diff --git a/libappstream-builder/asb-package-rpm.c b/libappstream-builder/asb-package-rpm.c
index bd34f83..911a756 100644
--- a/libappstream-builder/asb-package-rpm.c
+++ b/libappstream-builder/asb-package-rpm.c
@@ -370,7 +370,7 @@ asb_package_rpm_add_release (AsbPackage *pkg,
as_release_set_timestamp (release, timestamp);
} else {
release = as_release_new ();
- as_release_set_version (release, version, -1);
+ as_release_set_version (release, version);
as_release_set_timestamp (release, timestamp);
asb_package_add_release (pkg, version, release);
g_object_unref (release);
diff --git a/libappstream-builder/asb-task.c b/libappstream-builder/asb-task.c
index 158cf76..a29d09d 100644
--- a/libappstream-builder/asb-task.c
+++ b/libappstream-builder/asb-task.c
@@ -367,20 +367,18 @@ asb_task_process (AsbTask *task, GError **error_not_used)
if (asb_package_get_url (priv->pkg) != NULL) {
as_app_add_url (AS_APP (app),
AS_URL_KIND_HOMEPAGE,
- asb_package_get_url (priv->pkg), -1);
+ asb_package_get_url (priv->pkg));
}
if (asb_package_get_license (priv->pkg) != NULL) {
as_app_set_project_license (AS_APP (app),
- asb_package_get_license (priv->pkg),
- -1);
+ asb_package_get_license (priv->pkg));
}
/* add the source name so we can suggest these together */
if (g_strcmp0 (asb_package_get_source_pkgname (priv->pkg),
asb_package_get_name (priv->pkg)) != 0) {
as_app_set_source_pkgname (AS_APP (app),
- asb_package_get_source_pkgname (priv->pkg),
- -1);
+ asb_package_get_source_pkgname (priv->pkg));
}
/* set all the releases on the app */
@@ -422,7 +420,7 @@ asb_task_process (AsbTask *task, GError **error_not_used)
cache_id = asb_utils_get_cache_id_for_filename (priv->filename);
as_app_add_metadata (AS_APP (app),
"X-CacheID",
- cache_id, -1);
+ cache_id);
g_free (cache_id);
}
@@ -430,7 +428,7 @@ asb_task_process (AsbTask *task, GError **error_not_used)
if (asb_package_get_vcs (priv->pkg) != NULL) {
as_app_add_metadata (AS_APP (app),
"VersionControlSystem",
- asb_package_get_vcs (priv->pkg), -1);
+ asb_package_get_vcs (priv->pkg));
}
/* save any screenshots early */
diff --git a/libappstream-builder/plugins/asb-plugin-absorb.c b/libappstream-builder/plugins/asb-plugin-absorb.c
index d47a848..644cdd0 100644
--- a/libappstream-builder/plugins/asb-plugin-absorb.c
+++ b/libappstream-builder/plugins/asb-plugin-absorb.c
@@ -56,7 +56,7 @@ asb_plugin_absorb_parent_for_pkgname (GList *list, AsApp *parent, const gchar *p
as_app_get_pkgname_default (app));
as_app_add_metadata (app,
"X-Merge-With-Parent",
- as_app_get_id (parent), -1);
+ as_app_get_id (parent));
}
}
diff --git a/libappstream-builder/plugins/asb-plugin-appdata.c b/libappstream-builder/plugins/asb-plugin-appdata.c
index 0f084fe..cfe57b9 100644
--- a/libappstream-builder/plugins/asb-plugin-appdata.c
+++ b/libappstream-builder/plugins/asb-plugin-appdata.c
@@ -148,7 +148,7 @@ asb_plugin_process_filename (AsbPlugin *plugin,
/* other optional data */
tmp = as_app_get_url_item (appdata, AS_URL_KIND_HOMEPAGE);
if (tmp != NULL)
- as_app_add_url (AS_APP (app), AS_URL_KIND_HOMEPAGE, tmp, -1);
+ as_app_add_url (AS_APP (app), AS_URL_KIND_HOMEPAGE, tmp);
tmp = as_app_get_project_group (appdata);
if (tmp != NULL) {
/* check the category is valid */
@@ -158,13 +158,13 @@ asb_plugin_process_filename (AsbPlugin *plugin,
"AppData project group invalid, "
"so ignoring: %s", tmp);
} else {
- as_app_set_project_group (AS_APP (app), tmp, -1);
+ as_app_set_project_group (AS_APP (app), tmp);
}
}
array = as_app_get_compulsory_for_desktops (appdata);
if (array->len > 0) {
tmp = g_ptr_array_index (array, 0);
- as_app_add_compulsory_for_desktop (AS_APP (app), tmp, -1);
+ as_app_add_compulsory_for_desktop (AS_APP (app), tmp);
}
/* perhaps get name */
@@ -178,7 +178,7 @@ asb_plugin_process_filename (AsbPlugin *plugin,
asb_plugin_appdata_log_overwrite (app, "name",
old, tmp);
}
- as_app_set_name (AS_APP (app), key, tmp, -1);
+ as_app_set_name (AS_APP (app), key, tmp);
}
if (g_list_length (list) == 1) {
asb_package_log (asb_app_get_package (app),
@@ -198,7 +198,7 @@ asb_plugin_process_filename (AsbPlugin *plugin,
asb_plugin_appdata_log_overwrite (app, "summary",
old, tmp);
}
- as_app_set_comment (AS_APP (app), key, tmp, -1);
+ as_app_set_comment (AS_APP (app), key, tmp);
}
if (g_list_length (list) == 1) {
asb_package_log (asb_app_get_package (app),
@@ -213,7 +213,7 @@ asb_plugin_process_filename (AsbPlugin *plugin,
for (l = list; l != NULL; l = l->next) {
key = l->data;
tmp = g_hash_table_lookup (hash, key);
- as_app_set_description (AS_APP (app), key, tmp, -1);
+ as_app_set_description (AS_APP (app), key, tmp);
}
if (g_list_length (list) == 1) {
asb_package_log (asb_app_get_package (app),
@@ -249,7 +249,7 @@ asb_plugin_process_filename (AsbPlugin *plugin,
tmp = g_hash_table_lookup (hash, key);
old = as_app_get_metadata_item (AS_APP (app), key);
asb_plugin_appdata_log_overwrite (app, "metadata", old, tmp);
- as_app_add_metadata (AS_APP (app), key, tmp, -1);
+ as_app_add_metadata (AS_APP (app), key, tmp);
}
/* add releases */
diff --git a/libappstream-builder/plugins/asb-plugin-dbus.c b/libappstream-builder/plugins/asb-plugin-dbus.c
index 5d49cee..6519f93 100644
--- a/libappstream-builder/plugins/asb-plugin-dbus.c
+++ b/libappstream-builder/plugins/asb-plugin-dbus.c
@@ -93,7 +93,7 @@ asb_plugin_process_dbus (AsbApp *app,
provide = as_provide_new ();
as_provide_set_kind (provide, is_system ? AS_PROVIDE_KIND_DBUS_SYSTEM :
AS_PROVIDE_KIND_DBUS);
- as_provide_set_value (provide, name, -1);
+ as_provide_set_value (provide, name);
as_app_add_provide (AS_APP (app), provide);
return TRUE;
}
diff --git a/libappstream-builder/plugins/asb-plugin-desktop.c b/libappstream-builder/plugins/asb-plugin-desktop.c
index 16d294c..2be20de 100644
--- a/libappstream-builder/plugins/asb-plugin-desktop.c
+++ b/libappstream-builder/plugins/asb-plugin-desktop.c
@@ -260,7 +260,7 @@ asb_plugin_desktop_add_icons (AsbPlugin *plugin,
}
icon = as_icon_new ();
as_icon_set_pixbuf (icon, pixbuf);
- as_icon_set_name (icon, name, -1);
+ as_icon_set_name (icon, name);
as_icon_set_kind (icon, AS_ICON_KIND_CACHED);
as_icon_set_prefix (icon, as_app_get_icon_path (AS_APP (app)));
as_app_add_icon (AS_APP (app), icon);
@@ -293,7 +293,7 @@ asb_plugin_desktop_add_icons (AsbPlugin *plugin,
as_app_get_id_filename (AS_APP (app)));
icon_hidpi = as_icon_new ();
as_icon_set_pixbuf (icon_hidpi, pixbuf_hidpi);
- as_icon_set_name (icon_hidpi, name_hidpi, -1);
+ as_icon_set_name (icon_hidpi, name_hidpi);
as_icon_set_kind (icon_hidpi, AS_ICON_KIND_CACHED);
as_icon_set_prefix (icon_hidpi, as_app_get_icon_path (AS_APP (app)));
as_app_add_icon (AS_APP (app), icon_hidpi);
diff --git a/libappstream-builder/plugins/asb-plugin-firmware.c b/libappstream-builder/plugins/asb-plugin-firmware.c
index abac939..b5d7a29 100644
--- a/libappstream-builder/plugins/asb-plugin-firmware.c
+++ b/libappstream-builder/plugins/asb-plugin-firmware.c
@@ -149,7 +149,7 @@ asb_plugin_process_filename (AsbPlugin *plugin,
/* for the adddata plugin; removed in asb_plugin_merge() */
metainfo_fn = asb_plugin_firmware_get_metainfo_fn (filename);
if (metainfo_fn != NULL)
- as_app_add_metadata (AS_APP (app), "MetainfoBasename", metainfo_fn, -1);
+ as_app_add_metadata (AS_APP (app), "MetainfoBasename", metainfo_fn);
/* set the internal checksum */
fw_basename = as_app_get_metadata_item (AS_APP (app), "FirmwareBasename");
diff --git a/libappstream-builder/plugins/asb-plugin-font.c b/libappstream-builder/plugins/asb-plugin-font.c
index b809739..a8d55c3 100644
--- a/libappstream-builder/plugins/asb-plugin-font.c
+++ b/libappstream-builder/plugins/asb-plugin-font.c
@@ -161,7 +161,7 @@ asb_font_fix_metadata (AsbApp *app)
if (percentage >= 0) {
as_app_add_metadata (AS_APP (app),
"FontSampleText",
- text_sample[j].value, -1);
+ text_sample[j].value);
break;
}
}
@@ -174,7 +174,7 @@ asb_font_fix_metadata (AsbApp *app)
if (percentage >= 0) {
as_app_add_metadata (AS_APP (app),
"FontIconText",
- text_icon[j].value, -1);
+ text_icon[j].value);
break;
}
}
@@ -197,17 +197,17 @@ asb_font_fix_metadata (AsbApp *app)
continue;
as_app_add_metadata (AS_APP (app),
"FontSampleText",
- value, -1);
+ value);
if (g_strcmp0 (value, "The quick brown fox jumps over the lazy dog.") == 0) {
as_app_add_metadata (AS_APP (app),
"FontIconText",
- "Aa", -1);
+ "Aa");
} else {
_cleanup_free_ gchar *icon_tmp = NULL;
icon_tmp = g_utf8_substring (value, 0, 2);
as_app_add_metadata (AS_APP (app),
"FontIconText",
- icon_tmp, -1);
+ icon_tmp);
}
}
}
@@ -284,7 +284,7 @@ asb_font_add_metadata (AsbApp *app, FT_Face ft_face)
if (asb_font_string_is_valid (val)) {
as_app_add_metadata (AS_APP (app),
tt_idx_to_md_name[j].key,
- val, -1);
+ val);
} else {
asb_package_log (asb_app_get_package (app),
ASB_PACKAGE_LOG_LEVEL_WARNING,
@@ -468,7 +468,7 @@ asb_font_add_screenshot (AsbPlugin *plugin, AsbApp *app, FT_Face ft_face,
url_tmp = g_build_filename ("file://",
basename,
NULL);
- as_image_set_url (im, url_tmp, -1);
+ as_image_set_url (im, url_tmp);
/* put this in a special place so it gets packaged up */
temp_dir = asb_context_get_temp_dir (plugin->ctx);
@@ -500,7 +500,7 @@ asb_font_add_screenshot (AsbPlugin *plugin, AsbApp *app, FT_Face ft_face,
as_screenshot_add_image (ss, im);
caption = asb_font_get_caption (app);
if (caption != NULL)
- as_screenshot_set_caption (ss, NULL, caption, -1);
+ as_screenshot_set_caption (ss, NULL, caption);
as_app_add_screenshot (AS_APP (app), ss);
/* find screenshot priority */
@@ -559,7 +559,7 @@ asb_font_add_languages (AsbApp *app, const FcPattern *pattern)
list = FcStrListCreate (langs);
FcStrListFirst (list);
while ((tmp = (const gchar*) FcStrListNext (list)) != NULL) {
- as_app_add_language (AS_APP (app), 0, tmp, -1);
+ as_app_add_language (AS_APP (app), 0, tmp);
any_added = TRUE;
}
FcStrListDone (list);
@@ -569,7 +569,7 @@ asb_font_add_languages (AsbApp *app, const FcPattern *pattern)
/* assume 'en' is available */
if (!any_added)
- as_app_add_language (AS_APP (app), 0, "en", -1);
+ as_app_add_language (AS_APP (app), 0, "en");
}
/**
@@ -605,7 +605,7 @@ asb_plugin_font_set_name (AsbApp *app, const gchar *name)
if (g_str_has_prefix (tmp, prefixes[i]))
ptr += strlen (prefixes[i]);
}
- as_app_set_name (AS_APP (app), "C", ptr, -1);
+ as_app_set_name (AS_APP (app), "C", ptr);
}
/**
@@ -675,15 +675,15 @@ asb_plugin_font_app (AsbPlugin *plugin, AsbApp *app,
}
/* create app that might get merged later */
- as_app_add_category (AS_APP (app), "Addons", -1);
- as_app_add_category (AS_APP (app), "Fonts", -1);
+ as_app_add_category (AS_APP (app), "Addons");
+ as_app_add_category (AS_APP (app), "Fonts");
if (as_app_get_name (AS_APP (app), NULL) == NULL)
asb_plugin_font_set_name (app, ft_face->family_name);
if (as_app_get_comment (AS_APP (app), NULL) == NULL) {
comment = g_strdup_printf ("A %s font from %s",
ft_face->style_name,
ft_face->family_name);
- as_app_set_comment (AS_APP (app), "C", comment, -1);
+ as_app_set_comment (AS_APP (app), "C", comment);
}
asb_font_add_languages (app, pattern);
asb_font_add_metadata (app, ft_face);
@@ -723,7 +723,7 @@ asb_plugin_font_app (AsbPlugin *plugin, AsbApp *app,
}
icon = as_icon_new ();
as_icon_set_kind (icon, AS_ICON_KIND_CACHED);
- as_icon_set_name (icon, icon_filename, -1);
+ as_icon_set_name (icon, icon_filename);
as_icon_set_pixbuf (icon, pixbuf);
as_app_add_icon (AS_APP (app), icon);
}
diff --git a/libappstream-builder/plugins/asb-plugin-gettext.c b/libappstream-builder/plugins/asb-plugin-gettext.c
index 695817d..97cde4c 100644
--- a/libappstream-builder/plugins/asb-plugin-gettext.c
+++ b/libappstream-builder/plugins/asb-plugin-gettext.c
@@ -271,7 +271,7 @@ asb_plugin_process_app (AsbPlugin *plugin,
e = l->data;
if (e->percentage < 25)
continue;
- as_app_add_language (AS_APP (app), e->percentage, e->locale, -1);
+ as_app_add_language (AS_APP (app), e->percentage, e->locale);
}
out:
asb_gettext_ctx_free (ctx);
diff --git a/libappstream-builder/plugins/asb-plugin-gstreamer.c b/libappstream-builder/plugins/asb-plugin-gstreamer.c
index 8d6b4fb..6cf1eed 100644
--- a/libappstream-builder/plugins/asb-plugin-gstreamer.c
+++ b/libappstream-builder/plugins/asb-plugin-gstreamer.c
@@ -158,16 +158,16 @@ asb_plugin_process (AsbPlugin *plugin,
/* create app */
app = asb_app_new (pkg, app_id);
as_app_set_id_kind (AS_APP (app), AS_ID_KIND_CODEC);
- as_app_set_name (AS_APP (app), "C", "GStreamer Multimedia Codecs", -1);
+ as_app_set_name (AS_APP (app), "C", "GStreamer Multimedia Codecs");
asb_app_set_requires_appdata (app, TRUE);
asb_app_set_hidpi_enabled (app, asb_context_get_flag (plugin->ctx, ASB_CONTEXT_FLAG_HIDPI_ICONS));
- as_app_add_category (AS_APP (app), "Addons", -1);
- as_app_add_category (AS_APP (app), "Codecs", -1);
+ as_app_add_category (AS_APP (app), "Addons");
+ as_app_add_category (AS_APP (app), "Codecs");
/* add icon */
icon = as_icon_new ();
as_icon_set_kind (icon, AS_ICON_KIND_STOCK);
- as_icon_set_name (icon, "application-x-executable", -1);
+ as_icon_set_name (icon, "application-x-executable");
as_app_add_icon (AS_APP (app), icon);
for (i = 0; data[i].path != NULL; i++) {
@@ -175,7 +175,7 @@ asb_plugin_process (AsbPlugin *plugin,
continue;
split = g_strsplit (data[i].text, "|", -1);
for (j = 0; split[j] != NULL; j++)
- as_app_add_keyword (AS_APP (app), NULL, split[j], -1);
+ as_app_add_keyword (AS_APP (app), NULL, split[j]);
g_strfreev (split);
}
@@ -206,7 +206,7 @@ asb_plugin_process (AsbPlugin *plugin,
} else {
g_string_append (str, g_ptr_array_index (keywords, 0));
}
- as_app_set_comment (AS_APP (app), "C", str->str, -1);
+ as_app_set_comment (AS_APP (app), "C", str->str);
/* add */
asb_plugin_add_app (&apps, AS_APP (app));
diff --git a/libappstream-builder/plugins/asb-plugin-hardcoded.c b/libappstream-builder/plugins/asb-plugin-hardcoded.c
index 79280d4..b2e7396 100644
--- a/libappstream-builder/plugins/asb-plugin-hardcoded.c
+++ b/libappstream-builder/plugins/asb-plugin-hardcoded.c
@@ -109,46 +109,46 @@ asb_plugin_process_app (AsbPlugin *plugin,
/* add extra categories */
tmp = as_app_get_id (AS_APP (app));
if (g_strcmp0 (tmp, "0install.desktop") == 0)
- as_app_add_category (AS_APP (app), "System", -1);
+ as_app_add_category (AS_APP (app), "System");
if (g_strcmp0 (tmp, "alacarte.desktop") == 0)
- as_app_add_category (AS_APP (app), "System", -1);
+ as_app_add_category (AS_APP (app), "System");
if (g_strcmp0 (tmp, "deja-dup.desktop") == 0)
- as_app_add_category (AS_APP (app), "Utility", -1);
+ as_app_add_category (AS_APP (app), "Utility");
if (g_strcmp0 (tmp, "gddccontrol.desktop") == 0)
- as_app_add_category (AS_APP (app), "System", -1);
+ as_app_add_category (AS_APP (app), "System");
if (g_strcmp0 (tmp, "nautilus.desktop") == 0)
- as_app_add_category (AS_APP (app), "System", -1);
+ as_app_add_category (AS_APP (app), "System");
if (g_strcmp0 (tmp, "pessulus.desktop") == 0)
- as_app_add_category (AS_APP (app), "System", -1);
+ as_app_add_category (AS_APP (app), "System");
if (g_strcmp0 (tmp, "pmdefaults.desktop") == 0)
- as_app_add_category (AS_APP (app), "System", -1);
+ as_app_add_category (AS_APP (app), "System");
if (g_strcmp0 (tmp, "fwfstab.desktop") == 0)
- as_app_add_category (AS_APP (app), "System", -1);
+ as_app_add_category (AS_APP (app), "System");
if (g_strcmp0 (tmp, "bmpanel2cfg.desktop") == 0)
- as_app_add_category (AS_APP (app), "System", -1);
+ as_app_add_category (AS_APP (app), "System");
if (g_strcmp0 (tmp, "wallpapoz.desktop") == 0)
- as_app_add_category (AS_APP (app), "System", -1);
+ as_app_add_category (AS_APP (app), "System");
if (g_strcmp0 (tmp, "superkaramba.desktop") == 0)
- as_app_add_category (AS_APP (app), "System", -1);
+ as_app_add_category (AS_APP (app), "System");
/* add extra project groups */
if (g_strcmp0 (tmp, "nemo.desktop") == 0)
- as_app_set_project_group (AS_APP (app), "Cinnamon", -1);
+ as_app_set_project_group (AS_APP (app), "Cinnamon");
if (g_strcmp0 (tmp, "xfdashboard.desktop") == 0)
- as_app_set_project_group (AS_APP (app), "XFCE", -1);
+ as_app_set_project_group (AS_APP (app), "XFCE");
/* use the URL to guess the project group */
tmp = asb_package_get_url (pkg);
if (as_app_get_project_group (AS_APP (app)) == NULL && tmp != NULL) {
tmp = asb_glob_value_search (plugin->priv->project_groups, tmp);
if (tmp != NULL)
- as_app_set_project_group (AS_APP (app), tmp, -1);
+ as_app_set_project_group (AS_APP (app), tmp);
}
/* use summary to guess the project group */
tmp = as_app_get_comment (AS_APP (app), NULL);
if (tmp != NULL && g_strstr_len (tmp, -1, "for KDE") != NULL)
- as_app_set_project_group (AS_APP (app), "KDE", -1);
+ as_app_set_project_group (AS_APP (app), "KDE");
/* look for any installed docs */
filelist = asb_package_get_filelist (pkg);
@@ -247,7 +247,7 @@ asb_plugin_process_app (AsbPlugin *plugin,
days = secs / (60 * 60 * 24);
if (secs > 0 && days < 365) {
as_app_add_metadata (AS_APP (app),
- "X-Kudo-RecentRelease", "", -1);
+ "X-Kudo-RecentRelease", "");
break;
}
}
diff --git a/libappstream-builder/plugins/asb-plugin-ibus-sql.c b/libappstream-builder/plugins/asb-plugin-ibus-sql.c
index ca7a973..66f5fb5 100644
--- a/libappstream-builder/plugins/asb-plugin-ibus-sql.c
+++ b/libappstream-builder/plugins/asb-plugin-ibus-sql.c
@@ -188,19 +188,19 @@ asb_plugin_process_filename (AsbPlugin *plugin,
basename = g_path_get_basename (filename);
app = asb_app_new (pkg, basename);
as_app_set_id_kind (AS_APP (app), AS_ID_KIND_INPUT_METHOD);
- as_app_add_category (AS_APP (app), "Addons", -1);
- as_app_add_category (AS_APP (app), "InputSources", -1);
- as_app_set_name (AS_APP (app), "C", name, -1);
- as_app_set_comment (AS_APP (app), "C", description, -1);
+ as_app_add_category (AS_APP (app), "Addons");
+ as_app_add_category (AS_APP (app), "InputSources");
+ as_app_set_name (AS_APP (app), "C", name);
+ as_app_set_comment (AS_APP (app), "C", description);
if (symbol != NULL && symbol[0] != '\0')
- as_app_add_metadata (AS_APP (app), "X-IBus-Symbol", symbol, -1);
+ as_app_add_metadata (AS_APP (app), "X-IBus-Symbol", symbol);
if (language_string != NULL) {
languages = g_strsplit (language_string, ",", -1);
for (i = 0; languages[i] != NULL; i++) {
if (g_strcmp0 (languages[i], "other") == 0)
continue;
as_app_add_language (AS_APP (app),
- 100, languages[i], -1);
+ 100, languages[i]);
}
}
asb_app_set_requires_appdata (app, TRUE);
@@ -209,7 +209,7 @@ asb_plugin_process_filename (AsbPlugin *plugin,
/* add icon */
icon = as_icon_new ();
as_icon_set_kind (icon, AS_ICON_KIND_STOCK);
- as_icon_set_name (icon, "system-run-symbolic", -1);
+ as_icon_set_name (icon, "system-run-symbolic");
as_app_add_icon (AS_APP (app), icon);
asb_plugin_add_app (apps, AS_APP (app));
diff --git a/libappstream-builder/plugins/asb-plugin-ibus-xml.c b/libappstream-builder/plugins/asb-plugin-ibus-xml.c
index d3f8437..f14bc33 100644
--- a/libappstream-builder/plugins/asb-plugin-ibus-xml.c
+++ b/libappstream-builder/plugins/asb-plugin-ibus-xml.c
@@ -119,44 +119,44 @@ asb_plugin_process_filename (AsbPlugin *plugin,
basename = g_path_get_basename (filename);
app = asb_app_new (pkg, basename);
as_app_set_id_kind (AS_APP (app), AS_ID_KIND_INPUT_METHOD);
- as_app_add_category (AS_APP (app), "Addons", -1);
- as_app_add_category (AS_APP (app), "InputSources", -1);
+ as_app_add_category (AS_APP (app), "Addons");
+ as_app_add_category (AS_APP (app), "InputSources");
asb_app_set_requires_appdata (app, TRUE);
asb_app_set_hidpi_enabled (app, asb_context_get_flag (plugin->ctx, ASB_CONTEXT_FLAG_HIDPI_ICONS));
/* add icon */
icon = as_icon_new ();
as_icon_set_kind (icon, AS_ICON_KIND_STOCK);
- as_icon_set_name (icon, "system-run-symbolic", -1);
+ as_icon_set_name (icon, "system-run-symbolic");
as_app_add_icon (AS_APP (app), icon);
/* read the component header which all input methods have */
n = as_node_find (root, "component/description");
if (n != NULL) {
- as_app_set_name (AS_APP (app), "C", as_node_get_data (n), -1);
- as_app_set_comment (AS_APP (app), "C", as_node_get_data (n), -1);
+ as_app_set_name (AS_APP (app), "C", as_node_get_data (n));
+ as_app_set_comment (AS_APP (app), "C", as_node_get_data (n));
}
n = as_node_find (root, "component/homepage");
if (n != NULL) {
as_app_add_url (AS_APP (app),
AS_URL_KIND_HOMEPAGE,
- as_node_get_data (n), -1);
+ as_node_get_data (n));
}
/* do we have a engine section we can use? */
n = as_node_find (root, "component/engines/engine/longname");
if (n != NULL)
- as_app_set_name (AS_APP (app), "C", as_node_get_data (n), -1);
+ as_app_set_name (AS_APP (app), "C", as_node_get_data (n));
n = as_node_find (root, "component/engines/engine/description");
if (n != NULL)
- as_app_set_comment (AS_APP (app), "C", as_node_get_data (n), -1);
+ as_app_set_comment (AS_APP (app), "C", as_node_get_data (n));
n = as_node_find (root, "component/engines/engine/symbol");
if (n != NULL) {
tmp = as_node_get_data (n);
if (tmp != NULL && tmp[0] != '\0') {
as_app_add_metadata (AS_APP (app),
"X-IBus-Symbol",
- tmp, -1);
+ tmp);
}
}
n = as_node_find (root, "component/engines/engine/language");
@@ -168,7 +168,7 @@ asb_plugin_process_filename (AsbPlugin *plugin,
if (g_strcmp0 (languages[i], "other") == 0)
continue;
as_app_add_language (AS_APP (app),
- 100, languages[i], -1);
+ 100, languages[i]);
}
}
}
diff --git a/libappstream-builder/plugins/asb-plugin-ostree.c b/libappstream-builder/plugins/asb-plugin-ostree.c
index 8744157..a07fc7f 100644
--- a/libappstream-builder/plugins/asb-plugin-ostree.c
+++ b/libappstream-builder/plugins/asb-plugin-ostree.c
@@ -56,12 +56,12 @@ asb_plugin_process_filename (const gchar *filename, AsbApp *app, GError **error)
return FALSE;
app_runtime = g_key_file_get_string (kf, "Application", "runtime", NULL);
if (app_runtime != NULL)
- as_app_add_metadata (AS_APP (app), "BundleRuntime", app_runtime, -1);
+ as_app_add_metadata (AS_APP (app), "BundleRuntime", app_runtime);
app_sdk = g_key_file_get_string (kf, "Application", "sdk", NULL);
if (app_sdk != NULL)
- as_app_add_metadata (AS_APP (app), "BundleSDK", app_sdk, -1);
+ as_app_add_metadata (AS_APP (app), "BundleSDK", app_sdk);
if (g_key_file_get_string (kf, "Environment", "network", NULL))
- as_app_add_permission (AS_APP (app), "network", -1);
+ as_app_add_permission (AS_APP (app), "network");
return TRUE;
}
diff --git a/libappstream-glib/as-app-desktop.c b/libappstream-glib/as-app-desktop.c
index cb7851c..72bcbfe 100644
--- a/libappstream-glib/as-app-desktop.c
+++ b/libappstream-glib/as-app-desktop.c
@@ -68,13 +68,13 @@ as_app_infer_file_key (AsApp *app,
key,
NULL);
if (g_strcmp0 (tmp, "GNOME") == 0)
- as_app_set_project_group (app, "GNOME", -1);
+ as_app_set_project_group (app, "GNOME");
} else if (g_strcmp0 (key, "X-MATE-Bugzilla-Product") == 0) {
- as_app_set_project_group (app, "MATE", -1);
+ as_app_set_project_group (app, "MATE");
} else if (g_strcmp0 (key, "X-KDE-StartupNotify") == 0) {
- as_app_set_project_group (app, "KDE", -1);
+ as_app_set_project_group (app, "KDE");
} else if (g_strcmp0 (key, "X-DocPath") == 0) {
tmp = g_key_file_get_string (kf,
@@ -82,7 +82,7 @@ as_app_infer_file_key (AsApp *app,
key,
NULL);
if (g_str_has_prefix (tmp, "http://userbase.kde.org/"))
- as_app_set_project_group (app, "KDE", -1);
+ as_app_set_project_group (app, "KDE");
/* Exec */
} else if (g_strcmp0 (key, G_KEY_FILE_DESKTOP_KEY_EXEC) == 0) {
@@ -91,7 +91,7 @@ as_app_infer_file_key (AsApp *app,
key,
NULL);
if (g_str_has_prefix (tmp, "xfce4-"))
- as_app_set_project_group (app, "XFCE", -1);
+ as_app_set_project_group (app, "XFCE");
}
return TRUE;
@@ -167,16 +167,16 @@ as_app_parse_file_key (AsApp *app,
if (tmp != NULL && tmp[0] != '\0') {
_cleanup_object_unref_ AsIcon *icon = NULL;
icon = as_icon_new ();
- as_icon_set_name (icon, tmp, -1);
+ as_icon_set_name (icon, tmp);
dot = g_strstr_len (tmp, -1, ".");
if (dot != NULL)
*dot = '\0';
if (as_utils_is_stock_icon_name (tmp)) {
- as_icon_set_name (icon, tmp, -1);
+ as_icon_set_name (icon, tmp);
as_icon_set_kind (icon, AS_ICON_KIND_STOCK);
} else if ((flags & AS_APP_PARSE_FLAG_USE_FALLBACKS) > 0 &&
_as_utils_is_stock_icon_name_fallback (tmp)) {
- as_icon_set_name (icon, tmp, -1);
+ as_icon_set_name (icon, tmp);
as_icon_set_kind (icon, AS_ICON_KIND_STOCK);
} else {
as_icon_set_kind (icon, AS_ICON_KIND_LOCAL);
@@ -218,7 +218,7 @@ as_app_parse_file_key (AsApp *app,
continue;
if (g_strcmp0 (list[i], "GNOME") == 0)
continue;
- as_app_add_category (app, list[i], -1);
+ as_app_add_category (app, list[i]);
}
} else if (g_strcmp0 (key, "Keywords") == 0) {
@@ -232,8 +232,7 @@ as_app_parse_file_key (AsApp *app,
for (j = 0; kw_split[j] != NULL; j++) {
if (kw_split[j][0] == '\0')
continue;
- as_app_add_keyword (app, "C",
- kw_split[j], -1);
+ as_app_add_keyword (app, "C", kw_split[j]);
}
}
@@ -250,8 +249,7 @@ as_app_parse_file_key (AsApp *app,
for (j = 0; kw_split[j] != NULL; j++) {
if (kw_split[j][0] == '\0')
continue;
- as_app_add_keyword (app, locale,
- kw_split[j], -1);
+ as_app_add_keyword (app, locale, kw_split[j]);
}
}
@@ -261,7 +259,7 @@ as_app_parse_file_key (AsApp *app,
key,
NULL, NULL);
for (i = 0; list[i] != NULL; i++)
- as_app_add_mimetype (app, list[i], -1);
+ as_app_add_mimetype (app, list[i]);
} else if (g_strcmp0 (key, "X-AppInstall-Package") == 0) {
tmp = g_key_file_get_string (kf,
@@ -269,7 +267,7 @@ as_app_parse_file_key (AsApp *app,
key,
NULL);
if (tmp != NULL && tmp[0] != '\0')
- as_app_add_pkgname (app, tmp, -1);
+ as_app_add_pkgname (app, tmp);
/* OnlyShowIn */
} else if (g_strcmp0 (key, G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN) == 0) {
@@ -279,7 +277,7 @@ as_app_parse_file_key (AsApp *app,
key,
NULL, NULL);
if (g_strv_length (list) == 1)
- as_app_set_project_group (app, list[0], -1);
+ as_app_set_project_group (app, list[0]);
/* Name */
} else if (g_strcmp0 (key, G_KEY_FILE_DESKTOP_KEY_NAME) == 0 ||
@@ -289,7 +287,7 @@ as_app_parse_file_key (AsApp *app,
key,
NULL);
if (tmp != NULL && tmp[0] != '\0')
- as_app_set_name (app, "C", tmp, -1);
+ as_app_set_name (app, "C", tmp);
/* Name[] */
} else if (g_str_has_prefix (key, G_KEY_FILE_DESKTOP_KEY_NAME)) {
@@ -300,7 +298,7 @@ as_app_parse_file_key (AsApp *app,
locale,
NULL);
if (tmp != NULL && tmp[0] != '\0')
- as_app_set_name (app, locale, tmp, -1);
+ as_app_set_name (app, locale, tmp);
/* Comment */
} else if (g_strcmp0 (key, G_KEY_FILE_DESKTOP_KEY_COMMENT) == 0 ||
@@ -310,7 +308,7 @@ as_app_parse_file_key (AsApp *app,
key,
NULL);
if (tmp != NULL && tmp[0] != '\0')
- as_app_set_comment (app, "C", tmp, -1);
+ as_app_set_comment (app, "C", tmp);
/* Comment[] */
} else if (g_str_has_prefix (key, G_KEY_FILE_DESKTOP_KEY_COMMENT)) {
@@ -321,7 +319,7 @@ as_app_parse_file_key (AsApp *app,
locale,
NULL);
if (tmp != NULL && tmp[0] != '\0')
- as_app_set_comment (app, locale, tmp, -1);
+ as_app_set_comment (app, locale, tmp);
/* non-standard */
} else if (g_strcmp0 (key, "X-Ubuntu-Software-Center-Name") == 0) {
@@ -330,7 +328,7 @@ as_app_parse_file_key (AsApp *app,
key,
NULL);
if (tmp != NULL && tmp[0] != '\0')
- as_app_set_name (app, "C", tmp, -1);
+ as_app_set_name (app, "C", tmp);
} else if (g_str_has_prefix (key, "X-Ubuntu-Software-Center-Name")) {
locale = as_app_desktop_key_get_locale (key);
tmp = g_key_file_get_locale_string (kf,
@@ -339,7 +337,7 @@ as_app_parse_file_key (AsApp *app,
locale,
NULL);
if (tmp != NULL && tmp[0] != '\0')
- as_app_set_name (app, locale, tmp, -1);
+ as_app_set_name (app, locale, tmp);
}
return TRUE;
@@ -365,7 +363,7 @@ as_app_parse_file_key_fallback_comment (AsApp *app,
key,
NULL);
if (tmp != NULL && tmp[0] != '\0')
- as_app_set_comment (app, "C", tmp, -1);
+ as_app_set_comment (app, "C", tmp);
/* GenericName[] */
} else if (g_str_has_prefix (key, G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME)) {
@@ -376,7 +374,7 @@ as_app_parse_file_key_fallback_comment (AsApp *app,
locale,
NULL);
if (tmp != NULL && tmp[0] != '\0')
- as_app_set_comment (app, locale, tmp, -1);
+ as_app_set_comment (app, locale, tmp);
}
return TRUE;
@@ -423,9 +421,9 @@ as_app_parse_desktop_file (AsApp *app,
/* Ubuntu helpfully put the package name in the desktop file name */
tmp = g_strstr_len (app_id, -1, ":");
if (tmp != NULL)
- as_app_set_id (app, tmp + 1, -1);
+ as_app_set_id (app, tmp + 1);
else
- as_app_set_id (app, app_id, -1);
+ as_app_set_id (app, app_id);
/* look at all the keys */
keys = g_key_file_get_keys (kf, G_KEY_FILE_DESKTOP_GROUP, NULL, error);
diff --git a/libappstream-glib/as-app-inf.c b/libappstream-glib/as-app-inf.c
index c7581c6..3650e88 100644
--- a/libappstream-glib/as-app-inf.c
+++ b/libappstream-glib/as-app-inf.c
@@ -119,7 +119,7 @@ as_app_parse_inf_file (AsApp *app,
if (g_strcmp0 (class_guid, AS_APP_INF_CLASS_GUID_FIRMWARE) != 0) {
g_debug ("ClassGuid is '%s', not '%s', so using as an ID",
class_guid, AS_APP_INF_CLASS_GUID_FIRMWARE);
- as_app_set_id (app, class_guid, -1);
+ as_app_set_id (app, class_guid);
} else {
/* get the ESRT GUID */
guid = g_key_file_get_string (kf,
@@ -134,7 +134,7 @@ as_app_parse_inf_file (AsApp *app,
return FALSE;
}
id = as_app_parse_inf_sanitize_guid (guid);
- as_app_set_id (app, id, -1);
+ as_app_set_id (app, id);
}
/* get vendor */
@@ -144,19 +144,19 @@ as_app_parse_inf_file (AsApp *app,
if (vendor == NULL) /* FIXME: is a hack */
vendor = g_key_file_get_string (kf, "Strings", "Provider", NULL);
if (vendor != NULL)
- as_app_set_developer_name (app, NULL, vendor, -1);
+ as_app_set_developer_name (app, NULL, vendor);
/* get name */
name = g_key_file_get_string (kf, "Strings", "FirmwareDesc", NULL);
if (name != NULL)
- as_app_set_name (app, NULL, name, -1);
+ as_app_set_name (app, NULL, name);
/* get comment */
comment = g_key_file_get_string (kf, "SourceDisksNames", "1", NULL);
if (comment == NULL) /* FIXME: is a hack */
comment = g_key_file_get_string (kf, "Strings", "DiskName", NULL);
if (comment != NULL)
- as_app_set_comment (app, NULL, comment, -1);
+ as_app_set_comment (app, NULL, comment);
/* parse the DriverVer */
version = as_inf_get_driver_version (kf, &timestamp, error);
@@ -179,23 +179,23 @@ as_app_parse_inf_file (AsApp *app,
"no SourceDisksFiles or Firmware_CopyFiles");
return FALSE;
}
- as_app_add_metadata (app, "FirmwareBasename", firmware_basename, -1);
+ as_app_add_metadata (app, "FirmwareBasename", firmware_basename);
/* optional */
catalog_basename = g_key_file_get_string (kf, "Version", "CatalogFile", NULL);
if (catalog_basename != NULL)
- as_app_add_metadata (app, "CatalogBasename", catalog_basename, -1);
+ as_app_add_metadata (app, "CatalogBasename", catalog_basename);
/* add a release with no real description */
release = as_release_new ();
- as_release_set_version (release, version, -1);
+ as_release_set_version (release, version);
as_release_set_timestamp (release, timestamp);
as_app_add_release (app, release);
/* add icon */
icon = as_icon_new ();
as_icon_set_kind (icon, AS_ICON_KIND_STOCK);
- as_icon_set_name (icon, "application-x-executable", -1);
+ as_icon_set_name (icon, "application-x-executable");
as_app_add_icon (app, icon);
return TRUE;
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c
index b157dcb..53f164b 100644
--- a/libappstream-glib/as-app.c
+++ b/libappstream-glib/as-app.c
@@ -1373,7 +1373,7 @@ as_app_get_source_file (AsApp *app)
* as_app_validate_utf8:
**/
static gboolean
-as_app_validate_utf8 (const gchar *text, gssize text_len)
+as_app_validate_utf8 (const gchar *text)
{
gboolean is_whitespace = TRUE;
guint i;
@@ -1391,7 +1391,7 @@ as_app_validate_utf8 (const gchar *text, gssize text_len)
return FALSE;
/* standard UTF-8 checks */
- if (!g_utf8_validate (text, text_len, NULL))
+ if (!g_utf8_validate (text, -1, NULL))
return FALSE;
/* additional check for xmllint */
@@ -1408,21 +1408,20 @@ as_app_validate_utf8 (const gchar *text, gssize text_len)
* as_app_set_id:
* @app: a #AsApp instance.
* @id: the new _full_ application ID, e.g. "org.gnome.Software.desktop".
- * @id_len: the size of @id, or -1 if %NULL-terminated.
*
* Sets a new application ID. Any invalid characters will be automatically replaced.
*
* Since: 0.1.0
**/
void
-as_app_set_id (AsApp *app, const gchar *id, gssize id_len)
+as_app_set_id (AsApp *app, const gchar *id)
{
AsAppPrivate *priv = GET_PRIVATE (app);
gchar *tmp;
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (id, id_len)) {
+ !as_app_validate_utf8 (id)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
@@ -1430,7 +1429,7 @@ as_app_set_id (AsApp *app, const gchar *id, gssize id_len)
g_free (priv->id);
g_free (priv->id_filename);
- priv->id = as_strndup (id, id_len);
+ priv->id = g_strdup (id);
priv->id_filename = g_strdup (priv->id);
g_strdelimit (priv->id_filename, "&<>", '-');
tmp = g_strrstr_len (priv->id_filename, -1, ".");
@@ -1507,79 +1506,70 @@ as_app_set_id_kind (AsApp *app, AsIdKind id_kind)
* as_app_set_project_group:
* @app: a #AsApp instance.
* @project_group: the project group, e.g. "GNOME".
- * @project_group_len: the size of @project_group, or -1 if %NULL-terminated.
*
* Set any project affiliation.
*
* Since: 0.1.0
**/
void
-as_app_set_project_group (AsApp *app,
- const gchar *project_group,
- gssize project_group_len)
+as_app_set_project_group (AsApp *app, const gchar *project_group)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (project_group, project_group_len)) {
+ !as_app_validate_utf8 (project_group)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
g_free (priv->project_group);
- priv->project_group = as_strndup (project_group, project_group_len);
+ priv->project_group = g_strdup (project_group);
}
/**
* as_app_set_project_license:
* @app: a #AsApp instance.
* @project_license: the project license string.
- * @project_license_len: the size of @project_license, or -1 if %NULL-terminated.
*
* Set the project license.
*
* Since: 0.1.0
**/
void
-as_app_set_project_license (AsApp *app,
- const gchar *project_license,
- gssize project_license_len)
+as_app_set_project_license (AsApp *app, const gchar *project_license)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (project_license, project_license_len)) {
+ !as_app_validate_utf8 (project_license)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
g_free (priv->project_license);
- priv->project_license = as_strndup (project_license, project_license_len);
+ priv->project_license = g_strdup (project_license);
}
/**
* as_app_set_metadata_license:
* @app: a #AsApp instance.
* @metadata_license: the project license string.
- * @metadata_license_len: the size of @metadata_license, or -1 if %NULL-terminated.
*
* Set the project license.
*
* Since: 0.1.4
**/
void
-as_app_set_metadata_license (AsApp *app,
- const gchar *metadata_license,
- gssize metadata_license_len)
+as_app_set_metadata_license (AsApp *app, const gchar *metadata_license)
{
AsAppPrivate *priv = GET_PRIVATE (app);
_cleanup_strv_free_ gchar **tokens = NULL;
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (metadata_license, metadata_license_len)) {
+ !as_app_validate_utf8 (metadata_license)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
@@ -1594,7 +1584,6 @@ as_app_set_metadata_license (AsApp *app,
* as_app_set_source_pkgname:
* @app: a #AsApp instance.
* @source_pkgname: the project license string.
- * @source_pkgname_len: the size of @source_pkgname, or -1 if %NULL-terminated.
*
* Set the project license.
*
@@ -1602,19 +1591,18 @@ as_app_set_metadata_license (AsApp *app,
**/
void
as_app_set_source_pkgname (AsApp *app,
- const gchar *source_pkgname,
- gssize source_pkgname_len)
+ const gchar *source_pkgname)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (source_pkgname, source_pkgname_len)) {
+ !as_app_validate_utf8 (source_pkgname)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
g_free (priv->source_pkgname);
- priv->source_pkgname = as_strndup (source_pkgname, source_pkgname_len);
+ priv->source_pkgname = g_strdup (source_pkgname);
}
/**
@@ -1638,16 +1626,13 @@ as_app_set_source_file (AsApp *app, const gchar *source_file)
* as_app_set_update_contact:
* @app: a #AsApp instance.
* @update_contact: the project license string.
- * @update_contact_len: the size of @update_contact, or -1 if %NULL-terminated.
*
* Set the project license.
*
* Since: 0.1.4
**/
void
-as_app_set_update_contact (AsApp *app,
- const gchar *update_contact,
- gssize update_contact_len)
+as_app_set_update_contact (AsApp *app, const gchar *update_contact)
{
AsAppPrivate *priv = GET_PRIVATE (app);
gboolean done_replacement = TRUE;
@@ -1669,14 +1654,14 @@ as_app_set_update_contact (AsApp *app,
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (update_contact, update_contact_len)) {
+ !as_app_validate_utf8 (update_contact)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
/* copy as-is */
g_free (priv->update_contact);
- priv->update_contact = as_strndup (update_contact, update_contact_len);
+ priv->update_contact = g_strdup (update_contact);
if (priv->update_contact == NULL)
return;
@@ -1719,26 +1704,25 @@ as_app_set_origin (AsApp *app, const gchar *origin)
* as_app_set_icon_path:
* @app: a #AsApp instance.
* @icon_path: the local path.
- * @icon_path_len: the size of @icon_path, or -1 if %NULL-terminated.
*
* Sets the icon path, where local icons would be found.
*
* Since: 0.1.0
**/
void
-as_app_set_icon_path (AsApp *app, const gchar *icon_path, gssize icon_path_len)
+as_app_set_icon_path (AsApp *app, const gchar *icon_path)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (icon_path, icon_path_len)) {
+ !as_app_validate_utf8 (icon_path)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
g_free (priv->icon_path);
- priv->icon_path = as_strndup (icon_path, icon_path_len);
+ priv->icon_path = g_strdup (icon_path);
}
/**
@@ -1765,7 +1749,6 @@ as_app_parse_locale (const gchar *locale)
* @app: a #AsApp instance.
* @locale: the locale, or %NULL. e.g. "en_GB"
* @name: the application name.
- * @name_len: the size of @name, or -1 if %NULL-terminated.
*
* Sets the application name for a specific locale.
*
@@ -1774,15 +1757,14 @@ as_app_parse_locale (const gchar *locale)
void
as_app_set_name (AsApp *app,
const gchar *locale,
- const gchar *name,
- gssize name_len)
+ const gchar *name)
{
AsAppPrivate *priv = GET_PRIVATE (app);
gchar *tmp_locale;
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (name, name_len)) {
+ !as_app_validate_utf8 (name)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
@@ -1793,7 +1775,7 @@ as_app_set_name (AsApp *app,
return;
g_hash_table_insert (priv->names,
tmp_locale,
- as_strndup (name, name_len));
+ g_strdup (name));
}
/**
@@ -1801,7 +1783,6 @@ as_app_set_name (AsApp *app,
* @app: a #AsApp instance.
* @locale: the locale, or %NULL. e.g. "en_GB"
* @comment: the application summary.
- * @comment_len: the size of @comment, or -1 if %NULL-terminated.
*
* Sets the application summary for a specific locale.
*
@@ -1810,8 +1791,7 @@ as_app_set_name (AsApp *app,
void
as_app_set_comment (AsApp *app,
const gchar *locale,
- const gchar *comment,
- gssize comment_len)
+ const gchar *comment)
{
AsAppPrivate *priv = GET_PRIVATE (app);
gchar *tmp_locale;
@@ -1820,7 +1800,7 @@ as_app_set_comment (AsApp *app,
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (comment, comment_len)) {
+ !as_app_validate_utf8 (comment)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
@@ -1831,7 +1811,7 @@ as_app_set_comment (AsApp *app,
return;
g_hash_table_insert (priv->comments,
tmp_locale,
- as_strndup (comment, comment_len));
+ g_strdup (comment));
}
/**
@@ -1839,7 +1819,6 @@ as_app_set_comment (AsApp *app,
* @app: a #AsApp instance.
* @locale: the locale, or %NULL. e.g. "en_GB"
* @developer_name: the application developer name.
- * @developer_name_len: the size of @developer_name, or -1 if %NULL-terminated.
*
* Sets the application developer name for a specific locale.
*
@@ -1848,8 +1827,7 @@ as_app_set_comment (AsApp *app,
void
as_app_set_developer_name (AsApp *app,
const gchar *locale,
- const gchar *developer_name,
- gssize developer_name_len)
+ const gchar *developer_name)
{
AsAppPrivate *priv = GET_PRIVATE (app);
gchar *tmp_locale;
@@ -1858,7 +1836,7 @@ as_app_set_developer_name (AsApp *app,
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (developer_name, developer_name_len)) {
+ !as_app_validate_utf8 (developer_name)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
@@ -1869,7 +1847,7 @@ as_app_set_developer_name (AsApp *app,
return;
g_hash_table_insert (priv->developer_names,
tmp_locale,
- as_strndup (developer_name, developer_name_len));
+ g_strdup (developer_name));
}
/**
@@ -1877,7 +1855,6 @@ as_app_set_developer_name (AsApp *app,
* @app: a #AsApp instance.
* @locale: the locale, or %NULL. e.g. "en_GB"
* @description: the application description.
- * @description_len: the size of @description, or -1 if %NULL-terminated.
*
* Sets the application descrption markup for a specific locale.
*
@@ -1886,8 +1863,7 @@ as_app_set_developer_name (AsApp *app,
void
as_app_set_description (AsApp *app,
const gchar *locale,
- const gchar *description,
- gssize description_len)
+ const gchar *description)
{
AsAppPrivate *priv = GET_PRIVATE (app);
gchar *tmp_locale;
@@ -1896,7 +1872,7 @@ as_app_set_description (AsApp *app,
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (description, description_len)) {
+ !as_app_validate_utf8 (description)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
@@ -1907,7 +1883,7 @@ as_app_set_description (AsApp *app,
return;
g_hash_table_insert (priv->descriptions,
tmp_locale,
- as_strndup (description, description_len));
+ g_strdup (description));
}
/**
@@ -1931,25 +1907,24 @@ as_app_set_priority (AsApp *app, gint priority)
* as_app_add_category:
* @app: a #AsApp instance.
* @category: the category.
- * @category_len: the size of @category, or -1 if %NULL-terminated.
*
* Adds a menu category to the application.
*
* Since: 0.1.0
**/
void
-as_app_add_category (AsApp *app, const gchar *category, gssize category_len)
+as_app_add_category (AsApp *app, const gchar *category)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (category, category_len)) {
+ !as_app_validate_utf8 (category)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_DUPLICATES) > 0 &&
- as_ptr_array_find_string (priv->categories, category, category_len)) {
+ as_ptr_array_find_string (priv->categories, category)) {
return;
}
@@ -1957,7 +1932,7 @@ as_app_add_category (AsApp *app, const gchar *category, gssize category_len)
if (g_strcmp0 (category, "Feed") == 0)
category = "News";
- g_ptr_array_add (priv->categories, as_strndup (category, category_len));
+ g_ptr_array_add (priv->categories, g_strdup (category));
}
@@ -1965,35 +1940,30 @@ as_app_add_category (AsApp *app, const gchar *category, gssize category_len)
* as_app_add_compulsory_for_desktop:
* @app: a #AsApp instance.
* @compulsory_for_desktop: the desktop string, e.g. "GNOME".
- * @compulsory_for_desktop_len: the size of @compulsory_for_desktop, or -1 if %NULL-terminated.
*
* Adds a desktop that requires this application to be installed.
*
* Since: 0.1.0
**/
void
-as_app_add_compulsory_for_desktop (AsApp *app,
- const gchar *compulsory_for_desktop,
- gssize compulsory_for_desktop_len)
+as_app_add_compulsory_for_desktop (AsApp *app, const gchar *compulsory_for_desktop)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (compulsory_for_desktop, compulsory_for_desktop_len)) {
+ !as_app_validate_utf8 (compulsory_for_desktop)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_DUPLICATES) > 0 &&
as_ptr_array_find_string (priv->compulsory_for_desktops,
- compulsory_for_desktop,
- compulsory_for_desktop_len)) {
+ compulsory_for_desktop)) {
return;
}
g_ptr_array_add (priv->compulsory_for_desktops,
- as_strndup (compulsory_for_desktop,
- compulsory_for_desktop_len));
+ g_strdup (compulsory_for_desktop));
}
/**
@@ -2001,7 +1971,6 @@ as_app_add_compulsory_for_desktop (AsApp *app,
* @app: a #AsApp instance.
* @locale: the locale, or %NULL. e.g. "en_GB"
* @keyword: the keyword.
- * @keyword_len: the size of @keyword, or -1 if %NULL-terminated.
*
* Add a keyword the application should match against.
*
@@ -2010,8 +1979,7 @@ as_app_add_compulsory_for_desktop (AsApp *app,
void
as_app_add_keyword (AsApp *app,
const gchar *locale,
- const gchar *keyword,
- gssize keyword_len)
+ const gchar *keyword)
{
AsAppPrivate *priv = GET_PRIVATE (app);
GPtrArray *tmp;
@@ -2019,7 +1987,7 @@ as_app_add_keyword (AsApp *app,
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (keyword, keyword_len)) {
+ !as_app_validate_utf8 (keyword)) {
return;
}
@@ -2034,64 +2002,62 @@ as_app_add_keyword (AsApp *app,
tmp = g_ptr_array_new_with_free_func (g_free);
g_hash_table_insert (priv->keywords, g_strdup (tmp_locale), tmp);
} else if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_DUPLICATES) > 0) {
- if (as_ptr_array_find_string (tmp, keyword, keyword_len))
+ if (as_ptr_array_find_string (tmp, keyword))
return;
}
- g_ptr_array_add (tmp, as_strndup (keyword, keyword_len));
+ g_ptr_array_add (tmp, g_strdup (keyword));
}
/**
* as_app_add_kudo:
* @app: a #AsApp instance.
* @kudo: the kudo.
- * @kudo_len: the size of @kudo, or -1 if %NULL-terminated.
*
* Add a kudo the application has obtained.
*
* Since: 0.2.2
**/
void
-as_app_add_kudo (AsApp *app, const gchar *kudo, gssize kudo_len)
+as_app_add_kudo (AsApp *app, const gchar *kudo)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (kudo, kudo_len)) {
+ !as_app_validate_utf8 (kudo)) {
return;
}
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_DUPLICATES) > 0 &&
- as_ptr_array_find_string (priv->kudos, kudo, kudo_len)) {
+ as_ptr_array_find_string (priv->kudos, kudo)) {
return;
}
- g_ptr_array_add (priv->kudos, as_strndup (kudo, kudo_len));
+ g_ptr_array_add (priv->kudos, g_strdup (kudo));
}
/**
* as_app_add_permission:
* @app: a #AsApp instance.
* @permission: the permission.
- * @permission_len: the size of @permission, or -1 if %NULL-terminated.
*
* Add a permission the application has obtained.
*
* Since: 0.3.5
**/
void
-as_app_add_permission (AsApp *app, const gchar *permission, gssize permission_len)
+as_app_add_permission (AsApp *app, const gchar *permission)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (permission, permission_len)) {
+ !as_app_validate_utf8 (permission)) {
return;
}
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_DUPLICATES) > 0 &&
- as_ptr_array_find_string (priv->permissions, permission, permission_len)) {
+ as_ptr_array_find_string (priv->permissions, permission)) {
return;
}
- g_ptr_array_add (priv->permissions, as_strndup (permission, permission_len));
+ g_ptr_array_add (priv->permissions, g_strdup (permission));
}
/**
@@ -2106,36 +2072,35 @@ as_app_add_permission (AsApp *app, const gchar *permission, gssize permission_le
void
as_app_add_kudo_kind (AsApp *app, AsKudoKind kudo_kind)
{
- as_app_add_kudo (app, as_kudo_kind_to_string (kudo_kind), -1);
+ as_app_add_kudo (app, as_kudo_kind_to_string (kudo_kind));
}
/**
* as_app_add_mimetype:
* @app: a #AsApp instance.
* @mimetype: the mimetype.
- * @mimetype_len: the size of @mimetype, or -1 if %NULL-terminated.
*
* Adds a mimetype the application can process.
*
* Since: 0.1.0
**/
void
-as_app_add_mimetype (AsApp *app, const gchar *mimetype, gssize mimetype_len)
+as_app_add_mimetype (AsApp *app, const gchar *mimetype)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (mimetype, mimetype_len)) {
+ !as_app_validate_utf8 (mimetype)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_DUPLICATES) > 0 &&
- as_ptr_array_find_string (priv->mimetypes, mimetype, mimetype_len)) {
+ as_ptr_array_find_string (priv->mimetypes, mimetype)) {
return;
}
- g_ptr_array_add (priv->mimetypes, as_strndup (mimetype, mimetype_len));
+ g_ptr_array_add (priv->mimetypes, g_strdup (mimetype));
}
/**
@@ -2154,7 +2119,7 @@ as_app_subsume_release (AsRelease *release, AsRelease *donor)
/* this is high quality metadata */
tmp = as_release_get_description (donor, NULL);
if (tmp != NULL)
- as_release_set_description (release, NULL, tmp, -1);
+ as_release_set_description (release, NULL, tmp);
/* overwrite the timestamp if the metadata is high quality,
* or if no timestamp has already been set */
@@ -2165,7 +2130,7 @@ as_app_subsume_release (AsRelease *release, AsRelease *donor)
locations = as_release_get_locations (donor);
for (i = 0; i < locations->len; i++) {
tmp = g_ptr_array_index (locations, i);
- as_release_add_location (release, tmp, -1);
+ as_release_add_location (release, tmp);
}
/* copy checksums if set */
@@ -2375,58 +2340,56 @@ as_app_add_bundle (AsApp *app, AsBundle *bundle)
* as_app_add_pkgname:
* @app: a #AsApp instance.
* @pkgname: the package name.
- * @pkgname_len: the size of @pkgname, or -1 if %NULL-terminated.
*
* Adds a package name to an application.
*
* Since: 0.1.0
**/
void
-as_app_add_pkgname (AsApp *app, const gchar *pkgname, gssize pkgname_len)
+as_app_add_pkgname (AsApp *app, const gchar *pkgname)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (pkgname, pkgname_len)) {
+ !as_app_validate_utf8 (pkgname)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_DUPLICATES) > 0 &&
- as_ptr_array_find_string (priv->pkgnames, pkgname, pkgname_len)) {
+ as_ptr_array_find_string (priv->pkgnames, pkgname)) {
return;
}
- g_ptr_array_add (priv->pkgnames, as_strndup (pkgname, pkgname_len));
+ g_ptr_array_add (priv->pkgnames, g_strdup (pkgname));
}
/**
* as_app_add_arch:
* @app: a #AsApp instance.
* @arch: the package name.
- * @arch_len: the size of @arch, or -1 if %NULL-terminated.
*
* Adds a package name to an application.
*
* Since: 0.1.1
**/
void
-as_app_add_arch (AsApp *app, const gchar *arch, gssize arch_len)
+as_app_add_arch (AsApp *app, const gchar *arch)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (arch, arch_len)) {
+ !as_app_validate_utf8 (arch)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_DUPLICATES) > 0 &&
- as_ptr_array_find_string (priv->architectures, arch, arch_len)) {
+ as_ptr_array_find_string (priv->architectures, arch)) {
return;
}
- g_ptr_array_add (priv->architectures, as_strndup (arch, arch_len));
+ g_ptr_array_add (priv->architectures, g_strdup (arch));
}
/**
@@ -2434,7 +2397,6 @@ as_app_add_arch (AsApp *app, const gchar *arch, gssize arch_len)
* @app: a #AsApp instance.
* @percentage: the percentage completion of the translation, or 0 for unknown
* @locale: the locale, or %NULL. e.g. "en_GB"
- * @locale_len: the size of @locale, or -1 if %NULL-terminated.
*
* Adds a language to the application.
*
@@ -2443,14 +2405,13 @@ as_app_add_arch (AsApp *app, const gchar *arch, gssize arch_len)
void
as_app_add_language (AsApp *app,
gint percentage,
- const gchar *locale,
- gssize locale_len)
+ const gchar *locale)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (locale, locale_len)) {
+ !as_app_validate_utf8 (locale)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
@@ -2458,7 +2419,7 @@ as_app_add_language (AsApp *app,
if (locale == NULL)
locale = "C";
g_hash_table_insert (priv->languages,
- as_strndup (locale, locale_len),
+ g_strdup (locale),
GINT_TO_POINTER (percentage));
}
@@ -2467,7 +2428,6 @@ as_app_add_language (AsApp *app,
* @app: a #AsApp instance.
* @url_kind: the URL kind, e.g. %AS_URL_KIND_HOMEPAGE
* @url: the full URL.
- * @url_len: the size of @url, or -1 if %NULL-terminated.
*
* Adds some URL data to the application.
*
@@ -2476,21 +2436,20 @@ as_app_add_language (AsApp *app,
void
as_app_add_url (AsApp *app,
AsUrlKind url_kind,
- const gchar *url,
- gssize url_len)
+ const gchar *url)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (url, url_len)) {
+ !as_app_validate_utf8 (url)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
g_hash_table_insert (priv->urls,
g_strdup (as_url_kind_to_string (url_kind)),
- as_strndup (url, url_len));
+ g_strdup (url));
}
/**
@@ -2498,7 +2457,6 @@ as_app_add_url (AsApp *app,
* @app: a #AsApp instance.
* @key: the metadata key.
* @value: the value to store.
- * @value_len: the size of @value, or -1 if %NULL-terminated.
*
* Adds a metadata entry to the application.
*
@@ -2507,15 +2465,14 @@ as_app_add_url (AsApp *app,
void
as_app_add_metadata (AsApp *app,
const gchar *key,
- const gchar *value,
- gssize value_len)
+ const gchar *value)
{
AsAppPrivate *priv = GET_PRIVATE (app);
g_return_if_fail (key != NULL);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (value, value_len)) {
+ !as_app_validate_utf8 (value)) {
return;
}
@@ -2523,7 +2480,7 @@ as_app_add_metadata (AsApp *app,
value = "";
g_hash_table_insert (priv->metadata,
g_strdup (key),
- as_strndup (value, value_len));
+ g_strdup (value));
}
/**
@@ -2546,25 +2503,24 @@ as_app_remove_metadata (AsApp *app, const gchar *key)
* as_app_add_extends:
* @app: a #AsApp instance.
* @extends: the full ID, e.g. "eclipse.desktop".
- * @extends_len: the size of @extends, or -1 if %NULL-terminated.
*
* Adds a parent ID to the application.
*
* Since: 0.1.7
**/
void
-as_app_add_extends (AsApp *app, const gchar *extends, gssize extends_len)
+as_app_add_extends (AsApp *app, const gchar *extends)
{
AsAppPrivate *priv = GET_PRIVATE (app);
/* handle untrusted */
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 &&
- !as_app_validate_utf8 (extends, extends_len)) {
+ !as_app_validate_utf8 (extends)) {
priv->problems |= AS_APP_PROBLEM_NOT_VALID_UTF8;
return;
}
if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_DUPLICATES) > 0 &&
- as_ptr_array_find_string (priv->extends, extends, extends_len)) {
+ as_ptr_array_find_string (priv->extends, extends)) {
return;
}
@@ -2572,7 +2528,7 @@ as_app_add_extends (AsApp *app, const gchar *extends, gssize extends_len)
if (g_strcmp0 (priv->id, extends) == 0)
return;
- g_ptr_array_add (priv->extends, as_strndup (extends, extends_len));
+ g_ptr_array_add (priv->extends, g_strdup (extends));
}
/**
@@ -2649,7 +2605,7 @@ as_app_subsume_keywords (AsApp *app, AsApp *donor, gboolean overwrite)
continue;
for (i = 0; i < array->len; i++) {
tmp = g_ptr_array_index (array, i);
- as_app_add_keyword (app, key, tmp, -1);
+ as_app_add_keyword (app, key, tmp);
}
}
}
@@ -2723,7 +2679,7 @@ as_app_subsume_private (AsApp *app, AsApp *donor, AsAppSubsumeFlags flags)
/* pkgnames */
for (i = 0; i < priv->pkgnames->len; i++) {
tmp = g_ptr_array_index (priv->pkgnames, i);
- as_app_add_pkgname (app, tmp, -1);
+ as_app_add_pkgname (app, tmp);
}
/* bundles */
@@ -2741,31 +2697,31 @@ as_app_subsume_private (AsApp *app, AsApp *donor, AsAppSubsumeFlags flags)
/* kudos */
for (i = 0; i < priv->kudos->len; i++) {
tmp = g_ptr_array_index (priv->kudos, i);
- as_app_add_kudo (app, tmp, -1);
+ as_app_add_kudo (app, tmp);
}
/* categories */
for (i = 0; i < priv->categories->len; i++) {
tmp = g_ptr_array_index (priv->categories, i);
- as_app_add_category (app, tmp, -1);
+ as_app_add_category (app, tmp);
}
/* permissions */
for (i = 0; i < priv->permissions->len; i++) {
tmp = g_ptr_array_index (priv->permissions, i);
- as_app_add_permission (app, tmp, -1);
+ as_app_add_permission (app, tmp);
}
/* extends */
for (i = 0; i < priv->extends->len; i++) {
tmp = g_ptr_array_index (priv->extends, i);
- as_app_add_extends (app, tmp, -1);
+ as_app_add_extends (app, tmp);
}
/* compulsory_for_desktops */
for (i = 0; i < priv->compulsory_for_desktops->len; i++) {
tmp = g_ptr_array_index (priv->compulsory_for_desktops, i);
- as_app_add_compulsory_for_desktop (app, tmp, -1);
+ as_app_add_compulsory_for_desktop (app, tmp);
}
/* screenshots */
@@ -2783,7 +2739,7 @@ as_app_subsume_private (AsApp *app, AsApp *donor, AsAppSubsumeFlags flags)
/* mimetypes */
for (i = 0; i < priv->mimetypes->len; i++) {
tmp = g_ptr_array_index (priv->mimetypes, i);
- as_app_add_mimetype (app, tmp, -1);
+ as_app_add_mimetype (app, tmp);
}
/* do not subsume all properties */
@@ -2800,7 +2756,7 @@ as_app_subsume_private (AsApp *app, AsApp *donor, AsAppSubsumeFlags flags)
continue;
}
percentage = GPOINTER_TO_INT (g_hash_table_lookup (priv->languages, key));
- as_app_add_language (app, percentage, key, -1);
+ as_app_add_language (app, percentage, key);
}
/* dictionaries */
@@ -2818,7 +2774,7 @@ as_app_subsume_private (AsApp *app, AsApp *donor, AsAppSubsumeFlags flags)
/* source_pkgname */
if (priv->source_pkgname != NULL)
- as_app_set_source_pkgname (app, priv->source_pkgname, -1);
+ as_app_set_source_pkgname (app, priv->source_pkgname);
/* origin */
if (priv->origin != NULL)
@@ -2826,13 +2782,13 @@ as_app_subsume_private (AsApp *app, AsApp *donor, AsAppSubsumeFlags flags)
/* licenses */
if (priv->project_license != NULL)
- as_app_set_project_license (app, priv->project_license, -1);
+ as_app_set_project_license (app, priv->project_license);
if (priv->metadata_license != NULL)
- as_app_set_metadata_license (app, priv->metadata_license, -1);
+ as_app_set_metadata_license (app, priv->metadata_license);
/* project_group */
if (priv->project_group != NULL)
- as_app_set_project_group (app, priv->project_group, -1);
+ as_app_set_project_group (app, priv->project_group);
}
/**
@@ -3045,7 +3001,7 @@ as_app_node_insert_keywords (AsApp *app, GNode *parent, AsNodeContext *ctx)
if (g_strcmp0 (lang, "C") != 0) {
as_node_add_attribute (node_tmp,
"xml:lang",
- lang, -1);
+ lang);
}
}
}
@@ -3097,8 +3053,7 @@ as_app_node_insert (AsApp *app, GNode *parent, AsNodeContext *ctx)
if (priv->id_kind != AS_ID_KIND_UNKNOWN) {
as_node_add_attribute (node_app,
"type",
- as_id_kind_to_string (priv->id_kind),
- -1);
+ as_id_kind_to_string (priv->id_kind));
}
} else {
node_app = as_node_insert (parent, "application", NULL, 0, NULL);
@@ -3109,19 +3064,12 @@ as_app_node_insert (AsApp *app, GNode *parent, AsNodeContext *ctx)
if (api_version < 0.6 && priv->id_kind != AS_ID_KIND_UNKNOWN) {
as_node_add_attribute (node_tmp,
"type",
- as_id_kind_to_string (priv->id_kind),
- -1);
+ as_id_kind_to_string (priv->id_kind));
}
/* <priority> */
- if (priv->priority != 0) {
- gchar prio[6];
- g_snprintf (prio, sizeof (prio), "%i", priv->priority);
- if (api_version >= 0.61) {
- as_node_add_attribute (node_app,
- "priority", prio, -1);
- }
- }
+ if (priv->priority != 0 && api_version >= 0.61)
+ as_node_add_attribute_as_int (node_app, "priority", priv->priority);
/* this looks crazy, but priority was initially implemented on
* the <applications> node and was designed to be per-file */
@@ -3401,7 +3349,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, AsAppParseFlags flags,
tmp = as_node_get_attribute (n, "type");
if (tmp != NULL)
as_app_set_id_kind (app, as_id_kind_from_string (tmp));
- as_app_set_id (app, as_node_get_data (n), -1);
+ as_app_set_id (app, as_node_get_data (n));
break;
/* <priority> */
@@ -3489,15 +3437,14 @@ as_app_node_parse_child (AsApp *app, GNode *n, AsAppParseFlags flags,
priv->problems |= AS_APP_PROBLEM_PREFORMATTED_DESCRIPTION;
as_app_set_description (app,
as_node_get_attribute (n, "xml:lang"),
- as_node_get_data (n),
- -1);
+ as_node_get_data (n));
} else {
_cleanup_string_free_ GString *xml = NULL;
xml = as_node_to_xml (n->children,
AS_NODE_TO_XML_FLAG_INCLUDE_SIBLINGS);
as_app_set_description (app,
as_node_get_attribute (n, "xml:lang"),
- xml->str, xml->len);
+ xml->str);
}
break;
@@ -3554,7 +3501,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, AsAppParseFlags flags,
taken = as_app_parse_locale (as_node_get_attribute (c, "xml:lang"));
if (taken == NULL)
continue;
- as_app_add_keyword (app, taken, tmp, -1);
+ as_app_add_keyword (app, taken, tmp);
g_free (taken);
}
break;
@@ -3631,17 +3578,17 @@ as_app_node_parse_child (AsApp *app, GNode *n, AsAppParseFlags flags,
priv->problems |= AS_APP_PROBLEM_TRANSLATED_LICENSE;
break;
}
- as_app_set_metadata_license (app, as_node_get_data (n), -1);
+ as_app_set_metadata_license (app, as_node_get_data (n));
break;
/* <source_pkgname> */
case AS_TAG_SOURCE_PKGNAME:
- as_app_set_source_pkgname (app, as_node_get_data (n), -1);
+ as_app_set_source_pkgname (app, as_node_get_data (n));
break;
/* <update_contact> */
case AS_TAG_UPDATE_CONTACT:
- as_app_set_update_contact (app, as_node_get_data (n), -1);
+ as_app_set_update_contact (app, as_node_get_data (n));
break;
/* <url> */
@@ -3649,7 +3596,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, AsAppParseFlags flags,
tmp = as_node_get_attribute (n, "type");
as_app_add_url (app,
as_url_kind_from_string (tmp),
- as_node_get_data (n), -1);
+ as_node_get_data (n));
break;
/* <project_group> */
@@ -3731,7 +3678,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, AsAppParseFlags flags,
if (percent == G_MAXINT)
percent = 0;
as_app_add_language (app, percent,
- as_node_get_data (c), -1);
+ as_node_get_data (c));
}
break;
@@ -3791,7 +3738,7 @@ as_app_check_for_hidpi_icons (AsApp *app)
/* create the HiDPI version */
icon_hidpi = as_icon_new ();
as_icon_set_prefix (icon_hidpi, priv->icon_path);
- as_icon_set_name (icon_hidpi, as_icon_get_name (icon_tmp), -1);
+ as_icon_set_name (icon_hidpi, as_icon_get_name (icon_tmp));
as_icon_set_width (icon_hidpi, 128);
as_icon_set_height (icon_hidpi, 128);
as_app_add_icon (app, icon_hidpi);
@@ -3898,7 +3845,7 @@ as_app_node_parse_dep11_icons (AsApp *app, GNode *node,
ic = as_icon_new ();
as_icon_set_kind (ic, AS_ICON_KIND_CACHED);
as_icon_set_prefix (ic, priv->icon_path);
- as_icon_set_name (ic, size_name, -1);
+ as_icon_set_name (ic, size_name);
as_icon_set_width (ic, size);
as_icon_set_height (ic, size);
as_app_add_icon (app, ic);
@@ -3931,7 +3878,7 @@ as_app_node_parse_dep11 (AsApp *app, GNode *node,
for (n = node->children; n != NULL; n = n->next) {
tmp = as_yaml_node_get_key (n);
if (g_strcmp0 (tmp, "ID") == 0) {
- as_app_set_id (app, as_yaml_node_get_value (n), -1);
+ as_app_set_id (app, as_yaml_node_get_value (n));
continue;
}
if (g_strcmp0 (tmp, "Type") == 0) {
@@ -3943,14 +3890,14 @@ as_app_node_parse_dep11 (AsApp *app, GNode *node,
}
if (g_strcmp0 (tmp, "Packages") == 0) {
for (c = n->children; c != NULL; c = c->next)
- as_app_add_pkgname (app, as_yaml_node_get_key (c), -1);
+ as_app_add_pkgname (app, as_yaml_node_get_key (c));
continue;
}
if (g_strcmp0 (tmp, "Name") == 0) {
for (c = n->children; c != NULL; c = c->next) {
as_app_set_name (app,
as_yaml_node_get_key (c),
- as_yaml_node_get_value (c), -1);
+ as_yaml_node_get_value (c));
}
continue;
}
@@ -3958,7 +3905,7 @@ as_app_node_parse_dep11 (AsApp *app, GNode *node,
for (c = n->children; c != NULL; c = c->next) {
as_app_set_comment (app,
as_yaml_node_get_key (c),
- as_yaml_node_get_value (c), -1);
+ as_yaml_node_get_value (c));
}
continue;
}
@@ -3966,7 +3913,7 @@ as_app_node_parse_dep11 (AsApp *app, GNode *node,
for (c = n->children; c != NULL; c = c->next) {
as_app_set_description (app,
as_yaml_node_get_key (c),
- as_yaml_node_get_value (c), -1);
+ as_yaml_node_get_value (c));
}
continue;
}
@@ -3977,14 +3924,14 @@ as_app_node_parse_dep11 (AsApp *app, GNode *node,
continue;
as_app_add_keyword (app,
as_yaml_node_get_key (c),
- as_yaml_node_get_key (c2), -1);
+ as_yaml_node_get_key (c2));
}
}
continue;
}
if (g_strcmp0 (tmp, "Categories") == 0) {
for (c = n->children; c != NULL; c = c->next)
- as_app_add_category (app, as_yaml_node_get_key (c), -1);
+ as_app_add_category (app, as_yaml_node_get_key (c));
continue;
}
if (g_strcmp0 (tmp, "Icon") == 0) {
@@ -4009,8 +3956,7 @@ as_app_node_parse_dep11 (AsApp *app, GNode *node,
if (g_strcmp0 (as_yaml_node_get_key (c), "homepage") == 0) {
as_app_add_url (app,
AS_URL_KIND_HOMEPAGE,
- as_yaml_node_get_value (c),
- -1);
+ as_yaml_node_get_value (c));
continue;
}
}
@@ -4021,8 +3967,7 @@ as_app_node_parse_dep11 (AsApp *app, GNode *node,
if (g_strcmp0 (as_yaml_node_get_key (c), "mimetypes") == 0) {
for (c2 = c->children; c2 != NULL; c2 = c2->next) {
as_app_add_mimetype (app,
- as_yaml_node_get_key (c2),
- -1);
+ as_yaml_node_get_key (c2));
}
continue;
} else {
diff --git a/libappstream-glib/as-app.h b/libappstream-glib/as-app.h
index c641dac..4ee5d48 100644
--- a/libappstream-glib/as-app.h
+++ b/libappstream-glib/as-app.h
@@ -284,8 +284,7 @@ gboolean as_app_has_permission (AsApp *app,
/* setters */
void as_app_set_id (AsApp *app,
- const gchar *id,
- gssize id_len);
+ const gchar *id);
void as_app_set_id_kind (AsApp *app,
AsIdKind id_kind);
void as_app_set_source_kind (AsApp *app,
@@ -297,67 +296,50 @@ void as_app_set_trust_flags (AsApp *app,
void as_app_set_origin (AsApp *app,
const gchar *origin);
void as_app_set_project_group (AsApp *app,
- const gchar *project_group,
- gssize project_group_len);
+ const gchar *project_group);
void as_app_set_project_license (AsApp *app,
- const gchar *project_license,
- gssize project_license_len);
+ const gchar *project_license);
void as_app_set_metadata_license (AsApp *app,
- const gchar *metadata_license,
- gssize metadata_license_len);
+ const gchar *metadata_license);
void as_app_set_source_pkgname (AsApp *app,
- const gchar *source_pkgname,
- gssize source_pkgname_len);
+ const gchar *source_pkgname);
void as_app_set_update_contact (AsApp *app,
- const gchar *update_contact,
- gssize update_contact_len);
+ const gchar *update_contact);
void as_app_set_icon_path (AsApp *app,
- const gchar *icon_path,
- gssize icon_path_len);
+ const gchar *icon_path);
void as_app_set_name (AsApp *app,
const gchar *locale,
- const gchar *name,
- gssize name_len);
+ const gchar *name);
void as_app_set_comment (AsApp *app,
const gchar *locale,
- const gchar *comment,
- gssize comment_len);
+ const gchar *comment);
void as_app_set_developer_name (AsApp *app,
const gchar *locale,
- const gchar *developer_name,
- gssize developer_name_len);
+ const gchar *developer_name);
void as_app_set_description (AsApp *app,
const gchar *locale,
- const gchar *description,
- gssize description_len);
+ const gchar *description);
void as_app_set_source_file (AsApp *app,
const gchar *source_file);
void as_app_set_priority (AsApp *app,
gint priority);
void as_app_add_category (AsApp *app,
- const gchar *category,
- gssize category_len);
+ const gchar *category);
void as_app_add_keyword (AsApp *app,
const gchar *locale,
- const gchar *keyword,
- gssize keyword_len);
+ const gchar *keyword);
void as_app_add_kudo (AsApp *app,
- const gchar *kudo,
- gssize kudo_len);
+ const gchar *kudo);
void as_app_add_kudo_kind (AsApp *app,
AsKudoKind kudo_kind);
void as_app_add_permission (AsApp *app,
- const gchar *permission,
- gssize permission_len);
+ const gchar *permission);
void as_app_add_mimetype (AsApp *app,
- const gchar *mimetype,
- gssize mimetype_len);
+ const gchar *mimetype);
void as_app_add_pkgname (AsApp *app,
- const gchar *pkgname,
- gssize pkgname_len);
+ const gchar *pkgname);
void as_app_add_arch (AsApp *app,
- const gchar *arch,
- gssize arch_len);
+ const gchar *arch);
void as_app_add_release (AsApp *app,
AsRelease *release);
void as_app_add_provide (AsApp *app,
@@ -370,26 +352,21 @@ void as_app_add_bundle (AsApp *app,
AsBundle *bundle);
void as_app_add_language (AsApp *app,
gint percentage,
- const gchar *locale,
- gssize locale_len);
+ const gchar *locale);
void as_app_add_compulsory_for_desktop (AsApp *app,
- const gchar *compulsory_for_desktop,
- gssize compulsory_for_desktop_len);
+ const gchar *compulsory_for_desktop);
void as_app_add_url (AsApp *app,
AsUrlKind url_kind,
- const gchar *url,
- gssize url_len);
+ const gchar *url);
void as_app_add_metadata (AsApp *app,
const gchar *key,
- const gchar *value,
- gssize value_len);
+ const gchar *value);
void as_app_remove_metadata (AsApp *app,
const gchar *key);
void as_app_add_addon (AsApp *app,
AsApp *addon);
void as_app_add_extends (AsApp *app,
- const gchar *extends,
- gssize extends_len);
+ const gchar *extends);
/* object methods */
GPtrArray *as_app_validate (AsApp *app,
diff --git a/libappstream-glib/as-bundle.c b/libappstream-glib/as-bundle.c
index fd1e69c..4a02975 100644
--- a/libappstream-glib/as-bundle.c
+++ b/libappstream-glib/as-bundle.c
@@ -162,18 +162,17 @@ as_bundle_get_kind (AsBundle *bundle)
* as_bundle_set_id:
* @bundle: a #AsBundle instance.
* @id: the URL.
- * @id_len: the size of @id, or -1 if %NULL-terminated.
*
* Sets the ID for this bundle.
*
* Since: 0.3.5
**/
void
-as_bundle_set_id (AsBundle *bundle, const gchar *id, gssize id_len)
+as_bundle_set_id (AsBundle *bundle, const gchar *id)
{
AsBundlePrivate *priv = GET_PRIVATE (bundle);
g_free (priv->id);
- priv->id = as_strndup (id, id_len);
+ priv->id = g_strdup (id);
}
/**
@@ -271,7 +270,7 @@ as_bundle_node_parse_dep11 (AsBundle *im, GNode *node,
for (n = node->children; n != NULL; n = n->next) {
tmp = as_yaml_node_get_key (n);
if (g_strcmp0 (tmp, "id") == 0)
- as_bundle_set_id (im, as_yaml_node_get_value (n), -1);
+ as_bundle_set_id (im, as_yaml_node_get_value (n));
}
return TRUE;
}
diff --git a/libappstream-glib/as-bundle.h b/libappstream-glib/as-bundle.h
index 7308eca..0a000e2 100644
--- a/libappstream-glib/as-bundle.h
+++ b/libappstream-glib/as-bundle.h
@@ -88,8 +88,7 @@ AsBundleKind as_bundle_get_kind (AsBundle *bundle);
/* setters */
void as_bundle_set_id (AsBundle *bundle,
- const gchar *id,
- gssize id_len);
+ const gchar *id);
void as_bundle_set_kind (AsBundle *bundle,
AsBundleKind kind);
diff --git a/libappstream-glib/as-checksum.c b/libappstream-glib/as-checksum.c
index 7cd400a..52215ea 100644
--- a/libappstream-glib/as-checksum.c
+++ b/libappstream-glib/as-checksum.c
@@ -317,10 +317,10 @@ as_checksum_node_insert (AsChecksum *checksum, GNode *parent, AsNodeContext *ctx
NULL);
if (priv->target != AS_CHECKSUM_TARGET_UNKNOWN) {
as_node_add_attribute (n, "target",
- as_checksum_target_to_string (priv->target), -1);
+ as_checksum_target_to_string (priv->target));
}
if (priv->filename != NULL)
- as_node_add_attribute (n, "filename", priv->filename, -1);
+ as_node_add_attribute (n, "filename", priv->filename);
return n;
}
diff --git a/libappstream-glib/as-icon.c b/libappstream-glib/as-icon.c
index 41dd8d8..83586e2 100644
--- a/libappstream-glib/as-icon.c
+++ b/libappstream-glib/as-icon.c
@@ -329,18 +329,17 @@ as_icon_get_data (AsIcon *icon)
* as_icon_set_name:
* @icon: a #AsIcon instance.
* @name: the icon name, e.g. "gimp.png"
- * @name_len: the size of @name, or -1 if %NULL-terminated.
*
* Sets the basename to use for the icon.
*
* Since: 0.3.1
**/
void
-as_icon_set_name (AsIcon *icon, const gchar *name, gssize name_len)
+as_icon_set_name (AsIcon *icon, const gchar *name)
{
AsIconPrivate *priv = GET_PRIVATE (icon);
g_free (priv->name);
- priv->name = as_strndup (name, name_len);
+ priv->name = g_strdup (name);
}
/**
@@ -664,11 +663,11 @@ as_icon_node_parse (AsIcon *icon, GNode *node,
/* store the name without any prefix */
if (g_strstr_len (tmp, -1, "/") == NULL) {
- as_icon_set_name (icon, tmp, -1);
+ as_icon_set_name (icon, tmp);
} else {
_cleanup_free_ gchar *basename = NULL;
basename = g_path_get_basename (tmp);
- as_icon_set_name (icon, basename, -1);
+ as_icon_set_name (icon, basename);
}
/* width is optional, assume 64px if missing */
@@ -720,7 +719,7 @@ as_icon_node_parse_dep11 (AsIcon *im, GNode *node,
{
if (g_strcmp0 (as_yaml_node_get_key (node), "cached") != 0)
return TRUE;
- as_icon_set_name (im, as_yaml_node_get_value (node), -1);
+ as_icon_set_name (im, as_yaml_node_get_value (node));
as_icon_set_kind (im, AS_ICON_KIND_CACHED);
return TRUE;
}
diff --git a/libappstream-glib/as-icon.h b/libappstream-glib/as-icon.h
index 6b20b51..e842cea 100644
--- a/libappstream-glib/as-icon.h
+++ b/libappstream-glib/as-icon.h
@@ -130,8 +130,7 @@ GdkPixbuf *as_icon_get_pixbuf (AsIcon *icon);
/* setters */
void as_icon_set_name (AsIcon *icon,
- const gchar *name,
- gssize name_len);
+ const gchar *name);
void as_icon_set_url (AsIcon *icon,
const gchar *url);
void as_icon_set_filename (AsIcon *icon,
diff --git a/libappstream-glib/as-image.c b/libappstream-glib/as-image.c
index 401b5f5..89ca8db 100644
--- a/libappstream-glib/as-image.c
+++ b/libappstream-glib/as-image.c
@@ -256,18 +256,17 @@ as_image_get_pixbuf (AsImage *image)
* as_image_set_url:
* @image: a #AsImage instance.
* @url: the URL.
- * @url_len: the size of @url, or -1 if %NULL-terminated.
*
* Sets the fully-qualified mirror URL to use for the image.
*
* Since: 0.1.0
**/
void
-as_image_set_url (AsImage *image, const gchar *url, gssize url_len)
+as_image_set_url (AsImage *image, const gchar *url)
{
AsImagePrivate *priv = GET_PRIVATE (image);
g_free (priv->url);
- priv->url = as_strndup (url, url_len);
+ priv->url = g_strdup (url);
}
/**
@@ -473,7 +472,7 @@ as_image_node_parse_dep11 (AsImage *im, GNode *node,
else if (g_strcmp0 (tmp, "width") == 0)
as_image_set_width (im, as_yaml_node_get_value_as_int (n));
else if (g_strcmp0 (tmp, "url") == 0)
- as_image_set_url (im, as_yaml_node_get_value (n), -1);
+ as_image_set_url (im, as_yaml_node_get_value (n));
}
return TRUE;
}
@@ -806,3 +805,4 @@ as_image_new (void)
image = g_object_new (AS_TYPE_IMAGE, NULL);
return AS_IMAGE (image);
}
+
diff --git a/libappstream-glib/as-image.h b/libappstream-glib/as-image.h
index d9bc36c..498cab1 100644
--- a/libappstream-glib/as-image.h
+++ b/libappstream-glib/as-image.h
@@ -140,8 +140,7 @@ GdkPixbuf *as_image_get_pixbuf (AsImage *image);
/* setters */
void as_image_set_url (AsImage *image,
- const gchar *url,
- gssize url_len);
+ const gchar *url);
void as_image_set_basename (AsImage *image,
const gchar *basename);
void as_image_set_width (AsImage *image,
diff --git a/libappstream-glib/as-node.c b/libappstream-glib/as-node.c
index f8073b9..954af0d 100644
--- a/libappstream-glib/as-node.c
+++ b/libappstream-glib/as-node.c
@@ -437,7 +437,6 @@ as_node_to_xml_string (GString *xml,
/**
* as_node_reflow_text:
* @text: XML text data
- * @text_len: length of @text
*
* Converts pretty-formatted source text into a format suitable for AppStream.
* This might include joining paragraphs, supressing newlines or doing other
@@ -560,7 +559,7 @@ as_node_start_element_cb (GMarkupParseContext *context,
/* transfer the ownership of the comment to the new child */
tmp = as_node_take_attribute (helper->current, "@comment-tmp");
if (tmp != NULL) {
- as_node_add_attribute (current, "@comment", tmp, -1);
+ as_node_add_attribute (current, "@comment", tmp);
g_free (tmp);
}
@@ -667,11 +666,11 @@ as_node_passthrough_cb (GMarkupParseContext *context,
/* append together comments */
existing = as_node_get_attribute (helper->current, "@comment-tmp");
if (existing == NULL) {
- as_node_add_attribute (helper->current, "@comment-tmp", tmp, -1);
+ as_node_add_attribute (helper->current, "@comment-tmp", tmp);
} else {
_cleanup_free_ gchar *join = NULL;
join = g_strdup_printf ("%s<&>%s", existing, tmp);
- as_node_add_attribute (helper->current, "@comment-tmp", join, -1);
+ as_node_add_attribute (helper->current, "@comment-tmp", join);
}
}
@@ -1044,7 +1043,6 @@ as_node_get_tag (const GNode *node)
* as_node_set_data: (skip)
* @node: a #GNode
* @cdata: new data
- * @cdata_len: length of @data, or -1 if NULL terminated
* @insert_flags: any %AsNodeInsertFlags.
*
* Sets new data on a node.
@@ -1054,7 +1052,6 @@ as_node_get_tag (const GNode *node)
void
as_node_set_data (GNode *node,
const gchar *cdata,
- gssize cdata_len,
AsNodeInsertFlags insert_flags)
{
AsNodeData *data;
@@ -1066,7 +1063,7 @@ as_node_set_data (GNode *node,
data = (AsNodeData *) node->data;
g_free (data->cdata);
- data->cdata = as_strndup (cdata, cdata_len);
+ data->cdata = g_strdup (cdata);
data->cdata_escaped = insert_flags & AS_NODE_INSERT_FLAG_PRE_ESCAPED;
}
@@ -1074,16 +1071,15 @@ as_node_set_data (GNode *node,
* as_node_set_comment: (skip)
* @node: a #GNode
* @comment: new comment
- * @comment_len: length of @data, or -1 if NULL terminated
*
* Sets new comment for the node.
*
* Since: 0.1.6
**/
void
-as_node_set_comment (GNode *node, const gchar *comment, gssize comment_len)
+as_node_set_comment (GNode *node, const gchar *comment)
{
- return as_node_add_attribute (node, "@comment", comment, comment_len);
+ return as_node_add_attribute (node, "@comment", comment);
}
/**
@@ -1232,7 +1228,6 @@ as_node_remove_attribute (GNode *node, const gchar *key)
* @node: a #GNode
* @key: the attribute key
* @value: new data
- * @value_len: length of @data, or -1 if NULL terminated
*
* Adds a new attribute to a node.
*
@@ -1241,8 +1236,7 @@ as_node_remove_attribute (GNode *node, const gchar *key)
void
as_node_add_attribute (GNode *node,
const gchar *key,
- const gchar *value,
- gssize value_len)
+ const gchar *value)
{
AsNodeData *data;
AsNodeAttr *attr;
@@ -1254,7 +1248,7 @@ as_node_add_attribute (GNode *node,
return;
data = (AsNodeData *) node->data;
attr = as_node_attr_insert (data, key, NULL);
- attr->value = as_strndup (value, value_len);
+ attr->value = g_strdup (value);
}
/**
@@ -1271,7 +1265,7 @@ void
as_node_add_attribute_as_int (GNode *node, const gchar *key, gint value)
{
_cleanup_free_ gchar *tmp = g_strdup_printf ("%i", value);
- as_node_add_attribute (node, key, tmp, -1);
+ as_node_add_attribute (node, key, tmp);
}
/**
@@ -1463,7 +1457,7 @@ as_node_insert_localized (GNode *parent,
data = g_slice_new0 (AsNodeData);
as_node_data_set_name (data, name, insert_flags);
if (insert_flags & AS_NODE_INSERT_FLAG_NO_MARKUP) {
- data->cdata = as_markup_convert_simple (value_c, -1, NULL);
+ data->cdata = as_markup_convert_simple (value_c, NULL);
data->cdata_escaped = FALSE;
} else {
data->cdata = g_strdup (value_c);
@@ -1486,7 +1480,7 @@ as_node_insert_localized (GNode *parent,
as_node_attr_insert (data, "xml:lang", key);
as_node_data_set_name (data, name, insert_flags);
if (insert_flags & AS_NODE_INSERT_FLAG_NO_MARKUP) {
- data->cdata = as_markup_convert_simple (value, -1, NULL);
+ data->cdata = as_markup_convert_simple (value, NULL);
data->cdata_escaped = FALSE;
} else {
data->cdata = g_strdup (value);
diff --git a/libappstream-glib/as-node.h b/libappstream-glib/as-node.h
index 8690f8e..e2d04be 100644
--- a/libappstream-glib/as-node.h
+++ b/libappstream-glib/as-node.h
@@ -137,15 +137,12 @@ void as_node_set_name (GNode *node,
const gchar *name);
void as_node_set_data (GNode *node,
const gchar *cdata,
- gssize cdata_len,
AsNodeInsertFlags insert_flags);
void as_node_set_comment (GNode *node,
- const gchar *comment,
- gssize comment_len);
+ const gchar *comment);
void as_node_add_attribute (GNode *node,
const gchar *key,
- const gchar *value,
- gssize value_len);
+ const gchar *value);
void as_node_add_attribute_as_int (GNode *node,
const gchar *key,
gint value);
diff --git a/libappstream-glib/as-provide.c b/libappstream-glib/as-provide.c
index 9fa9a91..306df03 100644
--- a/libappstream-glib/as-provide.c
+++ b/libappstream-glib/as-provide.c
@@ -188,18 +188,17 @@ as_provide_get_kind (AsProvide *provide)
* as_provide_set_value:
* @provide: a #AsProvide instance.
* @value: the URL.
- * @value_len: the size of @value, or -1 if %NULL-terminated.
*
* Sets the fully-qualified mirror URL to use for the provide.
*
* Since: 0.1.6
**/
void
-as_provide_set_value (AsProvide *provide, const gchar *value, gssize value_len)
+as_provide_set_value (AsProvide *provide, const gchar *value)
{
AsProvidePrivate *priv = GET_PRIVATE (provide);
g_free (priv->value);
- priv->value = as_strndup (value, value_len);
+ priv->value = g_strdup (value);
}
/**
diff --git a/libappstream-glib/as-provide.h b/libappstream-glib/as-provide.h
index 1b3fc80..bbec6e4 100644
--- a/libappstream-glib/as-provide.h
+++ b/libappstream-glib/as-provide.h
@@ -102,8 +102,7 @@ AsProvideKind as_provide_get_kind (AsProvide *provide);
/* setters */
void as_provide_set_value (AsProvide *provide,
- const gchar *value,
- gssize value_len);
+ const gchar *value);
void as_provide_set_kind (AsProvide *provide,
AsProvideKind kind);
diff --git a/libappstream-glib/as-release.c b/libappstream-glib/as-release.c
index bafd388..05bbc50 100644
--- a/libappstream-glib/as-release.c
+++ b/libappstream-glib/as-release.c
@@ -316,44 +316,38 @@ as_release_get_description (AsRelease *release, const gchar *locale)
* as_release_set_version:
* @release: a #AsRelease instance.
* @version: the version string.
- * @version_len: the size of @version, or -1 if %NULL-terminated.
*
* Sets the release version.
*
* Since: 0.1.0
**/
void
-as_release_set_version (AsRelease *release,
- const gchar *version,
- gssize version_len)
+as_release_set_version (AsRelease *release, const gchar *version)
{
AsReleasePrivate *priv = GET_PRIVATE (release);
g_free (priv->version);
- priv->version = as_strndup (version, version_len);
+ priv->version = g_strdup (version);
}
/**
* as_release_add_location:
* @release: a #AsRelease instance.
* @location: the location string.
- * @location_len: the size of @location, or -1 if %NULL-terminated.
*
* Adds a release location.
*
* Since: 0.3.5
**/
void
-as_release_add_location (AsRelease *release,
- const gchar *location,
- gssize location_len)
+as_release_add_location (AsRelease *release, const gchar *location)
{
AsReleasePrivate *priv = GET_PRIVATE (release);
/* deduplicate */
- if (as_ptr_array_find_string (priv->locations, location, location_len))
+ if (as_ptr_array_find_string (priv->locations, location))
return;
- g_ptr_array_add (priv->locations, as_strndup (location, location_len));
+ g_ptr_array_add (priv->locations, g_strdup (location));
}
/**
@@ -377,7 +371,6 @@ as_release_add_checksum (AsRelease *release, AsChecksum *checksum)
* @release: a #AsRelease instance.
* @checksum_type: a #GChecksumType, e.g. %G_CHECKSUM_SHA1
* @checksum_value: the checksum string.
- * @checksum_len: the size of @checksum, or -1 if %NULL-terminated.
*
* Sets the release checksum.
*
@@ -386,8 +379,7 @@ as_release_add_checksum (AsRelease *release, AsChecksum *checksum)
void
as_release_set_checksum (AsRelease *release,
GChecksumType checksum_type,
- const gchar *checksum_value,
- gssize checksum_len)
+ const gchar *checksum_value)
{
AsChecksum *checksum;
AsReleasePrivate *priv = GET_PRIVATE (release);
@@ -424,7 +416,6 @@ as_release_set_timestamp (AsRelease *release, guint64 timestamp)
* @release: a #AsRelease instance.
* @locale: the locale, or %NULL. e.g. "en_GB"
* @description: the description markup.
- * @description_len: the size of @description, or -1 if %NULL-terminated.
*
* Sets the description release markup.
*
@@ -433,8 +424,7 @@ as_release_set_timestamp (AsRelease *release, guint64 timestamp)
void
as_release_set_description (AsRelease *release,
const gchar *locale,
- const gchar *description,
- gssize description_len)
+ const gchar *description)
{
AsReleasePrivate *priv = GET_PRIVATE (release);
if (locale == NULL)
@@ -447,7 +437,7 @@ as_release_set_description (AsRelease *release,
}
g_hash_table_insert (priv->descriptions,
g_strdup (locale),
- as_strndup (description, description_len));
+ g_strdup (description));
}
/**
@@ -476,10 +466,10 @@ as_release_node_insert (AsRelease *release, GNode *parent, AsNodeContext *ctx)
_cleanup_free_ gchar *timestamp_str = NULL;
timestamp_str = g_strdup_printf ("%" G_GUINT64_FORMAT,
priv->timestamp);
- as_node_add_attribute (n, "timestamp", timestamp_str, -1);
+ as_node_add_attribute (n, "timestamp", timestamp_str);
}
if (priv->version != NULL)
- as_node_add_attribute (n, "version", priv->version, -1);
+ as_node_add_attribute (n, "version", priv->version);
if (as_node_context_get_version (ctx) >= 0.9) {
const gchar *tmp;
guint i;
@@ -565,7 +555,7 @@ as_release_node_parse (AsRelease *release, GNode *node,
continue;
as_release_set_description (release,
as_node_get_attribute (n, "xml:lang"),
- xml->str, xml->len);
+ xml->str);
}
/* AppData: mutliple languages encoded in one <description> tag */
diff --git a/libappstream-glib/as-release.h b/libappstream-glib/as-release.h
index 2d7c75f..fddac39 100644
--- a/libappstream-glib/as-release.h
+++ b/libappstream-glib/as-release.h
@@ -82,20 +82,16 @@ GPtrArray *as_release_get_checksums (AsRelease *release);
/* setters */
void as_release_set_version (AsRelease *release,
- const gchar *version,
- gssize version_len);
+ const gchar *version);
void as_release_set_filename (AsRelease *release,
- const gchar *filename,
- gssize filename_len);
+ const gchar *filename);
void as_release_set_timestamp (AsRelease *release,
guint64 timestamp);
void as_release_set_description (AsRelease *release,
const gchar *locale,
- const gchar *description,
- gssize description_len);
+ const gchar *description);
void as_release_add_location (AsRelease *release,
- const gchar *location,
- gssize location_len);
+ const gchar *location);
void as_release_add_checksum (AsRelease *release,
AsChecksum *checksum);
@@ -103,8 +99,7 @@ void as_release_add_checksum (AsRelease *release,
G_DEPRECATED_FOR(as_checksum_set_value)
void as_release_set_checksum (AsRelease *release,
GChecksumType checksum_type,
- const gchar *checksum_value,
- gssize checksum_len);
+ const gchar *checksum_value);
G_DEPRECATED_FOR(as_checksum_get_value)
const gchar *as_release_get_checksum (AsRelease *release,
GChecksumType checksum_type);
diff --git a/libappstream-glib/as-screenshot.c b/libappstream-glib/as-screenshot.c
index 911f938..d2183c6 100644
--- a/libappstream-glib/as-screenshot.c
+++ b/libappstream-glib/as-screenshot.c
@@ -317,7 +317,6 @@ as_screenshot_add_image (AsScreenshot *screenshot, AsImage *image)
* @screenshot: a #AsScreenshot instance.
* @locale: the locale, or %NULL. e.g. "en_GB"
* @caption: the caption text.
- * @caption_len: the size of @caption, or -1 if %NULL-terminated.
*
* Sets a caption on the screenshot for a specific locale.
*
@@ -326,15 +325,14 @@ as_screenshot_add_image (AsScreenshot *screenshot, AsImage *image)
void
as_screenshot_set_caption (AsScreenshot *screenshot,
const gchar *locale,
- const gchar *caption,
- gsize caption_len)
+ const gchar *caption)
{
AsScreenshotPrivate *priv = GET_PRIVATE (screenshot);
if (locale == NULL)
locale = "C";
g_hash_table_insert (priv->captions,
g_strdup (locale),
- as_strndup (caption, caption_len));
+ g_strdup (caption));
}
/**
@@ -363,10 +361,8 @@ as_screenshot_node_insert (AsScreenshot *screenshot,
AS_NODE_INSERT_FLAG_NONE,
NULL);
if (priv->kind != AS_SCREENSHOT_KIND_NORMAL) {
- as_node_add_attribute (n,
- "type",
- as_screenshot_kind_to_string (priv->kind),
- -1);
+ as_node_add_attribute (n, "type",
+ as_screenshot_kind_to_string (priv->kind));
}
if (as_node_context_get_version (ctx) >= 0.41) {
as_node_insert_localized (n,
@@ -426,8 +422,7 @@ as_screenshot_node_parse (AsScreenshot *screenshot, GNode *node,
tmp = l->data;
as_screenshot_set_caption (screenshot,
tmp,
- g_hash_table_lookup (captions, tmp),
- -1);
+ g_hash_table_lookup (captions, tmp));
}
}
@@ -443,7 +438,7 @@ as_screenshot_node_parse (AsScreenshot *screenshot, GNode *node,
size = as_node_get_attribute_as_int (node, "height");
if (size != G_MAXINT)
as_image_set_height (image, size);
- as_image_set_url (image, tmp, -1);
+ as_image_set_url (image, tmp);
g_ptr_array_add (priv->images, image);
}
diff --git a/libappstream-glib/as-screenshot.h b/libappstream-glib/as-screenshot.h
index e3bcfc9..15f9f17 100644
--- a/libappstream-glib/as-screenshot.h
+++ b/libappstream-glib/as-screenshot.h
@@ -102,8 +102,7 @@ void as_screenshot_set_priority (AsScreenshot *screenshot,
gint priority);
void as_screenshot_set_caption (AsScreenshot *screenshot,
const gchar *locale,
- const gchar *caption,
- gsize caption_len);
+ const gchar *caption);
void as_screenshot_add_image (AsScreenshot *screenshot,
AsImage *image);
diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c
index aabe9c0..fcbad83 100644
--- a/libappstream-glib/as-self-test.c
+++ b/libappstream-glib/as-self-test.c
@@ -1285,7 +1285,7 @@ as_test_app_func (void)
g_assert_cmpint (as_icon_get_kind (ic), ==, AS_ICON_KIND_CACHED);
/* we can't extend ourself */
- as_app_add_extends (app, "org.gnome.Software.desktop", -1);
+ as_app_add_extends (app, "org.gnome.Software.desktop");
g_assert_cmpint (as_app_get_extends(app)->len, ==, 0);
/* back to node */
@@ -1300,7 +1300,7 @@ as_test_app_func (void)
as_node_unref (root);
/* test contact demunging */
- as_app_set_update_contact (app, "richard_at_hughsie_dot_co_dot_uk", -1);
+ as_app_set_update_contact (app, "richard_at_hughsie_dot_co_dot_uk");
g_assert_cmpstr (as_app_get_update_contact (app), ==, "richard@hughsie.co.uk");
}
@@ -1736,15 +1736,15 @@ as_test_app_validate_style_func (void)
_cleanup_ptrarray_unref_ GPtrArray *probs = NULL;
app = as_app_new ();
- as_app_add_url (app, AS_URL_KIND_UNKNOWN, "dave.com", -1);
- as_app_set_id (app, "dave.exe", -1);
+ as_app_add_url (app, AS_URL_KIND_UNKNOWN, "dave.com");
+ as_app_set_id (app, "dave.exe");
as_app_set_id_kind (app, AS_ID_KIND_DESKTOP);
as_app_set_source_kind (app, AS_APP_SOURCE_KIND_APPDATA);
- as_app_set_metadata_license (app, "BSD", -1);
- as_app_set_project_license (app, "GPL-2.0+", -1);
- as_app_set_name (app, "C", "Test app name that is very log indeed.", -1);
- as_app_set_comment (app, "C", "Awesome", -1);
- as_app_set_update_contact (app, "someone_who_cares@upstream_project.org", -1);
+ as_app_set_metadata_license (app, "BSD");
+ as_app_set_project_license (app, "GPL-2.0+");
+ as_app_set_name (app, "C", "Test app name that is very log indeed.");
+ as_app_set_comment (app, "C", "Awesome");
+ as_app_set_update_contact (app, "someone_who_cares@upstream_project.org");
probs = as_app_validate (app, AS_APP_VALIDATE_FLAG_NONE, &error);
g_assert_no_error (error);
@@ -2012,9 +2012,9 @@ as_test_node_func (void)
g_assert_cmpstr (as_node_get_attribute (n1, "version"), ==, NULL);
/* replace some node data */
- as_node_set_data (n2, "udev", -1, 0);
+ as_node_set_data (n2, "udev", 0);
g_assert_cmpstr (as_node_get_data (n2), ==, "udev");
- as_node_add_attribute (n2, "enabled", "true", -1);
+ as_node_add_attribute (n2, "enabled", "true");
g_assert_cmpstr (as_node_get_attribute (n2, "enabled"), ==, "true");
/* find the n2 node */
@@ -2346,23 +2346,23 @@ as_test_app_subsume_func (void)
donor = as_app_new ();
icon = as_icon_new ();
- as_icon_set_name (icon, "gtk-find", -1);
+ as_icon_set_name (icon, "gtk-find");
as_icon_set_kind (icon, AS_ICON_KIND_LOCAL);
as_app_add_icon (donor, icon);
as_app_set_state (donor, AS_APP_STATE_INSTALLED);
- as_app_add_pkgname (donor, "hal", -1);
- as_app_add_language (donor, -1, "en_GB", -1);
- as_app_add_metadata (donor, "donor", "true", -1);
- as_app_add_metadata (donor, "overwrite", "1111", -1);
- as_app_add_keyword (donor, "C", "klass", -1);
- as_app_add_keyword (donor, "pl", "klaski", -1);
+ as_app_add_pkgname (donor, "hal");
+ as_app_add_language (donor, -1, "en_GB");
+ as_app_add_metadata (donor, "donor", "true");
+ as_app_add_metadata (donor, "overwrite", "1111");
+ as_app_add_keyword (donor, "C", "klass");
+ as_app_add_keyword (donor, "pl", "klaski");
ss = as_screenshot_new ();
as_app_add_screenshot (donor, ss);
/* copy all useful properties */
app = as_app_new ();
- as_app_add_metadata (app, "overwrite", "2222", -1);
- as_app_add_metadata (app, "recipient", "true", -1);
+ as_app_add_metadata (app, "overwrite", "2222");
+ as_app_add_metadata (app, "recipient", "true");
as_app_subsume_full (app, donor, AS_APP_SUBSUME_FLAG_NO_OVERWRITE);
as_app_add_screenshot (app, ss);
@@ -2404,12 +2404,12 @@ as_test_app_search_func (void)
_cleanup_object_unref_ AsApp *app = NULL;
app = as_app_new ();
- as_app_set_name (app, NULL, "GNOME Software", -1);
- as_app_set_comment (app, NULL, "Install and remove software", -1);
- as_app_add_mimetype (app, "application/vnd.oasis.opendocument.text", -1);
- as_app_add_keyword (app, NULL, "awesome", -1);
- as_app_add_keyword (app, NULL, "c++", -1);
- as_app_add_keyword (app, NULL, "d-feet", -1);
+ as_app_set_name (app, NULL, "GNOME Software");
+ as_app_set_comment (app, NULL, "Install and remove software");
+ as_app_add_mimetype (app, "application/vnd.oasis.opendocument.text");
+ as_app_add_keyword (app, NULL, "awesome");
+ as_app_add_keyword (app, NULL, "c++");
+ as_app_add_keyword (app, NULL, "d-feet");
g_assert_cmpint (as_app_search_matches (app, "software"), ==, 80);
g_assert_cmpint (as_app_search_matches (app, "soft"), ==, 80);
@@ -2733,18 +2733,18 @@ as_test_store_merges_func (void)
store_desktop_appdata = as_store_new ();
app_desktop = as_app_new ();
- as_app_set_id (app_desktop, "gimp.desktop", -1);
+ as_app_set_id (app_desktop, "gimp.desktop");
as_app_set_source_kind (app_desktop, AS_APP_SOURCE_KIND_DESKTOP);
- as_app_set_name (app_desktop, NULL, "GIMP", -1);
- as_app_set_comment (app_desktop, NULL, "GNU Bla Bla", -1);
+ as_app_set_name (app_desktop, NULL, "GIMP");
+ as_app_set_comment (app_desktop, NULL, "GNU Bla Bla");
as_app_set_priority (app_desktop, -1);
as_app_set_state (app_desktop, AS_APP_STATE_INSTALLED);
app_appdata = as_app_new ();
- as_app_set_id (app_appdata, "gimp.desktop", -1);
+ as_app_set_id (app_appdata, "gimp.desktop");
as_app_set_source_kind (app_appdata, AS_APP_SOURCE_KIND_APPDATA);
- as_app_set_description (app_appdata, NULL, "<p>Gimp is awesome</p>", -1);
- as_app_add_pkgname (app_appdata, "gimp", -1);
+ as_app_set_description (app_appdata, NULL, "<p>Gimp is awesome</p>");
+ as_app_add_pkgname (app_appdata, "gimp");
as_app_set_priority (app_appdata, -1);
as_app_set_state (app_appdata, AS_APP_STATE_INSTALLED);
@@ -2764,12 +2764,12 @@ as_test_store_merges_func (void)
store_all = as_store_new ();
app_appinfo = as_app_new ();
- as_app_set_id (app_appinfo, "gimp.desktop", -1);
+ as_app_set_id (app_appinfo, "gimp.desktop");
as_app_set_source_kind (app_appinfo, AS_APP_SOURCE_KIND_APPSTREAM);
- as_app_set_name (app_appinfo, NULL, "GIMP", -1);
- as_app_set_comment (app_appinfo, NULL, "GNU Bla Bla", -1);
- as_app_set_description (app_appinfo, NULL, "<p>Gimp is Distro</p>", -1);
- as_app_add_pkgname (app_appinfo, "gimp", -1);
+ as_app_set_name (app_appinfo, NULL, "GIMP");
+ as_app_set_comment (app_appinfo, NULL, "GNU Bla Bla");
+ as_app_set_description (app_appinfo, NULL, "<p>Gimp is Distro</p>");
+ as_app_add_pkgname (app_appinfo, "gimp");
as_app_set_priority (app_appinfo, 0);
as_store_add_app (store_all, app_appinfo);
@@ -2801,28 +2801,28 @@ as_test_store_merges_local_func (void)
as_store_set_add_flags (store, AS_STORE_ADD_FLAG_PREFER_LOCAL);
app_desktop = as_app_new ();
- as_app_set_id (app_desktop, "gimp.desktop", -1);
+ as_app_set_id (app_desktop, "gimp.desktop");
as_app_set_source_kind (app_desktop, AS_APP_SOURCE_KIND_DESKTOP);
- as_app_set_name (app_desktop, NULL, "GIMP", -1);
- as_app_set_comment (app_desktop, NULL, "GNU Bla Bla", -1);
+ as_app_set_name (app_desktop, NULL, "GIMP");
+ as_app_set_comment (app_desktop, NULL, "GNU Bla Bla");
as_app_set_priority (app_desktop, -1);
as_app_set_state (app_desktop, AS_APP_STATE_INSTALLED);
app_appdata = as_app_new ();
- as_app_set_id (app_appdata, "gimp.desktop", -1);
+ as_app_set_id (app_appdata, "gimp.desktop");
as_app_set_source_kind (app_appdata, AS_APP_SOURCE_KIND_APPDATA);
- as_app_set_description (app_appdata, NULL, "<p>Gimp is awesome</p>", -1);
- as_app_add_pkgname (app_appdata, "gimp", -1);
+ as_app_set_description (app_appdata, NULL, "<p>Gimp is awesome</p>");
+ as_app_add_pkgname (app_appdata, "gimp");
as_app_set_priority (app_appdata, -1);
as_app_set_state (app_appdata, AS_APP_STATE_INSTALLED);
app_appinfo = as_app_new ();
- as_app_set_id (app_appinfo, "gimp.desktop", -1);
+ as_app_set_id (app_appinfo, "gimp.desktop");
as_app_set_source_kind (app_appinfo, AS_APP_SOURCE_KIND_APPSTREAM);
- as_app_set_name (app_appinfo, NULL, "GIMP", -1);
- as_app_set_comment (app_appinfo, NULL, "Fedora GNU Bla Bla", -1);
- as_app_set_description (app_appinfo, NULL, "<p>Gimp is Distro</p>", -1);
- as_app_add_pkgname (app_appinfo, "gimp", -1);
+ as_app_set_name (app_appinfo, NULL, "GIMP");
+ as_app_set_comment (app_appinfo, NULL, "Fedora GNU Bla Bla");
+ as_app_set_description (app_appinfo, NULL, "<p>Gimp is Distro</p>");
+ as_app_add_pkgname (app_appinfo, "gimp");
as_app_set_priority (app_appinfo, 0);
/* this is actually the install order we get at startup */
@@ -2853,7 +2853,7 @@ as_test_store_func (void)
g_assert_cmpfloat (as_store_get_api_version (store), <, 1.f);
g_assert_cmpfloat (as_store_get_api_version (store), >, 0.f);
app = as_app_new ();
- as_app_set_id (app, "gnome-software.desktop", -1);
+ as_app_set_id (app, "gnome-software.desktop");
as_app_set_id_kind (app, AS_ID_KIND_DESKTOP);
as_store_add_app (store, app);
g_object_unref (app);
@@ -2861,7 +2861,7 @@ as_test_store_func (void)
/* add and then remove another app */
app = as_app_new ();
- as_app_set_id (app, "junk.desktop", -1);
+ as_app_set_id (app, "junk.desktop");
as_app_set_id_kind (app, AS_ID_KIND_FONT);
as_store_add_app (store, app);
g_object_unref (app);
@@ -2880,7 +2880,7 @@ as_test_store_func (void)
/* add another app and ensure it's sorted */
app = as_app_new ();
- as_app_set_id (app, "aaa.desktop", -1);
+ as_app_set_id (app, "aaa.desktop");
as_app_set_id_kind (app, AS_ID_KIND_FONT);
as_store_add_app (store, app);
g_object_unref (app);
@@ -3411,17 +3411,6 @@ as_test_utils_func (void)
gchar **tokens;
GError *error = NULL;
- /* as_strndup */
- tmp = as_strndup ("dave", 2);
- g_assert_cmpstr (tmp, ==, "da");
- g_free (tmp);
- tmp = as_strndup ("dave", 4);
- g_assert_cmpstr (tmp, ==, "dave");
- g_free (tmp);
- tmp = as_strndup ("dave", -1);
- g_assert_cmpstr (tmp, ==, "dave");
- g_free (tmp);
-
/* as_utils_is_stock_icon_name */
g_assert (!as_utils_is_stock_icon_name (NULL));
g_assert (!as_utils_is_stock_icon_name (""));
@@ -3444,13 +3433,13 @@ as_test_utils_func (void)
g_assert (!as_utils_is_blacklisted_id ("gimp.desktop"));
/* valid description markup */
- tmp = as_markup_convert_simple ("<p>Hello world!</p>", -1, &error);
+ tmp = as_markup_convert_simple ("<p>Hello world!</p>", &error);
g_assert_no_error (error);
g_assert_cmpstr (tmp, ==, "Hello world!");
g_free (tmp);
tmp = as_markup_convert_simple ("<p>Hello world</p>"
"<ul><li>Item</li></ul>",
- -1, &error);
+ &error);
g_assert_no_error (error);
g_assert_cmpstr (tmp, ==, "Hello world\n • Item");
g_free (tmp);
@@ -3464,7 +3453,7 @@ as_test_utils_func (void)
" broken into multiple lines that only has one"
" initial bullet point."
"</li></ul>",
- -1, AS_MARKUP_CONVERT_FORMAT_MARKDOWN, &error);
+ AS_MARKUP_CONVERT_FORMAT_MARKDOWN, &error);
g_assert_no_error (error);
g_assert_cmpstr (tmp, ==,
"Hello world with a very long line that probably"
@@ -3476,14 +3465,13 @@ as_test_utils_func (void)
g_free (tmp);
/* valid description markup */
- tmp = as_markup_convert_simple ("bare text", -1, &error);
+ tmp = as_markup_convert_simple ("bare text", &error);
g_assert_no_error (error);
g_assert_cmpstr (tmp, ==, "bare text");
g_free (tmp);
/* invalid XML */
- tmp = as_markup_convert_simple ("<p>Hello world</dave>",
- -1, &error);
+ tmp = as_markup_convert_simple ("<p>Hello world</dave>", &error);
g_assert_error (error, AS_NODE_ERROR, AS_NODE_ERROR_FAILED);
g_assert_cmpstr (tmp, ==, NULL);
g_clear_error (&error);
@@ -3583,9 +3571,9 @@ as_test_store_metadata_index_func (void)
for (i = 0; i < repeats; i++) {
_cleanup_free_ gchar *id = g_strdup_printf ("app-%05i", i);
_cleanup_object_unref_ AsApp *app = as_app_new ();
- as_app_set_id (app, id, -1);
- as_app_add_metadata (app, "X-CacheID", "dave.i386", -1);
- as_app_add_metadata (app, "baz", "dave", -1);
+ as_app_set_id (app, id);
+ as_app_add_metadata (app, "X-CacheID", "dave.i386");
+ as_app_add_metadata (app, "baz", "dave");
as_store_add_app (store, app);
}
diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
index 52fb030..a10237d 100644
--- a/libappstream-glib/as-store.c
+++ b/libappstream-glib/as-store.c
@@ -875,7 +875,7 @@ as_store_from_root (AsStore *store,
app = as_app_new ();
if (icon_path != NULL)
- as_app_set_icon_path (app, icon_path, -1);
+ as_app_set_icon_path (app, icon_path);
as_app_set_source_kind (app, AS_APP_SOURCE_KIND_APPSTREAM);
if (!as_app_node_parse (app, n, ctx, &error_local)) {
g_set_error (error,
@@ -959,7 +959,7 @@ as_store_load_yaml_file (AsStore *store,
continue;
app = as_app_new ();
if (icon_path != NULL)
- as_app_set_icon_path (app, icon_path, -1);
+ as_app_set_icon_path (app, icon_path);
as_app_set_source_kind (app, AS_APP_SOURCE_KIND_APPSTREAM);
if (!as_app_node_parse_dep11 (app, app_n, ctx, error))
return FALSE;
@@ -1225,17 +1225,17 @@ as_store_to_xml (AsStore *store, AsNodeToXmlFlags flags)
/* set origin attribute */
if (priv->origin != NULL)
- as_node_add_attribute (node_apps, "origin", priv->origin, -1);
+ as_node_add_attribute (node_apps, "origin", priv->origin);
/* set origin attribute */
if (priv->builder_id != NULL)
- as_node_add_attribute (node_apps, "builder_id", priv->builder_id, -1);
+ as_node_add_attribute (node_apps, "builder_id", priv->builder_id);
/* set version attribute */
if (priv->api_version > 0.1f) {
g_ascii_formatd (version, sizeof (version),
"%.1f", priv->api_version);
- as_node_add_attribute (node_apps, "version", version, -1);
+ as_node_add_attribute (node_apps, "version", version);
}
/* sort by ID */
@@ -1723,7 +1723,7 @@ as_store_add_app_install_screenshot (AsApp *app)
/* screenshots.debian.net doesn't specify a size, so this is a guess */
im = as_image_new ();
- as_image_set_url (im, url, -1);
+ as_image_set_url (im, url);
as_image_set_width (im, 800);
as_image_set_height (im, 600);
@@ -1749,7 +1749,7 @@ as_store_load_app_install_file (AsStore *store,
_cleanup_object_unref_ AsApp *app = NULL;
app = as_app_new ();
- as_app_set_icon_path (app, path_icons, -1);
+ as_app_set_icon_path (app, path_icons);
if (!as_app_parse_file (app,
filename,
AS_APP_PARSE_FLAG_USE_HEURISTICS,
diff --git a/libappstream-glib/as-utils-private.h b/libappstream-glib/as-utils-private.h
index 4a54f7a..19294be 100644
--- a/libappstream-glib/as-utils-private.h
+++ b/libappstream-glib/as-utils-private.h
@@ -32,8 +32,6 @@
G_BEGIN_DECLS
-gchar *as_strndup (const gchar *text,
- gssize text_len);
const gchar *as_hash_lookup_by_locale (GHashTable *hash,
const gchar *locale);
void as_pixbuf_sharpen (GdkPixbuf *src,
@@ -43,8 +41,7 @@ void as_pixbuf_blur (GdkPixbuf *src,
gint radius,
gint iterations);
const gchar *as_ptr_array_find_string (GPtrArray *array,
- const gchar *value,
- gssize value_len);
+ const gchar *value);
G_END_DECLS
diff --git a/libappstream-glib/as-utils.c b/libappstream-glib/as-utils.c
index e2112c0..172b65c 100644
--- a/libappstream-glib/as-utils.c
+++ b/libappstream-glib/as-utils.c
@@ -65,25 +65,6 @@ as_utils_error_quark (void)
}
/**
- * as_strndup:
- * @text: the text to copy.
- * @text_len: the length of @text, or -1 if @text is NULL terminated.
- *
- * Copies a string, with an optional length argument.
- *
- * Returns: (transfer full): a newly allocated %NULL terminated string
- *
- * Since: 0.1.0
- **/
-gchar *
-as_strndup (const gchar *text, gssize text_len)
-{
- if (text_len < 0)
- return g_strdup (text);
- return g_strndup (text, text_len);
-}
-
-/**
* as_markup_strsplit_words:
* @text: the text to split.
* @line_len: the maximum length of the output line
@@ -197,7 +178,6 @@ as_markup_render_li (GString *str, AsMarkupConvertFormat format, const gchar *da
/**
* as_markup_convert:
* @markup: the text to copy.
- * @markup_len: the length of @markup, or -1 if @markup is NULL terminated.
* @format: the #AsMarkupConvertFormat, e.g. %AS_MARKUP_CONVERT_FORMAT_MARKDOWN
* @error: A #GError or %NULL
*
@@ -208,7 +188,7 @@ as_markup_render_li (GString *str, AsMarkupConvertFormat format, const gchar *da
* Since: 0.3.5
**/
gchar *
-as_markup_convert (const gchar *markup, gssize markup_len,
+as_markup_convert (const gchar *markup,
AsMarkupConvertFormat format, GError **error)
{
GNode *tmp;
@@ -219,19 +199,19 @@ as_markup_convert (const gchar *markup, gssize markup_len,
_cleanup_string_free_ GString *str = NULL;
/* is this actually markup */
- if (g_strstr_len (markup, markup_len, "<") == NULL)
- return as_strndup (markup, markup_len);
+ if (g_strstr_len (markup, -1, "<") == NULL)
+ return g_strdup (markup);
/* load */
root = as_node_from_xml (markup,
- markup_len,
+ -1,
AS_NODE_FROM_XML_FLAG_NONE,
error);
if (root == NULL)
return NULL;
/* format */
- str = g_string_sized_new (markup_len);
+ str = g_string_new ("");
for (tmp = root->children; tmp != NULL; tmp = tmp->next) {
tag = as_node_get_name (tmp);
@@ -275,7 +255,6 @@ as_markup_convert (const gchar *markup, gssize markup_len,
/**
* as_markup_convert_simple:
* @markup: the text to copy.
- * @markup_len: the length of @markup, or -1 if @markup is NULL terminated.
* @error: A #GError or %NULL
*
* Converts an XML description into a printable form.
@@ -285,11 +264,9 @@ as_markup_convert (const gchar *markup, gssize markup_len,
* Since: 0.1.0
**/
gchar *
-as_markup_convert_simple (const gchar *markup,
- gssize markup_len,
- GError **error)
+as_markup_convert_simple (const gchar *markup, GError **error)
{
- return as_markup_convert (markup, markup_len,
+ return as_markup_convert (markup,
AS_MARKUP_CONVERT_FORMAT_SIMPLE,
error);
}
@@ -1590,40 +1567,22 @@ as_utils_vercmp (const gchar *version_a, const gchar *version_b)
}
/**
- * as_strncmp:
- **/
-static gint
-as_strncmp (const gchar *value1, const gchar *value2, gssize value_len)
-{
- if (value_len < 0)
- return g_strcmp0 (value1, value2);
- if (value1 == NULL && value2 == NULL)
- return 0;
- if (value1 != NULL && value2 == NULL)
- return -1;
- if (value1 == NULL && value2 != NULL)
- return 1;
- return strncmp (value1, value2, value_len);
-}
-
-/**
* as_ptr_array_find_string:
* @array: gchar* array
* @value: string to find
- * @value_len: length of @value
*
* Finds a string in a pointer array.
*
* Returns: the const string, or %NULL if not found
**/
const gchar *
-as_ptr_array_find_string (GPtrArray *array, const gchar *value, gssize value_len)
+as_ptr_array_find_string (GPtrArray *array, const gchar *value)
{
const gchar *tmp;
guint i;
for (i = 0; i < array->len; i++) {
tmp = g_ptr_array_index (array, i);
- if (as_strncmp (tmp, value, value_len) == 0)
+ if (g_strcmp0 (tmp, value) == 0)
return tmp;
}
return NULL;
diff --git a/libappstream-glib/as-utils.h b/libappstream-glib/as-utils.h
index c551ca5..79cbab2 100644
--- a/libappstream-glib/as-utils.h
+++ b/libappstream-glib/as-utils.h
@@ -91,10 +91,8 @@ typedef enum {
} AsMarkupConvertFormat;
gchar *as_markup_convert_simple (const gchar *markup,
- gssize markup_len,
GError **error);
gchar *as_markup_convert (const gchar *markup,
- gssize markup_len,
AsMarkupConvertFormat format,
GError **error);
gchar **as_markup_strsplit_words (const gchar *text,