From 83ed4db2ea9d50f332b9f89778aa0e1a8cd45ff6 Mon Sep 17 00:00:00 2001 From: Maciek Borzecki Date: Thu, 15 Jan 2015 21:28:54 +0100 Subject: [PATCH] mconn-crypt: use m_conn namespace --- src/mconn-crypt.c | 64 +++++++++++++++++++++++------------------------ src/mconn-crypt.h | 52 +++++++++++++++++++------------------- 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/mconn-crypt.c b/src/mconn-crypt.c index b116011..2c84975 100644 --- a/src/mconn-crypt.c +++ b/src/mconn-crypt.c @@ -41,32 +41,32 @@ struct _MConnCryptPrivate RSA *key; /* RSA key wrapper */ }; -static void mconn_crypt_dispose (GObject *object); -static void mconn_crypt_finalize (GObject *object); -static gchar *__mconn_get_public_key_as_pem(MConnCryptPrivate *priv); -static gboolean __mconn_load_key(MConnCryptPrivate *priv, const char *path); -static gboolean __mconn_generate_key_at_path(const char *path); +static void m_conn_crypt_dispose (GObject *object); +static void m_conn_crypt_finalize (GObject *object); +static gchar *__m_conn_get_public_key_as_pem(MConnCryptPrivate *priv); +static gboolean __m_conn_load_key(MConnCryptPrivate *priv, const char *path); +static gboolean __m_conn_generate_key_at_path(const char *path); -G_DEFINE_TYPE_WITH_PRIVATE (MConnCrypt, mconn_crypt, G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE (MConnCrypt, m_conn_crypt, G_TYPE_OBJECT); static void -mconn_crypt_class_init (MConnCryptClass *klass) +m_conn_crypt_class_init (MConnCryptClass *klass) { GObjectClass *gobject_class = (GObjectClass *)klass; - gobject_class->dispose = mconn_crypt_dispose; - gobject_class->finalize = mconn_crypt_finalize; + gobject_class->dispose = m_conn_crypt_dispose; + gobject_class->finalize = m_conn_crypt_finalize; } static void -mconn_crypt_init (MConnCrypt *self) +m_conn_crypt_init (MConnCrypt *self) { g_debug("mconn-crypt: new instance"); - self->priv = mconn_crypt_get_instance_private(self); + self->priv = m_conn_crypt_get_instance_private(self); } static void -mconn_crypt_dispose (GObject *object) +m_conn_crypt_dispose (GObject *object) { MConnCrypt *self = (MConnCrypt *)object; @@ -76,68 +76,68 @@ mconn_crypt_dispose (GObject *object) self->priv->key = NULL; } - G_OBJECT_CLASS (mconn_crypt_parent_class)->dispose (object); + G_OBJECT_CLASS (m_conn_crypt_parent_class)->dispose (object); } static void -mconn_crypt_finalize (GObject *object) +m_conn_crypt_finalize (GObject *object) { MConnCrypt *self = (MConnCrypt *)object; g_signal_handlers_destroy (object); - G_OBJECT_CLASS (mconn_crypt_parent_class)->finalize (object); + G_OBJECT_CLASS (m_conn_crypt_parent_class)->finalize (object); } -MConnCrypt *mconn_crypt_new_for_key_path(const char *path) +MConnCrypt *m_conn_crypt_new_for_key_path(const char *path) { g_debug("mconn-crypt: new crypt for key %s", path); - MConnCrypt *self = g_object_new(MCONN_TYPE_CRYPT, NULL); + MConnCrypt *self = g_object_new(M_CONN_TYPE_CRYPT, NULL); if (g_file_test(path, G_FILE_TEST_EXISTS) == FALSE) - __mconn_generate_key_at_path(path); + __m_conn_generate_key_at_path(path); - if (__mconn_load_key(self->priv, path) == FALSE) + if (__m_conn_load_key(self->priv, path) == FALSE) { - mconn_crypt_unref(self); + m_conn_crypt_unref(self); return NULL; } return self; } -MConnCrypt * mconn_crypt_ref(MConnCrypt *self) +MConnCrypt * m_conn_crypt_ref(MConnCrypt *self) { - g_assert(IS_MCONN_CRYPT(self)); - return MCONN_CRYPT(g_object_ref(self)); + g_assert(IS_M_CONN_CRYPT(self)); + return M_CONN_CRYPT(g_object_ref(self)); } -void mconn_crypt_unref(MConnCrypt *self) +void m_conn_crypt_unref(MConnCrypt *self) { if (self != NULL) { - g_assert(IS_MCONN_CRYPT(self)); + g_assert(IS_M_CONN_CRYPT(self)); g_object_unref(self); } } -GBytes * mconn_crypt_decrypt(MConnCrypt *self, GBytes *data, GError **err) +GBytes * m_conn_crypt_decrypt(MConnCrypt *self, GBytes *data, GError **err) { } -gchar *mconn_crypt_get_public_key_pem(MConnCrypt *self) +gchar *m_conn_crypt_get_public_key_pem(MConnCrypt *self) { - g_assert(IS_MCONN_CRYPT(self)); + g_assert(IS_M_CONN_CRYPT(self)); g_assert(self->priv); g_assert(self->priv->key); - return __mconn_get_public_key_as_pem(self->priv); + return __m_conn_get_public_key_as_pem(self->priv); } /** * */ -static gchar *__mconn_get_public_key_as_pem(MConnCryptPrivate *priv) +static gchar *__m_conn_get_public_key_as_pem(MConnCryptPrivate *priv) { gchar *pubkey = NULL; @@ -164,7 +164,7 @@ static gchar *__mconn_get_public_key_as_pem(MConnCryptPrivate *priv) return pubkey; } -static gboolean __mconn_load_key(MConnCryptPrivate *priv, const char *path) +static gboolean __m_conn_load_key(MConnCryptPrivate *priv, const char *path) { if (g_file_test(path, G_FILE_TEST_EXISTS) == FALSE) { @@ -199,7 +199,7 @@ static gboolean __mconn_load_key(MConnCryptPrivate *priv, const char *path) return TRUE; } -static gboolean __mconn_generate_key_at_path(const char *path) +static gboolean __m_conn_generate_key_at_path(const char *path) { gboolean ret = TRUE; RSA *rsa = NULL; diff --git a/src/mconn-crypt.h b/src/mconn-crypt.h index 7fc198e..e088fdf 100644 --- a/src/mconn-crypt.h +++ b/src/mconn-crypt.h @@ -16,8 +16,8 @@ * * Author: Maciek Borzecki */ -#ifndef __MCONN_CRYPT_H__ -#define __MCONN_CRYPT_H__ +#ifndef __M_CONN_CRYPT_H__ +#define __M_CONN_CRYPT_H__ #include #include @@ -25,25 +25,25 @@ G_BEGIN_DECLS -#define MCONN_TYPE_CRYPT \ - (mconn_crypt_get_type()) -#define MCONN_CRYPT(obj) \ +#define M_CONN_TYPE_CRYPT \ + (m_conn_crypt_get_type()) +#define M_CONN_CRYPT(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - MCONN_TYPE_CRYPT, \ + M_CONN_TYPE_CRYPT, \ MConnCrypt)) -#define MCONN_CRYPT_CLASS(klass) \ +#define M_CONN_CRYPT_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ - MCONN_TYPE_CRYPT, \ + M_CONN_TYPE_CRYPT, \ MConnCryptClass)) -#define IS_MCONN_CRYPT(obj) \ +#define IS_M_CONN_CRYPT(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - MCONN_TYPE_CRYPT)) -#define IS_MCONN_CRYPT_CLASS(klass) \ + M_CONN_TYPE_CRYPT)) +#define IS_M_CONN_CRYPT_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - MCONN_TYPE_CRYPT)) -#define MCONN_CRYPT_GET_CLASS(obj) \ + M_CONN_TYPE_CRYPT)) +#define M_CONN_CRYPT_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - MCONN_TYPE_CRYPT, \ + M_CONN_TYPE_CRYPT, \ MConnCryptClass)) typedef struct _MConnCrypt MConnCrypt; @@ -53,49 +53,49 @@ struct _MConnCryptClass GObjectClass parent_class; }; -GType mconn_crypt_get_type (void) G_GNUC_CONST; +GType m_conn_crypt_get_type (void) G_GNUC_CONST; /** - * mconn_crypt_new_for_key_path: (constructor) + * m_conn_crypt_new_for_key_path: (constructor) * @path: key path * * Returns: (transfer full): new object */ -MConnCrypt *mconn_crypt_new_for_key_path(const char *path); +MConnCrypt *m_conn_crypt_new_for_key_path(const char *path); /** - * mconn_crypt_unref: + * m_conn_crypt_unref: * @crypt: crypt object */ -void mconn_crypt_unref(MConnCrypt *crypt); +void m_conn_crypt_unref(MConnCrypt *crypt); /** - * mconn_crypt_ref: + * m_conn_crypt_ref: * @crypt: crypt object * * Take reference to crypt object * Returns: (transfer none): reffed object */ -MConnCrypt *mconn_crypt_ref(MConnCrypt *crypt); +MConnCrypt *m_conn_crypt_ref(MConnCrypt *crypt); /** - * mconn_crypt_decrypt: + * m_conn_crypt_decrypt: * @crypt: crypt object * @data: (type GBytes): data * @error: return location for a GError or NULL * * Returns: (transfer full): a new #GBytes with decoded data */ -GBytes * mconn_crypt_decrypt(MConnCrypt *crypt, GBytes *data, GError **error); +GBytes * m_conn_crypt_decrypt(MConnCrypt *crypt, GBytes *data, GError **error); /** - * mconn_crypt_get_public_key_pem: + * m_conn_crypt_get_public_key_pem: * @crypt: crypt object * * Returns: (transfer full): allocated string with public key in PEM format */ -gchar * mconn_crypt_get_public_key_pem(MConnCrypt *crypt); +gchar * m_conn_crypt_get_public_key_pem(MConnCrypt *crypt); G_END_DECLS -#endif /* __MCONN_CRYPT_H__ */ +#endif /* __M_CONN_CRYPT_H__ */