Merge branch 'issue#59' into 'master'

Fix issues flagged by static analyzers

Closes #59

See merge request GNOME/libsecret!73
This commit is contained in:
Daiki Ueno 2021-03-31 11:04:27 +00:00
commit 78223a0471
4 changed files with 6 additions and 9 deletions

View File

@ -1560,8 +1560,6 @@ secret_collection_search_sync (SecretCollection *self,
if (paths == NULL)
return NULL;
ret = TRUE;
want = 1;
if (flags & SECRET_SEARCH_ALL)
want = G_MAXINT;

View File

@ -1140,9 +1140,6 @@ secret_service_open (GType service_gtype,
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
g_return_if_fail (g_type_is_a (service_gtype, SECRET_TYPE_SERVICE));
if (service_bus_name == NULL)
service_bus_name = get_default_bus_name ();
g_async_initable_new_async (service_gtype, G_PRIORITY_DEFAULT,
cancellable, callback, user_data,
"flags", flags,
@ -1217,9 +1214,6 @@ secret_service_open_sync (GType service_gtype,
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
g_return_val_if_fail (g_type_is_a (service_gtype, SECRET_TYPE_SERVICE), NULL);
if (service_bus_name == NULL)
service_bus_name = get_default_bus_name ();
return g_initable_new (service_gtype, cancellable, error,
"flags", flags,
NULL);

View File

@ -727,6 +727,7 @@ test_store_sync (Test *test,
ret = secret_service_store_sync (test->service, &MOCK_SCHEMA, attributes, collection_path,
"New Item Label", value, NULL, &error);
g_assert_true (ret);
g_assert_no_error (error);
secret_value_unref (value);
g_hash_table_unref (attributes);
@ -776,10 +777,12 @@ test_store_replace (Test *test,
ret = secret_service_store_sync (test->service, &MOCK_SCHEMA, attributes, collection_path,
"New Item Label", value, NULL, &error);
g_assert_true (ret);
g_assert_no_error (error);
ret = secret_service_store_sync (test->service, &MOCK_SCHEMA, attributes, collection_path,
"Another Label", value, NULL, &error);
g_assert_true (ret);
g_assert_no_error (error);
secret_value_unref (value);
g_hash_table_unref (attributes);
@ -829,6 +832,7 @@ test_store_async (Test *test,
egg_test_wait ();
ret = secret_service_store_finish (test->service, result, &error);
g_assert_true (ret);
g_assert_no_error (error);
g_object_unref (result);
@ -877,6 +881,7 @@ test_store_no_default (Test *test,
ret = secret_service_store_sync (test->service, &MOCK_SCHEMA, attributes, SECRET_COLLECTION_DEFAULT,
"New Item Label", value, NULL, &error);
g_assert_true (ret);
g_assert_no_error (error);
secret_value_unref (value);
g_hash_table_unref (attributes);

View File

@ -380,7 +380,7 @@ on_retrieve_secret (GObject *source_object,
part = strrchr (path, '/');
if (part == NULL)
part = path;
g_print ("[%s]\n", path);
g_print ("[%s]\n", part);
} else {
g_print ("[no path]\n");
}