X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgunixsocketaddress.c;h=70973b8eb3ac5aae45cee572ce9f7da129b6a2f9;hb=51fac05d73f8363de821eb0d6940dedca13a8c0f;hp=440ab253da0dbcfaee0b178ab011a1c007fa8238;hpb=631d0c3534661e549f7df18fbb9832bdf19c5eaf;p=platform%2Fupstream%2Fglib.git diff --git a/gio/gunixsocketaddress.c b/gio/gunixsocketaddress.c index 440ab25..70973b8 100644 --- a/gio/gunixsocketaddress.c +++ b/gio/gunixsocketaddress.c @@ -13,9 +13,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. + * Public License along with this library; if not, see . * * Authors: Christian Kellner * Samuel Cormier-Iijima @@ -27,7 +25,7 @@ #include "gunixsocketaddress.h" #include "glibintl.h" -#include "gnetworkingprivate.h" +#include "gnetworking.h" /** @@ -46,18 +44,17 @@ * errors. You can use g_unix_socket_address_abstract_names_supported() * to see if abstract names are supported. * - * Note that <gio/gunixsocketaddress.h> belongs to - * the UNIX-specific GIO interfaces, thus you have to use the - * gio-unix-2.0.pc pkg-config file when using it. + * Note that `` belongs to the UNIX-specific GIO + * interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config file + * when using it. */ /** * GUnixSocketAddress: * * A UNIX-domain (local) socket address, corresponding to a - * struct sockaddr_un. + * struct sockaddr_un. */ -G_DEFINE_TYPE (GUnixSocketAddress, g_unix_socket_address, G_TYPE_SOCKET_ADDRESS); enum { @@ -79,6 +76,8 @@ struct _GUnixSocketAddressPrivate GUnixSocketAddressType address_type; }; +G_DEFINE_TYPE_WITH_PRIVATE (GUnixSocketAddress, g_unix_socket_address, G_TYPE_SOCKET_ADDRESS) + static void g_unix_socket_address_set_property (GObject *object, guint prop_id, @@ -117,26 +116,15 @@ g_unix_socket_address_set_property (GObject *object, break; case PROP_ABSTRACT: - /* If the caller already set PROP_ADDRESS_TYPE, don't let the - * default value of PROP_ABSTRACT overwrite it. - */ - if (address->priv->address_type != G_UNIX_SOCKET_ADDRESS_INVALID) - return; - + /* Only set it if it's not the default... */ if (g_value_get_boolean (value)) - address->priv->address_type = G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED; - else - address->priv->address_type = G_UNIX_SOCKET_ADDRESS_PATH; + address->priv->address_type = G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED; break; case PROP_ADDRESS_TYPE: - /* If the caller already set PROP_ABSTRACT, don't let the - * default value of PROP_ADDRESS_TYPE overwrite it. - */ - if (address->priv->address_type != G_UNIX_SOCKET_ADDRESS_INVALID) - return; - - address->priv->address_type = g_value_get_enum (value); + /* Only set it if it's not the default... */ + if (g_value_get_enum (value) != G_UNIX_SOCKET_ADDRESS_PATH) + address->priv->address_type = g_value_get_enum (value); break; default: @@ -241,7 +229,7 @@ g_unix_socket_address_to_native (GSocketAddress *address, if (!g_unix_socket_address_abstract_names_supported ()) { g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, - _("Abstract unix domain socket addresses not supported on this system")); + _("Abstract UNIX domain socket addresses not supported on this system")); return FALSE; } @@ -259,8 +247,6 @@ g_unix_socket_address_class_init (GUnixSocketAddressClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GSocketAddressClass *gsocketaddress_class = G_SOCKET_ADDRESS_CLASS (klass); - g_type_class_add_private (klass, sizeof (GUnixSocketAddressPrivate)); - gobject_class->set_property = g_unix_socket_address_set_property; gobject_class->get_property = g_unix_socket_address_get_property; @@ -316,13 +302,11 @@ g_unix_socket_address_class_init (GUnixSocketAddressClass *klass) static void g_unix_socket_address_init (GUnixSocketAddress *address) { - address->priv = G_TYPE_INSTANCE_GET_PRIVATE (address, - G_TYPE_UNIX_SOCKET_ADDRESS, - GUnixSocketAddressPrivate); + address->priv = g_unix_socket_address_get_instance_private (address); memset (address->priv->path, 0, sizeof (address->priv->path)); address->priv->path_len = -1; - address->priv->address_type = G_UNIX_SOCKET_ADDRESS_INVALID; + address->priv->address_type = G_UNIX_SOCKET_ADDRESS_PATH; } /** @@ -392,7 +376,7 @@ g_unix_socket_address_new_abstract (const gchar *path, * zero-padded buffer will be considered the name. (As above, if * @path_len is -1, then @path is assumed to be NUL-terminated.) In * this case, g_socket_address_get_native_size() will always return - * the full size of a struct sockaddr_un, although + * the full size of a `struct sockaddr_un`, although * g_unix_socket_address_get_path_len() will still return just the * length of @path. * @@ -510,7 +494,7 @@ g_unix_socket_address_get_is_abstract (GUnixSocketAddress *address) /** * g_unix_socket_address_abstract_names_supported: * - * Checks if abstract unix domain socket names are supported. + * Checks if abstract UNIX domain socket names are supported. * * Returns: %TRUE if supported, %FALSE otherwise *