Re: [PATCH] Some fixes for trunk

2007-08-08 Thread Tambet Ingo
Hey,

On 8/7/07, Helmut Schaa [EMAIL PROTECTED] wrote:
 while porting KNetworkManager to NM 0.7 I found a few issues which need fixing
 in NM. Attached are three patches which apply cleanly against trunk.

 1) allow_linking_with_cpp.patch:
 As the filename indicates this patch adds support for using libnm_util and
 libnm_glib from within C++.

I'll replace these with G_BEGIN_DECLS / G_END_DECLS (macros that
expand to exactly the same but will make editors not indent the whole
content of header file because of { }).

 2) fix_segfault.patch:
 This patch fixes a segfault caused by some ssid being NULL. I don't know if it
 is desired to have ssid's being NULL but in current trunk using my ipw2200
 I've got a lot of these.

It's NULL for all hidden APs, looks good.

 3) fix_memory_corruption.patch
 The most important one (it took hours to find the cause). Call to g_object_get
 writes a gint (4 byte) into the gint8 output buffer (1 byte) and thus
 overwrites some other data (in my case the last_seen property).

Nice catch. The proper fix would be to not write 4 bytes to that
pointer though, I'll commit a fix for that instead.

 Please have a look at the patches and commit to trunk.

Thanks! I'll commit all these changes shortly.

Tambet
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Some fixes for trunk

2007-08-08 Thread Helmut Schaa
Am Mittwoch, 8. August 2007 12:39:01 schrieb Tambet Ingo:
  1) allow_linking_with_cpp.patch:
  As the filename indicates this patch adds support for using libnm_util
  and libnm_glib from within C++.

 I'll replace these with G_BEGIN_DECLS / G_END_DECLS (macros that
 expand to exactly the same but will make editors not indent the whole
 content of header file because of { }).

Nice, thanks.

  3) fix_memory_corruption.patch
  The most important one (it took hours to find the cause). Call to
  g_object_get writes a gint (4 byte) into the gint8 output buffer (1 byte)
  and thus overwrites some other data (in my case the last_seen property).

 Nice catch. The proper fix would be to not write 4 bytes to that
 pointer though, I'll commit a fix for that instead.

Indeed, but g_object_get is a glib function ;-)

Regards,
Helmut
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Some fixes for trunk

2007-08-08 Thread Tambet Ingo
On 8/8/07, Helmut Schaa [EMAIL PROTECTED] wrote:
 Am Mittwoch, 8. August 2007 12:39:01 schrieb Tambet Ingo:
  Nice catch. The proper fix would be to not write 4 bytes to that
  pointer though, I'll commit a fix for that instead.

 Indeed, but g_object_get is a glib function ;-)

... which calls NetworkManagerAP.c:set_property() for actual assignment.

Tambet
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Some fixes for trunk

2007-08-08 Thread Helmut Schaa
Am Mittwoch, 8. August 2007 14:02:22 schrieb Tambet Ingo:
 On 8/8/07, Helmut Schaa [EMAIL PROTECTED] wrote:
  Am Mittwoch, 8. August 2007 12:39:01 schrieb Tambet Ingo:
   Nice catch. The proper fix would be to not write 4 bytes to that
   pointer though, I'll commit a fix for that instead.
 
  Indeed, but g_object_get is a glib function ;-)

 ... which calls NetworkManagerAP.c:set_property() for actual assignment.

... which only sets a GValue but does not copy the raw data over.
I think that does glib again :)

Helmut
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Some fixes for trunk

2007-08-08 Thread Tambet Ingo
On 8/8/07, Helmut Schaa [EMAIL PROTECTED] wrote:
 Am Mittwoch, 8. August 2007 14:22:10 schrieben Sie:
  g_object_class_install_property (object_class, PROP_STRENGTH,
  g_param_spec_int (...))

 Exactly ;-)

 I was at the same point yesterday but could not find a way to specify an
 int8-property. If that's possible I would like to know about.

g_param_spec_char

Tambet
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


[PATCH] Some fixes for trunk

2007-08-07 Thread Helmut Schaa
Hi,

while porting KNetworkManager to NM 0.7 I found a few issues which need fixing 
in NM. Attached are three patches which apply cleanly against trunk.

1) allow_linking_with_cpp.patch:
As the filename indicates this patch adds support for using libnm_util and 
libnm_glib from within C++.

2) fix_segfault.patch:
This patch fixes a segfault caused by some ssid being NULL. I don't know if it 
is desired to have ssid's being NULL but in current trunk using my ipw2200 
I've got a lot of these.

3) fix_memory_corruption.patch
The most important one (it took hours to find the cause). Call to g_object_get 
writes a gint (4 byte) into the gint8 output buffer (1 byte) and thus 
overwrites some other data (in my case the last_seen property).

Please have a look at the patches and commit to trunk.

Thanks,
Helmut
Index: libnm-util/nm-connection.h
===
--- libnm-util/nm-connection.h	(Revision 2656)
+++ libnm-util/nm-connection.h	(Arbeitskopie)
@@ -8,6 +8,10 @@
 	GHashTable *settings;
 } NMConnection;
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 NMConnection *nm_connection_new   (void);
 NMConnection *nm_connection_new_from_hash (GHashTable *hash);
 void  nm_connection_add_setting   (NMConnection *connection,
@@ -29,4 +33,8 @@
 
 void nm_setting_parser_unregister (const char *name);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* NM_CONNECTION_H */
Index: libnm-util/nm-setting.h
===
--- libnm-util/nm-setting.h	(Revision 2656)
+++ libnm-util/nm-setting.h	(Arbeitskopie)
@@ -21,6 +21,10 @@
 	NMSettingDestroyFn destroy_fn;
 };
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 gbooleannm_settings_verify (GHashTable *all_settings);
 GHashTable *nm_setting_to_hash (NMSetting *setting);
 voidnm_setting_destroy (NMSetting *setting);
@@ -134,5 +138,8 @@
 NMSetting *nm_setting_wireless_security_new (void);
 NMSetting *nm_setting_wireless_security_new_from_hash (GHashTable *settings);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* NM_SETTING_H */
Index: libnm-glib/nm-device-802-3-ethernet.h
===
--- libnm-glib/nm-device-802-3-ethernet.h	(Revision 2656)
+++ libnm-glib/nm-device-802-3-ethernet.h	(Arbeitskopie)
@@ -18,6 +18,10 @@
 	NMDeviceClass parent;
 } NMDevice8023EthernetClass;
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 GType nm_device_802_3_ethernet_get_type (void);
 
 NMDevice8023Ethernet *nm_device_802_3_ethernet_new (DBusGConnection *connection,
@@ -25,4 +29,8 @@
 int   nm_device_802_3_ethernet_get_speed   (NMDevice8023Ethernet *device);
 char *nm_device_802_3_ethernet_get_hw_address (NMDevice8023Ethernet *device);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* NM_DEVICE_802_3_ETHERNET_H */
Index: libnm-glib/nm-access-point.h
===
--- libnm-glib/nm-access-point.h	(Revision 2656)
+++ libnm-glib/nm-access-point.h	(Arbeitskopie)
@@ -23,6 +23,10 @@
 	void (*strength_changed) (NMAccessPoint *ap, gint8 strength);
 } NMAccessPointClass;
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 GType nm_access_point_get_type (void);
 
 NMAccessPoint *nm_access_point_new (DBusGConnection *connection, const char *path);
@@ -36,4 +40,8 @@
 guint32  nm_access_point_get_rate (NMAccessPoint *ap);
 int  nm_access_point_get_strength (NMAccessPoint *ap);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* NM_ACCESS_POINT_H */
Index: libnm-glib/nm-device.h
===
--- libnm-glib/nm-device.h	(Revision 2656)
+++ libnm-glib/nm-device.h	(Arbeitskopie)
@@ -27,6 +27,10 @@
 	void (*state_changed) (NMDevice *device, NMDeviceState state);
 } NMDeviceClass;
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 GType nm_device_get_type (void);
 
 NMDevice*nm_device_new   (DBusGConnection *connection,
@@ -49,4 +53,8 @@
 NMDeviceType  nm_device_type_for_path(DBusGConnection *connection,
 		  const char *path);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* NM_DEVICE_H */
Index: libnm-glib/nm-ip4-config.h
===
--- libnm-glib/nm-ip4-config.h	(Revision 2656)
+++ libnm-glib/nm-ip4-config.h	(Arbeitskopie)
@@ -21,6 +21,10 @@
 	NMObjectClass parent;
 } NMIP4ConfigClass;
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 GType nm_ip4_config_get_type (void);
 
 NMIP4Config *nm_ip4_config_new (DBusGConnection *connection,
@@ -36,5 +40,8 @@
 char*nm_ip4_config_get_nis_domain  (NMIP4Config *config);
 GArray  *nm_ip4_config_get_nis_servers (NMIP4Config *config);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* NM_IP4_CONFIG_H */
Index: libnm-glib/nm-client.h
===
--- libnm-glib/nm-client.h	(Revision 2656)
+++ libnm-glib/nm-client.h	(Arbeitskopie)
@@ -36,6