fix... gah. formatting mess there.. and the real problem
authorCarsten Haitzler <raster@rasterman.com>
Thu, 7 Oct 2010 00:04:19 +0000 (00:04 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Thu, 7 Oct 2010 00:04:19 +0000 (00:04 +0000)
using str1 == str2 instead of strcmp assuming all strings are
stringshared. dont ASSUME this unless you 100% KNOW for sure they are.

bad disco stu!

SVN revision: 53128

src/bin/e_fm.c
src/bin/e_fm/e_fm_ipc.c
src/bin/e_fm/e_fm_main.c
src/bin/e_fm/e_fm_main_dbus.c
src/bin/e_fm_dbus.c

index 18e66ab..befcc05 100644 (file)
@@ -9851,6 +9851,6 @@ e_fm2_operation_abort(int id)
    if (!ere) return;
    
    e_fm2_op_registry_entry_ref(ere);
-      e_fm2_op_registry_entry_abort(ere);
+   e_fm2_op_registry_entry_abort(ere);
    e_fm2_op_registry_entry_unref(ere);
 }
index 6fb0971..a8ad68a 100644 (file)
@@ -603,6 +603,7 @@ _e_fm_ipc_cb_server_data(void *data __UNUSED__, int type __UNUSED__, void *event
             udi = e->data;          
             mountpoint = udi + strlen(udi) + 1;
             v = e_volume_find(udi);
+//             printf("REQ M %p (find from %s -> %s)\n", v, udi, mountpoint); fflush(stdout);
             if (v)
               {
                  if (mountpoint[0])
@@ -610,7 +611,6 @@ _e_fm_ipc_cb_server_data(void *data __UNUSED__, int type __UNUSED__, void *event
                       if (v->mount_point) eina_stringshare_del(v->mount_point);
                       v->mount_point = eina_stringshare_add(mountpoint);
                    }
-//               printf("REQ M\n");
                  e_volume_mount(v);
               }
          }
@@ -624,7 +624,7 @@ _e_fm_ipc_cb_server_data(void *data __UNUSED__, int type __UNUSED__, void *event
             v = e_volume_find(udi);
             if (v)
               {
-//               printf("REQ UM\n");
+//               printf("REQ UM\n"); fflush(stdout);
                  e_volume_unmount(v);
               }
          }
index 3860de4..9a0657e 100644 (file)
@@ -183,29 +183,29 @@ e_volume_eject(E_Volume *v)
 EAPI E_Volume *
 e_volume_find(const char *udi)
 {
-         return _E_FM(volume_find)(udi);
+   return _E_FM(volume_find)(udi);
 }
 
 EAPI void
 e_storage_del(const char *udi)
 {
-         _E_FM(storage_del)(udi);
+   _E_FM(storage_del)(udi);
 }
 
 EAPI E_Storage *
 e_storage_find(const char *udi)
 {
-         return _E_FM(storage_find)(udi);
+   return _E_FM(storage_find)(udi);
 }
 
 void
 _e_storage_free(E_Storage *s)
 {
-         _E_FM_SHARED(storage_free)(s);
+   _E_FM_SHARED(storage_free)(s);
 }
 
 void
 _e_volume_free(E_Volume *v)
 {
-         _E_FM_SHARED(volume_free)(v);
+   _E_FM_SHARED(volume_free)(v);
 }
index 5438933..c479da0 100644 (file)
@@ -402,18 +402,18 @@ _e_fm_main_dbus_cb_store_prop(void *data, void *reply_data, DBusError *error)
 //   printf("++STO:\n  udi: %s\n  bus: %s\n  drive_type: %s\n  model: %s\n  vendor: %s\n  serial: %s\n  icon.drive: %s\n  icon.volume: %s\n\n", s->udi, s->bus, s->drive_type, s->model, s->vendor, s->serial, s->icon.drive, s->icon.volume);
    s->validated = EINA_TRUE;
      {
-                                                               void *msg_data;
-                                                               int msg_size;
-                                                               
-                                                               msg_data = _e_fm_shared_codec_storage_encode(s, &msg_size);
-                                                               if (msg_data)
-                                                                               {
-                                                                                                       ecore_ipc_server_send(_e_fm_ipc_server,
-                                                                                                               6/*E_IPC_DOMAIN_FM*/,
-                                                                                                               E_FM_OP_STORAGE_ADD,
-                                                                                                               0, 0, 0, msg_data, msg_size);
-                                                                                                       free(msg_data);
-                                                                               }
+        void *msg_data;
+        int msg_size;
+        
+        msg_data = _e_fm_shared_codec_storage_encode(s, &msg_size);
+        if (msg_data)
+          {
+             ecore_ipc_server_send(_e_fm_ipc_server,
+                                   6/*E_IPC_DOMAIN_FM*/,
+                                   E_FM_OP_STORAGE_ADD,
+                                   0, 0, 0, msg_data, msg_size);
+             free(msg_data);
+          }
      }
    return;
    
@@ -806,13 +806,13 @@ _e_fm_main_dbus_volume_add(const char *udi, Eina_Bool first_time)
    v->first_time = first_time;
    _e_vols = eina_list_append(_e_vols, v);
    e_hal_device_get_all_properties(_e_fm_main_dbus_conn, v->udi,
-                                                              _e_fm_main_dbus_cb_vol_prop, v);
+                                   _e_fm_main_dbus_cb_vol_prop, v);
    v->prop_handler = e_dbus_signal_handler_add(_e_fm_main_dbus_conn,
                                                E_HAL_SENDER,
-                                                                                                                                                                                                                                                                                                                                                                                       udi,
-                                                                                                                                                                                                                                                                                                                                                                                       E_HAL_DEVICE_INTERFACE,
-                                                                                                                                                                                                                                                                                                                                                                                       "PropertyModified",
-                                                                                                                                                                                                                                                                                                                                                                                       _e_fm_main_dbus_cb_prop_modified, v);
+                                               udi,
+                                               E_HAL_DEVICE_INTERFACE,
+                                               "PropertyModified",
+                                               _e_fm_main_dbus_cb_prop_modified, v);
    v->guard = NULL;
    
    return v;
@@ -833,12 +833,12 @@ _e_fm_main_dbus_volume_del(const char *udi)
    if (v->prop_handler) e_dbus_signal_handler_del(_e_fm_main_dbus_conn, v->prop_handler);
    if (v->validated)
      {
-                                                       //      printf("--VOL %s\n", v->udi);
-                                                               /* FIXME: send event of storage volume (disk) removed */
-                                                               ecore_ipc_server_send(_e_fm_ipc_server,
-                                                                                                                               6/*E_IPC_DOMAIN_FM*/,
-                                                                                                                               E_FM_OP_VOLUME_DEL,
-                                                                                                                               0, 0, 0, v->udi, eina_stringshare_strlen(v->udi) + 1);
+        //     printf("--VOL %s\n", v->udi);
+        /* FIXME: send event of storage volume (disk) removed */
+        ecore_ipc_server_send(_e_fm_ipc_server,
+                              6/*E_IPC_DOMAIN_FM*/,
+                              E_FM_OP_VOLUME_DEL,
+                              0, 0, 0, v->udi, eina_stringshare_strlen(v->udi) + 1);
      }
    _e_vols = eina_list_remove(_e_vols, v);
    _e_fm_shared_dbus_volume_free(v);
@@ -849,10 +849,12 @@ _e_fm_main_dbus_volume_find(const char *udi)
 {
    Eina_List *l;
    E_Volume *v;
-   
+
+   if (!udi) return NULL;
    EINA_LIST_FOREACH(_e_vols, l, v)
      {
-              if (udi == v->udi) return v;
+        if (!v->udi) continue;
+        if (!strcmp(udi, v->udi)) return v;
      }
    return NULL;
 }
@@ -902,12 +904,12 @@ _e_fm_main_dbus_volume_mount(E_Volume *v)
 
    if ((!strcmp(v->fstype, "vfat")) ||
        (!strcmp(v->fstype, "ntfs"))
-       )
+      )
      {
-                                                               snprintf(buf, sizeof(buf), "uid=%i", (int)getuid());
-                                                               opt = eina_list_append(opt, buf);
+        snprintf(buf, sizeof(buf), "uid=%i", (int)getuid());
+        opt = eina_list_append(opt, buf);
      }
-
+   
    if ((!strcmp(v->fstype, "vfat")) || 
        (!strcmp(v->fstype, "ntfs")) ||
        (!strcmp(v->fstype, "iso9660"))
@@ -979,10 +981,10 @@ _e_fm_main_dbus_storage_del(const char *udi)
    if (s->validated)
      {
         //     printf("--STO %s\n", s->udi);
-                                                               ecore_ipc_server_send(_e_fm_ipc_server,
-                                                                                                                               6/*E_IPC_DOMAIN_FM*/,
-                                                                                                                               E_FM_OP_STORAGE_DEL,
-                                                                                                                               0, 0, 0, s->udi, strlen(s->udi) + 1);
+        ecore_ipc_server_send(_e_fm_ipc_server,
+                              6/*E_IPC_DOMAIN_FM*/,
+                              E_FM_OP_STORAGE_DEL,
+                              0, 0, 0, s->udi, strlen(s->udi) + 1);
      }
    _e_stores = eina_list_remove(_e_stores, s);
    _e_fm_shared_dbus_storage_free(s);
index 914fdb0..f0733b9 100644 (file)
@@ -364,7 +364,10 @@ e_fm2_dbus_volume_find(const char *udi)
    if (!udi) return NULL;
 
    EINA_LIST_FOREACH(_e_vols, l, v)
-       if (udi == v->udi) return v;
+     {
+        if (!v->udi) continue;
+        if (!strcmp(udi, v->udi)) return v;
+     }
 
    return NULL;
 }