trivial: cleanup for many compilation warnings from clang

Signed-off-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
This commit is contained in:
Yehezkel Bernat 2017-08-30 12:09:34 +03:00 committed by Richard Hughes
parent 60eaca18fb
commit e43f7fb655
20 changed files with 8 additions and 39 deletions

View File

@ -34,7 +34,6 @@ dfu_tool_parse_xtea_key (const gchar *key, guint32 *keys, GError **error)
{ {
guint i; guint i;
gsize key_len; gsize key_len;
g_autofree gchar *key_pad = NULL;
/* too long */ /* too long */
key_len = strlen (key); key_len = strlen (key);

View File

@ -1719,7 +1719,6 @@ gboolean
dfu_device_attach (DfuDevice *device, GError **error) dfu_device_attach (DfuDevice *device, GError **error)
{ {
DfuDevicePrivate *priv = GET_PRIVATE (device); DfuDevicePrivate *priv = GET_PRIVATE (device);
g_autoptr(GError) error_local = NULL;
g_return_val_if_fail (DFU_IS_DEVICE (device), FALSE); g_return_val_if_fail (DFU_IS_DEVICE (device), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@ -1974,7 +1973,6 @@ dfu_device_download (DfuDevice *device,
GPtrArray *images; GPtrArray *images;
gboolean ret; gboolean ret;
guint i; guint i;
g_autoptr(GPtrArray) targets = NULL;
/* no backing USB device */ /* no backing USB device */
if (priv->dev == NULL) { if (priv->dev == NULL) {

View File

@ -240,7 +240,6 @@ dfu_element_set_target_size (DfuElement *element, guint32 target_size)
const guint8 *data; const guint8 *data;
gsize length; gsize length;
guint8 *buf; guint8 *buf;
g_autoptr(GBytes) contents_padded = NULL;
g_return_if_fail (DFU_IS_ELEMENT (element)); g_return_if_fail (DFU_IS_ELEMENT (element));

View File

@ -168,7 +168,7 @@ dfu_patch_export (DfuPatch *self, GError **error)
DfuPatchChunk *chunk = g_ptr_array_index (priv->chunks, i); DfuPatchChunk *chunk = g_ptr_array_index (priv->chunks, i);
DfuPatchChunkHeader chunkhdr; DfuPatchChunkHeader chunkhdr;
gsize sz_tmp = 0; gsize sz_tmp = 0;
guint8 *data_new = g_bytes_get_data (chunk->blob, &sz_tmp); const guint8 *data_new = g_bytes_get_data (chunk->blob, &sz_tmp);
/* build chunk header and append data */ /* build chunk header and append data */
chunkhdr.off = GUINT32_TO_LE (chunk->off); chunkhdr.off = GUINT32_TO_LE (chunk->off);
@ -342,8 +342,8 @@ dfu_patch_create (DfuPatch *self, GBytes *blob1, GBytes *blob2, GError **error)
{ {
DfuPatchPrivate *priv = GET_PRIVATE (self); DfuPatchPrivate *priv = GET_PRIVATE (self);
DfuPatchCreateHelper helper; DfuPatchCreateHelper helper;
guint8 *data1; const guint8 *data1;
guint8 *data2; const guint8 *data2;
gsize sz1 = 0; gsize sz1 = 0;
gsize sz2 = 0; gsize sz2 = 0;
guint32 same_sz = 0; guint32 same_sz = 0;

View File

@ -156,7 +156,6 @@ dfu_firmware_raw_func (void)
gboolean ret; gboolean ret;
g_autoptr(DfuFirmware) firmware = NULL; g_autoptr(DfuFirmware) firmware = NULL;
g_autoptr(GBytes) fw = NULL; g_autoptr(GBytes) fw = NULL;
g_autoptr(GBytes) roundtrip_orig = NULL;
g_autoptr(GBytes) roundtrip = NULL; g_autoptr(GBytes) roundtrip = NULL;
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;

View File

@ -616,7 +616,6 @@ static gboolean
dfu_target_setup (DfuTarget *target, GError **error) dfu_target_setup (DfuTarget *target, GError **error)
{ {
DfuTargetPrivate *priv = GET_PRIVATE (target); DfuTargetPrivate *priv = GET_PRIVATE (target);
g_autoptr(GError) error_local = NULL;
g_return_val_if_fail (DFU_IS_TARGET (target), FALSE); g_return_val_if_fail (DFU_IS_TARGET (target), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@ -1405,7 +1404,6 @@ dfu_target_download_element_dfu (DfuTarget *target,
guint i; guint i;
guint nr_chunks; guint nr_chunks;
guint16 transfer_size = dfu_device_get_transfer_size (priv->device); guint16 transfer_size = dfu_device_get_transfer_size (priv->device);
g_autoptr(GError) error_local = NULL;
/* round up as we have to transfer incomplete blocks */ /* round up as we have to transfer incomplete blocks */
bytes = dfu_element_get_contents (element); bytes = dfu_element_get_contents (element);
@ -1471,7 +1469,6 @@ dfu_target_download_element_dfuse (DfuTarget *target,
guint nr_chunks; guint nr_chunks;
guint zone_last = G_MAXUINT; guint zone_last = G_MAXUINT;
guint16 transfer_size = dfu_device_get_transfer_size (priv->device); guint16 transfer_size = dfu_device_get_transfer_size (priv->device);
g_autoptr(GError) error_local = NULL;
g_autoptr(GPtrArray) sectors_array = NULL; g_autoptr(GPtrArray) sectors_array = NULL;
g_autoptr(GHashTable) sectors_hash = NULL; g_autoptr(GHashTable) sectors_hash = NULL;

View File

@ -1385,7 +1385,6 @@ dfu_tool_read (DfuToolPrivate *priv, gchar **values, GError **error)
g_autofree gchar *str_debug = NULL; g_autofree gchar *str_debug = NULL;
g_autoptr(DfuDevice) device = NULL; g_autoptr(DfuDevice) device = NULL;
g_autoptr(DfuFirmware) firmware = NULL; g_autoptr(DfuFirmware) firmware = NULL;
g_autoptr(DfuImage) image = NULL;
g_autoptr(GFile) file = NULL; g_autoptr(GFile) file = NULL;
/* check args */ /* check args */

View File

@ -602,7 +602,6 @@ fwupd_client_verify (FwupdClient *client, const gchar *device_id,
{ {
FwupdClientPrivate *priv = GET_PRIVATE (client); FwupdClientPrivate *priv = GET_PRIVATE (client);
g_autoptr(FwupdClientHelper) helper = NULL; g_autoptr(FwupdClientHelper) helper = NULL;
g_autoptr(GVariant) val = NULL;
g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE); g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE);
g_return_val_if_fail (device_id != NULL, FALSE); g_return_val_if_fail (device_id != NULL, FALSE);
@ -651,7 +650,6 @@ fwupd_client_verify_update (FwupdClient *client, const gchar *device_id,
{ {
FwupdClientPrivate *priv = GET_PRIVATE (client); FwupdClientPrivate *priv = GET_PRIVATE (client);
g_autoptr(FwupdClientHelper) helper = NULL; g_autoptr(FwupdClientHelper) helper = NULL;
g_autoptr(GVariant) val = NULL;
g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE); g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE);
g_return_val_if_fail (device_id != NULL, FALSE); g_return_val_if_fail (device_id != NULL, FALSE);
@ -700,7 +698,6 @@ fwupd_client_unlock (FwupdClient *client, const gchar *device_id,
{ {
FwupdClientPrivate *priv = GET_PRIVATE (client); FwupdClientPrivate *priv = GET_PRIVATE (client);
g_autoptr(FwupdClientHelper) helper = NULL; g_autoptr(FwupdClientHelper) helper = NULL;
g_autoptr(GVariant) val = NULL;
g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE); g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE);
g_return_val_if_fail (device_id != NULL, FALSE); g_return_val_if_fail (device_id != NULL, FALSE);
@ -749,7 +746,6 @@ fwupd_client_clear_results (FwupdClient *client, const gchar *device_id,
{ {
FwupdClientPrivate *priv = GET_PRIVATE (client); FwupdClientPrivate *priv = GET_PRIVATE (client);
g_autoptr(FwupdClientHelper) helper = NULL; g_autoptr(FwupdClientHelper) helper = NULL;
g_autoptr(GVariant) val = NULL;
g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE); g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE);
g_return_val_if_fail (device_id != NULL, FALSE); g_return_val_if_fail (device_id != NULL, FALSE);
@ -798,7 +794,6 @@ fwupd_client_get_results (FwupdClient *client, const gchar *device_id,
{ {
FwupdClientPrivate *priv = GET_PRIVATE (client); FwupdClientPrivate *priv = GET_PRIVATE (client);
g_autoptr(FwupdClientHelper) helper = NULL; g_autoptr(FwupdClientHelper) helper = NULL;
g_autoptr(GVariant) val = NULL;
g_return_val_if_fail (FWUPD_IS_CLIENT (client), NULL); g_return_val_if_fail (FWUPD_IS_CLIENT (client), NULL);
g_return_val_if_fail (device_id != NULL, NULL); g_return_val_if_fail (device_id != NULL, NULL);
@ -878,7 +873,6 @@ fwupd_client_install (FwupdClient *client,
g_autoptr(FwupdClientHelper) helper = NULL; g_autoptr(FwupdClientHelper) helper = NULL;
g_autoptr(GDBusMessage) request = NULL; g_autoptr(GDBusMessage) request = NULL;
g_autoptr(GUnixFDList) fd_list = NULL; g_autoptr(GUnixFDList) fd_list = NULL;
g_autoptr(GVariant) val = NULL;
g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE); g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE);
g_return_val_if_fail (device_id != NULL, FALSE); g_return_val_if_fail (device_id != NULL, FALSE);

View File

@ -39,7 +39,6 @@ fu_plugin_dfu_device_update (FuPlugin *plugin,
{ {
const gchar *platform_id; const gchar *platform_id;
guint16 release; guint16 release;
g_autofree gchar *guid = NULL;
g_autofree gchar *version = NULL; g_autofree gchar *version = NULL;
g_autofree gchar *devid1 = NULL; g_autofree gchar *devid1 = NULL;
g_autofree gchar *devid2 = NULL; g_autofree gchar *devid2 = NULL;
@ -118,7 +117,6 @@ fu_plugin_dfu_device_added_cb (DfuContext *ctx,
{ {
const gchar *platform_id; const gchar *platform_id;
const gchar *display_name; const gchar *display_name;
g_autofree gchar *id = NULL;
g_autoptr(AsProfile) profile = as_profile_new (); g_autoptr(AsProfile) profile = as_profile_new ();
g_autoptr(AsProfileTask) ptask = NULL; g_autoptr(AsProfileTask) ptask = NULL;
g_autoptr(FuDevice) dev = NULL; g_autoptr(FuDevice) dev = NULL;
@ -219,7 +217,6 @@ fu_plugin_update (FuPlugin *plugin,
FuPluginData *data = fu_plugin_get_data (plugin); FuPluginData *data = fu_plugin_get_data (plugin);
DfuDevice *device; DfuDevice *device;
const gchar *platform_id; const gchar *platform_id;
g_autoptr(DfuDevice) dfu_device = NULL;
g_autoptr(DfuFirmware) dfu_firmware = NULL; g_autoptr(DfuFirmware) dfu_firmware = NULL;
g_autoptr(GError) error_local = NULL; g_autoptr(GError) error_local = NULL;
@ -287,7 +284,6 @@ fu_plugin_verify (FuPlugin *plugin,
GBytes *blob_fw; GBytes *blob_fw;
DfuDevice *device; DfuDevice *device;
const gchar *platform_id; const gchar *platform_id;
g_autoptr(DfuDevice) dfu_device = NULL;
g_autoptr(DfuFirmware) dfu_firmware = NULL; g_autoptr(DfuFirmware) dfu_firmware = NULL;
g_autoptr(GError) error_local = NULL; g_autoptr(GError) error_local = NULL;
GChecksumType checksum_types[] = { GChecksumType checksum_types[] = {

View File

@ -198,7 +198,6 @@ fu_plugin_coldplug (FuPlugin *plugin, GError **error)
{ {
FuPluginData *data = fu_plugin_get_data (plugin); FuPluginData *data = fu_plugin_get_data (plugin);
g_autofree gchar *fwfn = NULL; g_autofree gchar *fwfn = NULL;
g_autofree gchar *fwver = NULL;
g_autoptr(FuDevice) device = NULL; g_autoptr(FuDevice) device = NULL;
/* anything interesting */ /* anything interesting */

View File

@ -52,9 +52,6 @@ fu_plugin_synapticsmst_func (void)
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
FuDevice *device = NULL; FuDevice *device = NULL;
g_autoptr(FuPlugin) plugin = NULL; g_autoptr(FuPlugin) plugin = NULL;
g_autoptr(GBytes) blob_fw = NULL;
g_autoptr(GMappedFile) mapped_file = NULL;
g_autofree gchar *fwfile = NULL;
const gchar *test_directory; const gchar *test_directory;
devices = g_ptr_array_new (); devices = g_ptr_array_new ();

View File

@ -64,7 +64,6 @@ fu_fuzzer_write_files (GHashTable *hash, GError **error)
g_autoptr(GList) keys = g_hash_table_get_keys (hash); g_autoptr(GList) keys = g_hash_table_get_keys (hash);
for (l = keys; l != NULL; l = l->next) { for (l = keys; l != NULL; l = l->next) {
g_autoptr(FuRom) rom = fu_rom_new ();
g_autofree gchar *filename = NULL; g_autofree gchar *filename = NULL;
const gchar *fn = l->data; const gchar *fn = l->data;
filename = g_build_filename ("fuzzing", fn, NULL); filename = g_build_filename ("fuzzing", fn, NULL);

View File

@ -571,9 +571,7 @@ fu_rom_load_data (FuRom *rom,
gssize sz = buffer_sz; gssize sz = buffer_sz;
guint32 jump = 0; guint32 jump = 0;
guint32 hdr_sz = 0; guint32 hdr_sz = 0;
g_autoptr(GError) error_local = NULL;
g_autofree gchar *id = NULL; g_autofree gchar *id = NULL;
g_autoptr(AsProfile) profile = as_profile_new ();
g_autoptr(GChecksum) checksum_sha1 = g_checksum_new (G_CHECKSUM_SHA1); g_autoptr(GChecksum) checksum_sha1 = g_checksum_new (G_CHECKSUM_SHA1);
g_autoptr(GChecksum) checksum_sha256 = g_checksum_new (G_CHECKSUM_SHA256); g_autoptr(GChecksum) checksum_sha256 = g_checksum_new (G_CHECKSUM_SHA256);

View File

@ -176,7 +176,6 @@ fu_plugin_update (FuPlugin *plugin,
FwupdInstallFlags flags, FwupdInstallFlags flags,
GError **error) GError **error)
{ {
g_autoptr(GError) error_local = NULL;
fwup_resource *re = NULL; fwup_resource *re = NULL;
guint64 hardware_instance = 0; /* FIXME */ guint64 hardware_instance = 0; /* FIXME */
int rc; int rc;

View File

@ -43,7 +43,6 @@ fu_plugin_unifying_device_added (FuPlugin *plugin,
{ {
GPtrArray *guids; GPtrArray *guids;
GUsbDevice *usb_device; GUsbDevice *usb_device;
g_autofree gchar *name = NULL;
g_autoptr(AsProfile) profile = as_profile_new (); g_autoptr(AsProfile) profile = as_profile_new ();
g_autoptr(AsProfileTask) ptask = NULL; g_autoptr(AsProfileTask) ptask = NULL;
g_autoptr(FuDevice) dev = NULL; g_autoptr(FuDevice) dev = NULL;

View File

@ -259,7 +259,6 @@ lu_device_bootloader_request (LuDevice *device,
/* send request */ /* send request */
lu_dump_raw ("host->device", buf_request, sizeof (buf_request)); lu_dump_raw ("host->device", buf_request, sizeof (buf_request));
if (usb_device != NULL) { if (usb_device != NULL) {
g_autofree guint8 *data_in_buf = g_memdup (buf_request, sizeof (buf_request));
if (!g_usb_device_control_transfer (usb_device, if (!g_usb_device_control_transfer (usb_device,
G_USB_DEVICE_DIRECTION_HOST_TO_DEVICE, G_USB_DEVICE_DIRECTION_HOST_TO_DEVICE,
G_USB_DEVICE_REQUEST_TYPE_CLASS, G_USB_DEVICE_REQUEST_TYPE_CLASS,

View File

@ -410,7 +410,6 @@ lu_tool_attach (FuLuToolPrivate *priv, gchar **values, GError **error)
static void static void
lu_tool_device_added_cb (LuContext* ctx, LuDevice *device, FuLuToolPrivate *priv) lu_tool_device_added_cb (LuContext* ctx, LuDevice *device, FuLuToolPrivate *priv)
{ {
g_autoptr(GError) error = NULL;
g_print ("ADDED\tLogitech Unifying device %s {%p} [%s]\n", g_print ("ADDED\tLogitech Unifying device %s {%p} [%s]\n",
lu_device_kind_to_string (lu_device_get_kind (device)), lu_device_kind_to_string (lu_device_get_kind (device)),
device, lu_device_get_platform_id (device)); device, lu_device_get_platform_id (device));
@ -472,7 +471,6 @@ main (int argc, char **argv)
g_autofree gchar *emulation_kind = NULL; g_autofree gchar *emulation_kind = NULL;
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
g_autoptr(GOptionContext) context = NULL; g_autoptr(GOptionContext) context = NULL;
g_autoptr(LuDevice) device = NULL;
g_autoptr(FuLuToolPrivate) priv = g_new0 (FuLuToolPrivate, 1); g_autoptr(FuLuToolPrivate) priv = g_new0 (FuLuToolPrivate, 1);
const GOptionEntry options[] = { const GOptionEntry options[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,

View File

@ -247,7 +247,6 @@ fu_common_extract_archive (GBytes *blob, const gchar *dir, GError **error)
} }
for (;;) { for (;;) {
gboolean valid; gboolean valid;
g_autofree gchar *path = NULL;
r = archive_read_next_header (arch, &entry); r = archive_read_next_header (arch, &entry);
if (r == ARCHIVE_EOF) if (r == ARCHIVE_EOF)
break; break;
@ -284,6 +283,9 @@ out:
return ret; return ret;
} }
static void
fu_common_add_argv (GPtrArray *argv, const gchar *fmt, ...) G_GNUC_PRINTF (2, 3);
static void static void
fu_common_add_argv (GPtrArray *argv, const gchar *fmt, ...) fu_common_add_argv (GPtrArray *argv, const gchar *fmt, ...)
{ {

View File

@ -1494,7 +1494,6 @@ fu_engine_update_metadata (FuEngine *self, const gchar *remote_id,
g_autoptr(GBytes) bytes_raw = NULL; g_autoptr(GBytes) bytes_raw = NULL;
g_autoptr(GBytes) bytes_sig = NULL; g_autoptr(GBytes) bytes_sig = NULL;
g_autoptr(GInputStream) stream_fd = NULL; g_autoptr(GInputStream) stream_fd = NULL;
g_autoptr(GInputStream) stream = NULL;
g_autoptr(GInputStream) stream_sig = NULL; g_autoptr(GInputStream) stream_sig = NULL;
g_return_val_if_fail (FU_IS_ENGINE (self), FALSE); g_return_val_if_fail (FU_IS_ENGINE (self), FALSE);

View File

@ -80,7 +80,6 @@ fu_hwids_func (void)
g_autoptr(FuHwids) hwids = NULL; g_autoptr(FuHwids) hwids = NULL;
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
g_autofree gchar *sysfsdir = NULL; g_autofree gchar *sysfsdir = NULL;
g_autofree gchar *testdir = NULL;
gboolean ret; gboolean ret;
struct { struct {
@ -610,12 +609,12 @@ fu_common_spawn_func (void)
guint lines = 0; guint lines = 0;
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
g_autofree gchar *fn = NULL; g_autofree gchar *fn = NULL;
gchar *argv[3] = { "replace", "test", NULL }; const gchar *argv[3] = { "replace", "test", NULL };
fn = fu_test_get_filename (TESTDATADIR, "spawn.sh"); fn = fu_test_get_filename (TESTDATADIR, "spawn.sh");
g_assert (fn != NULL); g_assert (fn != NULL);
argv[0] = fn; argv[0] = fn;
ret = fu_common_spawn_sync ((const gchar * const *) argv, ret = fu_common_spawn_sync (argv,
fu_test_stdout_cb, &lines, NULL, &error); fu_test_stdout_cb, &lines, NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (ret); g_assert (ret);