[PATCH] Fix compilation
- From: Bastien Nocera <hadess hadess net>
- Subject: [PATCH] Fix compilation
- Date: Wed, 5 Aug 2009 15:35:20 +0100
- Fix small memleaks in _mount()
- Use g_str_equal when possible
- Fix build
---
daemon/gvfsbackendafc.c | 36 ++++++++++++++++++++++--------------
1 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index b7e701a..a7f56c7 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -189,8 +189,8 @@ g_vfs_backend_lockdownd_check (lockdownd_error_t cond, GVfsJob *job)
switch (cond)
{
case LOCKDOWN_E_INVALID_ARG:
- g_vfs_job_failedo (job, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
- _("Lockdown Error: Invalid Argument"));
+ g_vfs_job_failed (job, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+ _("Lockdown Error: Invalid Argument"));
break;
default:
g_vfs_job_failed (job, G_IO_ERROR, G_IO_ERROR_FAILED,
@@ -232,7 +232,7 @@ _hal_device_removed (LibHalContext *hal_ctx, const char *udi)
GVfsBackendAfc *afc_backend;
afc_backend = G_VFS_BACKEND_AFC (libhal_ctx_get_user_data (hal_ctx));
- g_return_val_if_fail (afc_backend->hal_udi != NULL);
+ g_return_if_fail(afc_backend->hal_udi != NULL);
if (g_str_equal (udi, afc_backend->hal_udi))
{
@@ -254,6 +254,7 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
gboolean automounting)
{
const char *str;
+ char *tmp;
char *display_name;
int port, virtual_port;
GMountSpec *real_spec;
@@ -339,8 +340,8 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
if (ps != NULL)
{
const char *usb_serial = libhal_ps_get_string(ps, "usb.serial");
- printf("%s\n", usb_serial);
- if (!strcmp(usb_serial, self->uuid))
+ g_print ("%s\n", usb_serial);
+ if (g_str_equal (usb_serial, self->uuid))
{
self->hal_udi = g_strdup(udi);
}
@@ -375,13 +376,17 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
g_free (display_name);
real_spec = g_mount_spec_new ("afc");
- //FIXME leaking self->uuid, can't we be sure it's in the right format already?
- g_mount_spec_set (real_spec, "host", g_strdup_printf ("%40s", &self->uuid));
+ tmp = g_strdup_printf ("%40s", &self->uuid);
+ g_mount_spec_set (real_spec, "host", tmp);
+ g_free (tmp);
- /* INFO: Don't ever set the DefaultPort again or everything goes crazy
- * FIXME leaking port here */
+ /* INFO: Don't ever set the DefaultPort again or everything goes crazy */
if (virtual_port != 1)
- g_mount_spec_set(real_spec, "port", g_strdup_printf("%d", virtual_port));
+ {
+ tmp = g_strdup_printf ("%d", virtual_port);
+ g_mount_spec_set (real_spec, "port", tmp);
+ g_free (tmp);
+ }
g_vfs_backend_set_mount_spec (G_VFS_BACKEND(self), real_spec);
g_mount_spec_unref (real_spec);
@@ -410,8 +415,11 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
{
if (virtual_port >= 2)
{
+ /* translators:
+ * This is the device name, with the service being browsed in brackets, eg.:
+ * Alan Smithee's iPhone (Service 2 on Apple Mobile Device */
g_vfs_backend_set_display_name (G_VFS_BACKEND(self),
- g_strdup_printf(_("%s (%s)"), display_name, self->service));
+ g_strdup_printf (_("%s (%s)"), display_name, self->service));
}
else
{
@@ -972,7 +980,7 @@ g_vfs_backend_afc_enumerate (GVfsBackend *backend,
for (ptr = list; *ptr; ptr++)
{
- if (!strcmp(*ptr, ".") || !strcmp(*ptr, ".."))
+ if (g_str_equal(*ptr, ".") || g_str_equal(*ptr, ".."))
continue;
if (!trailing_slash)
@@ -1183,7 +1191,7 @@ g_vfs_backend_afc_move (GVfsBackend *backend,
GVfsBackendAfc *self;
self = G_VFS_BACKEND_AFC(backend);
- g_return_if_fail (self->connected);
+ g_return_if_fail(self->connected);
if (flags & G_FILE_COPY_BACKUP)
{
@@ -1191,7 +1199,7 @@ g_vfs_backend_afc_move (GVfsBackend *backend,
g_vfs_job_failed (G_VFS_JOB (job),
G_IO_ERROR,
G_IO_ERROR_CANT_CREATE_BACKUP,
- _("backups not supported yet"));
+ _("Backups are not yet supported."));
return;
}
--
1.6.2.5
--=-1XcpgcZMuG+304rgSOmn--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]