From b9fe74220019a567b1c469b0f1d033fd6cc1135f Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Tue, 12 Jul 2016 11:35:38 +0300 Subject: [PATCH] [mms-engine] Logging cleanup. MER#1027 Logging functionality that used to be part of mms-engine has been migrated to libglibutil --- .../include/mms_connman_nemo_log.h | 3 +- mms-connman-nemo/src/mms_connection_nemo.c | 74 +++++++------- mms-connman-nemo/src/mms_connman_nemo.c | 28 +++--- .../include/mms_connman_ofono_log.h | 3 +- mms-connman-ofono/src/mms_connection_ofono.c | 54 +++++------ mms-connman-ofono/src/mms_connman_ofono.c | 40 ++++---- mms-engine/main.c | 39 ++++---- mms-engine/mms_engine.c | 61 ++++++------ mms-handler-dbus/src/mms_handler_dbus.c | 38 ++++---- mms-lib/Makefile | 4 - mms-lib/include/mms_lib_log.h | 3 +- mms-lib/include/mms_log.h | 96 ------------------- mms-lib/src/mms_attachment.c | 26 +++-- mms-lib/src/mms_attachment_image.c | 30 +++--- mms-lib/src/mms_attachment_jpeg.c | 16 ++-- mms-lib/src/mms_attachment_qt.cpp | 10 +- mms-lib/src/mms_codec.c | 18 ++-- mms-lib/src/mms_codec.h | 15 +-- mms-lib/src/mms_connection.c | 9 +- mms-lib/src/mms_connman.c | 11 +-- mms-lib/src/mms_dispatcher.c | 54 +++++------ mms-lib/src/mms_error.c | 7 +- mms-lib/src/mms_error.h | 6 +- mms-lib/src/mms_file_util.c | 14 ++- mms-lib/src/mms_handler.c | 65 ++++++------- mms-lib/src/mms_message.c | 21 ++-- mms-lib/src/mms_task.c | 51 +++++----- mms-lib/src/mms_task_decode.c | 52 +++++----- mms-lib/src/mms_task_encode.c | 43 ++++----- mms-lib/src/mms_task_http.c | 78 +++++++-------- mms-lib/src/mms_task_notification.c | 57 ++++++----- mms-lib/src/mms_task_publish.c | 16 ++-- mms-lib/src/mms_task_read.c | 4 +- mms-lib/src/mms_task_retrieve.c | 13 ++- mms-lib/src/mms_task_send.c | 17 ++-- mms-lib/src/mms_transfer_list.c | 9 +- mms-lib/test/common/Makefile | 3 +- mms-lib/test/common/test_connection.c | 11 +-- mms-lib/test/common/test_connman.c | 11 +-- mms-lib/test/common/test_handler.c | 77 ++++++++------- mms-lib/test/common/test_http.c | 12 +-- mms-lib/test/common/test_transfer_list.c | 7 +- mms-lib/test/common/test_util.c | 10 +- .../test_delivery_ind/test_delivery_ind.c | 32 ++++--- .../test/test_media_type/test_media_type.c | 14 +-- mms-lib/test/test_mms_codec/test_mms_codec.c | 21 ++-- mms-lib/test/test_read_ind/test_read_ind.c | 32 ++++--- .../test/test_read_report/test_read_report.c | 38 ++++---- mms-lib/test/test_resize/test_resize.c | 41 ++++---- mms-lib/test/test_retrieve/test_retrieve.c | 54 +++++------ .../test_retrieve_cancel.c | 37 +++---- .../test_retrieve_no_proxy.c | 31 +++--- .../test_retrieve_order/test_retrieve_order.c | 34 +++---- mms-lib/test/test_send/test_send.c | 35 ++++--- mms-settings-dconf/src/mms_settings_dconf.c | 55 +++++------ .../src/mms_transfer_dbus.c | 17 ++-- .../src/mms_transfer_list_dbus.c | 22 +++-- rpm/mms-engine.spec | 2 +- 58 files changed, 776 insertions(+), 905 deletions(-) delete mode 100644 mms-lib/include/mms_log.h diff --git a/mms-connman-nemo/include/mms_connman_nemo_log.h b/mms-connman-nemo/include/mms_connman_nemo_log.h index e7f656c..b0c64c7 100644 --- a/mms-connman-nemo/include/mms_connman_nemo_log.h +++ b/mms-connman-nemo/include/mms_connman_nemo_log.h @@ -10,13 +10,12 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #ifndef JOLLA_MMS_CONNMAN_NEMO_LOG_H #define JOLLA_MMS_CONNMAN_NEMO_LOG_H -#include "mms_log.h" +#include "mms_lib_types.h" #define MMS_CONNMAN_LOG_MODULES(log) \ log(gofonoext_log) \ diff --git a/mms-connman-nemo/src/mms_connection_nemo.c b/mms-connman-nemo/src/mms_connection_nemo.c index f8b4063..10d7757 100644 --- a/mms-connman-nemo/src/mms_connection_nemo.c +++ b/mms-connman-nemo/src/mms_connection_nemo.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_connection_nemo.h" @@ -20,9 +19,10 @@ #include /* Logging */ -#define MMS_LOG_MODULE_NAME mms_connection_log +#define GLOG_MODULE_NAME mms_connection_log #include "mms_connman_nemo_log.h" -MMS_LOG_MODULE_DEFINE("mms-connection-nemo"); +#include +GLOG_MODULE_DEFINE("mms-connection-nemo"); enum mm_handler_id { MM_HANDLER_VALID, @@ -113,7 +113,7 @@ mms_connection_nemo_reset_mms_imsi_done( void* arg) { MMSConnectionNemo* self = MMS_CONNECTION_NEMO(arg); - MMS_DEBUG("Released %s", self->path); + GDEBUG("Released %s", self->path); mms_connman_busy_dec(self->cm); mms_connection_unref(&self->connection); } @@ -161,7 +161,7 @@ mms_connection_nemo_cancel( { if (self->connection.state <= MMS_CONNECTION_STATE_OPENING && mms_connection_nemo_set_state(self, MMS_CONNECTION_STATE_FAILED)) { - MMS_DEBUG("Connection %s cancelled", self->connection.imsi); + GDEBUG("Connection %s cancelled", self->connection.imsi); } else { mms_connection_nemo_set_state(self, MMS_CONNECTION_STATE_CLOSED); } @@ -174,7 +174,7 @@ mms_connection_nemo_cancel_if_invalid( void* arg) { if (!obj->valid) { - MMS_VERBOSE_("oops!"); + GVERBOSE_("oops!"); mms_connection_nemo_cancel(MMS_CONNECTION_NEMO(arg)); } } @@ -186,9 +186,9 @@ mms_connection_nemo_active_changed( void* arg) { MMSConnectionNemo* self = MMS_CONNECTION_NEMO(arg); - MMS_ASSERT(self->context == context); + GASSERT(self->context == context); if (context->active) { - MMS_DEBUG("Connection %s opened", self->connection.imsi); + GDEBUG("Connection %s opened", self->connection.imsi); mms_connection_nemo_set_state(self, MMS_CONNECTION_STATE_OPEN); } else { mms_connection_nemo_disconnect_context(self, CONTEXT_HANDLER_ACTIVE); @@ -203,10 +203,10 @@ mms_connection_nemo_interface_changed( void* arg) { MMSConnectionNemo* self = MMS_CONNECTION_NEMO(arg); - MMS_ASSERT(self->context == context); + GASSERT(self->context == context); if (context->ifname) { self->connection.netif = context->ifname; - MMS_DEBUG("Interface: %s", self->connection.netif); + GDEBUG("Interface: %s", self->connection.netif); } else { self->connection.netif = NULL; } @@ -219,10 +219,10 @@ mms_connection_nemo_mms_proxy_changed( void* arg) { MMSConnectionNemo* self = MMS_CONNECTION_NEMO(arg); - MMS_ASSERT(self->context == context); + GASSERT(self->context == context); if (context->mms_proxy) { self->connection.mmsproxy = context->mms_proxy; - MMS_DEBUG("MessageProxy: %s", self->connection.mmsproxy); + GDEBUG("MessageProxy: %s", self->connection.mmsproxy); } else { self->connection.mmsproxy = NULL; } @@ -235,10 +235,10 @@ mms_connection_nemo_mms_center_changed( void* arg) { MMSConnectionNemo* self = MMS_CONNECTION_NEMO(arg); - MMS_ASSERT(self->context == context); + GASSERT(self->context == context); if (context->mms_center) { self->connection.mmsc = context->mms_center; - MMS_DEBUG("MessageCenter: %s", self->connection.mmsc); + GDEBUG("MessageCenter: %s", self->connection.mmsc); } else { self->connection.mmsc = NULL; } @@ -252,7 +252,7 @@ mms_connection_nemo_activate_failed( void* arg) { MMSConnectionNemo* self = MMS_CONNECTION_NEMO(arg); - MMS_ASSERT(self->context == context); + GASSERT(self->context == context); mms_connection_nemo_cancel(self); } @@ -269,7 +269,7 @@ mms_connection_nemo_check_context( } else { OfonoConnMgr* connmgr = self->connmgr; if (ofono_connmgr_valid(connmgr) && connmgr->attached) { - MMS_DEBUG("Activate %s", ofono_connctx_path(context)); + GDEBUG("Activate %s", ofono_connctx_path(context)); ofono_connctx_activate(context); } } @@ -283,7 +283,7 @@ mms_connection_nemo_connmgr_attached_changed( void* arg) { MMSConnectionNemo* self = MMS_CONNECTION_NEMO(arg); - MMS_DEBUG("Data registration %s for %s", connmgr->attached ? "on" : "off", + GDEBUG("Data registration %s for %s", connmgr->attached ? "on" : "off", ofono_connmgr_path(connmgr)); mms_connection_nemo_check_context(self); } @@ -307,15 +307,15 @@ mms_connection_nemo_setup_context( /* Capture the current context state */ if (context->mms_proxy && context->mms_proxy[0]) { conn->mmsproxy = context->mms_proxy; - MMS_DEBUG("MessageProxy: %s", conn->mmsproxy); + GDEBUG("MessageProxy: %s", conn->mmsproxy); } if (context->mms_center && context->mms_center[0]) { conn->mmsc = context->mms_center; - MMS_DEBUG("MessageCenter: %s", conn->mmsc); + GDEBUG("MessageCenter: %s", conn->mmsc); } if (context->ifname && context->ifname[0]) { conn->netif = context->ifname; - MMS_DEBUG("Interface: %s", conn->netif); + GDEBUG("Interface: %s", conn->netif); } /* Track context property changes */ @@ -364,8 +364,8 @@ void mms_connection_nemo_init_context( MMSConnectionNemo* self) { - MMS_ASSERT(ofono_connmgr_valid(self->connmgr)); - MMS_ASSERT(!self->context); + GASSERT(ofono_connmgr_valid(self->connmgr)); + GASSERT(!self->context); /* From this point on, cancel the connection if OfonoConnMgr becomes * invalid (which would probably mean SIM removal or ofono crash) */ @@ -379,7 +379,7 @@ mms_connection_nemo_init_context( self->context = ofono_connctx_ref(ofono_connmgr_get_context_for_type( self->connmgr, OFONO_CONNCTX_TYPE_MMS)); if (self->context) { - MMS_DEBUG("MMS context %s", ofono_connctx_path(self->context)); + GDEBUG("MMS context %s", ofono_connctx_path(self->context)); if (ofono_connctx_valid(self->context)) { mms_connection_nemo_setup_context(self); } else { @@ -388,7 +388,7 @@ mms_connection_nemo_init_context( mms_connection_nemo_context_valid_changed, self); } } else { - MMS_WARN("No MMS context"); + GWARN("No MMS context"); mms_connection_nemo_cancel(self); } } @@ -414,7 +414,7 @@ mms_connection_nemo_mms_imsi_changed( { MMSConnectionNemo* self = MMS_CONNECTION_NEMO(arg); if (mm->valid && g_strcmp0(mm->mms_imsi, self->connection.imsi)) { - MMS_VERBOSE_("%s", mm->mms_imsi); + GVERBOSE_("%s", mm->mms_imsi); mms_connection_nemo_cancel(self); } } @@ -431,9 +431,9 @@ mms_connection_nemo_set_mms_imsi_done( if (error) { mms_connection_nemo_cancel(self); } else { - MMS_DEBUG("MMS modem path %s", path); - MMS_ASSERT(!self->path); - MMS_ASSERT(!self->connmgr); + GDEBUG("MMS modem path %s", path); + GASSERT(!self->path); + GASSERT(!self->connmgr); self->path = g_strdup(path); if (self->connection.state == MMS_CONNECTION_STATE_OPENING) { @@ -454,7 +454,7 @@ mms_connection_nemo_set_mms_imsi_done( } } else { /* Connection has been cancelled, release the slot */ - MMS_DEBUG("Canceled, releasing %s", path); + GDEBUG("Canceled, releasing %s", path); mms_connection_ref(&self->connection); mms_connman_busy_inc(self->cm); ofonoext_mm_set_mms_imsi_full(self->mm, "", @@ -473,7 +473,7 @@ mms_connection_nemo_cancel_if_mm_invalid( void* arg) { if (!mm->valid) { - MMS_VERBOSE_("oops!"); + GVERBOSE_("oops!"); mms_connection_nemo_cancel(MMS_CONNECTION_NEMO(arg)); } } @@ -504,7 +504,7 @@ mms_connection_nemo_mm_valid_changed( OfonoExtModemManager* mm, void* arg) { - MMS_VERBOSE_("%p %d", arg, mm->valid); + GVERBOSE_("%p %d", arg, mm->valid); if (mm->valid) { mms_connection_nemo_request_sim(arg); } @@ -519,7 +519,7 @@ mms_connection_nemo_new( MMSConnectionNemo* self = g_object_new(MMS_TYPE_CONNECTION_NEMO, NULL); MMSConnection* conn = &self->connection; - MMS_VERBOSE_("%p %s", self, imsi); + GVERBOSE_("%p %s", self, imsi); conn->type = type; conn->imsi = self->imsi = g_strdup(imsi); conn->state = MMS_CONNECTION_STATE_OPENING; @@ -545,7 +545,7 @@ mms_connection_nemo_close( MMSConnectionNemo* self = MMS_CONNECTION_NEMO(connection); OfonoConnCtx* context = self->context; if (ofono_connctx_valid(context) && context->active) { - MMS_DEBUG("Deactivate %s", ofono_connctx_path(context)); + GDEBUG("Deactivate %s", ofono_connctx_path(context)); ofono_connctx_deactivate(context); } else { mms_connection_nemo_cancel(self); @@ -562,8 +562,8 @@ mms_connection_nemo_dispose( GObject* object) { MMSConnectionNemo* self = MMS_CONNECTION_NEMO(object); - MMS_VERBOSE_("%p %s", self, self->imsi); - MMS_ASSERT(!mms_connection_is_active(&self->connection)); + GVERBOSE_("%p %s", self, self->imsi); + GASSERT(!mms_connection_is_active(&self->connection)); mms_connection_nemo_disconnect(self); if (self->context) { if (mms_connection_is_active(&self->connection) && @@ -586,7 +586,7 @@ mms_connection_nemo_finalize( GObject* object) { MMSConnectionNemo* self = MMS_CONNECTION_NEMO(object); - MMS_VERBOSE_("%p %s", self, self->imsi); + GVERBOSE_("%p %s", self, self->imsi); ofono_connmgr_unref(self->connmgr); ofono_connctx_unref(self->context); ofonoext_mm_unref(self->mm); @@ -618,7 +618,7 @@ void mms_connection_nemo_init( MMSConnectionNemo* self) { - MMS_VERBOSE_("%p", self); + GVERBOSE_("%p", self); } /* diff --git a/mms-connman-nemo/src/mms_connman_nemo.c b/mms-connman-nemo/src/mms_connman_nemo.c index 7eea7f7..393d5ec 100644 --- a/mms-connman-nemo/src/mms_connman_nemo.c +++ b/mms-connman-nemo/src/mms_connman_nemo.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_connman_nemo.h" @@ -20,9 +19,10 @@ #include /* Logging */ -#define MMS_LOG_MODULE_NAME mms_connman_log +#define GLOG_MODULE_NAME mms_connman_log #include "mms_connman_nemo_log.h" -MMS_LOG_MODULE_DEFINE("mms-connman-nemo"); +#include +GLOG_MODULE_DEFINE("mms-connman-nemo"); enum mm_event { MM_EVENT_VALID, @@ -79,10 +79,10 @@ mms_connman_nemo_check_default_sim( if (g_strcmp0(path, ofono_simmgr_path(self->default_sim))) { ofono_simmgr_unref(self->default_sim); if (path) { - MMS_DEBUG("Default SIM at %s", path); + GDEBUG("Default SIM at %s", path); self->default_sim = ofono_simmgr_new(path); } else { - MMS_DEBUG("No default SIM"); + GDEBUG("No default SIM"); self->default_sim = NULL; } } @@ -136,10 +136,10 @@ mms_connman_nemo_default_imsi( ofono_simmgr_wait_valid(self->default_sim, MMS_INIT_TIMEOUT_MS, 0) && self->default_sim /* Check it again */ && self->default_sim->imsi) { - MMS_DEBUG("Default IMSI %s", self->default_sim->imsi); + GDEBUG("Default IMSI %s", self->default_sim->imsi); return g_strdup(self->default_sim->imsi); } - MMS_DEBUG("No default IMSI"); + GDEBUG("No default IMSI"); return NULL; } @@ -153,8 +153,8 @@ mms_connman_nemo_connection_weak_ref_notify( GObject* connection) { MMSConnManNemo* self = MMS_CONNMAN_NEMO(arg); - MMS_ASSERT(MMS_CONNECTION(connection) == self->conn); - MMS_VERBOSE_("%p", connection); + GASSERT(MMS_CONNECTION(connection) == self->conn); + GVERBOSE_("%p", connection); self->conn_change_id = 0; self->conn = NULL; } @@ -168,7 +168,7 @@ mms_connman_nemo_drop_connection( MMSConnManNemo* self) { if (self->conn) { - MMS_VERBOSE_("%p", self->conn); + GVERBOSE_("%p", self->conn); mms_connection_remove_handler(self->conn, self->conn_change_id); self->conn_change_id = 0; g_object_weak_unref(G_OBJECT(self->conn), @@ -187,7 +187,7 @@ mms_connman_nemo_connection_state_changed( void* arg) { MMSConnManNemo* self = MMS_CONNMAN_NEMO(arg); - MMS_ASSERT(connection == self->conn); + GASSERT(connection == self->conn); if (self->conn && !mms_connection_is_active(self->conn)) { mms_connman_nemo_drop_connection(self); } @@ -216,7 +216,7 @@ mms_connman_nemo_open_connection( self->conn = mms_connection_nemo_new(cm, imsi, type); self->conn_change_id = mms_connection_add_state_change_handler(self->conn, mms_connman_nemo_connection_state_changed, self); - MMS_ASSERT(mms_connection_is_active(self->conn)); + GASSERT(mms_connection_is_active(self->conn)); g_object_weak_ref(G_OBJECT(self->conn), mms_connman_nemo_connection_weak_ref_notify, self); return self->conn; @@ -260,7 +260,7 @@ mms_connman_nemo_finalize( GObject* object) { MMSConnManNemo* self = MMS_CONNMAN_NEMO(object); - MMS_VERBOSE_(""); + GVERBOSE_(""); ofonoext_mm_unref(self->mm); G_OBJECT_CLASS(mms_connman_nemo_parent_class)->finalize(object); } @@ -288,7 +288,7 @@ void mms_connman_nemo_init( MMSConnManNemo* self) { - MMS_VERBOSE_(""); + GVERBOSE_(""); self->mm = ofonoext_mm_new(); self->mm_event_id[MM_EVENT_VALID] = ofonoext_mm_add_valid_changed_handler(self->mm, diff --git a/mms-connman-ofono/include/mms_connman_ofono_log.h b/mms-connman-ofono/include/mms_connman_ofono_log.h index e5052cf..58f2a9b 100644 --- a/mms-connman-ofono/include/mms_connman_ofono_log.h +++ b/mms-connman-ofono/include/mms_connman_ofono_log.h @@ -10,13 +10,12 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #ifndef JOLLA_MMS_CONNMAN_OFONO_LOG_H #define JOLLA_MMS_CONNMAN_OFONO_LOG_H -#include "mms_log.h" +#include "mms_lib_types.h" #define MMS_CONNMAN_LOG_MODULES(log) \ log(gofono_log) diff --git a/mms-connman-ofono/src/mms_connection_ofono.c b/mms-connman-ofono/src/mms_connection_ofono.c index 5d5c486..4046b72 100644 --- a/mms-connman-ofono/src/mms_connection_ofono.c +++ b/mms-connman-ofono/src/mms_connection_ofono.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_connection_ofono.h" @@ -19,9 +18,10 @@ #include /* Logging */ -#define MMS_LOG_MODULE_NAME mms_connection_log +#define GLOG_MODULE_NAME mms_connection_log #include "mms_connman_ofono_log.h" -MMS_LOG_MODULE_DEFINE("mms-connection-ofono"); +#include +GLOG_MODULE_DEFINE("mms-connection-ofono"); enum context_handler_id { CONTEXT_HANDLER_ACTIVATE_FAILED, @@ -109,9 +109,9 @@ mms_connection_ofono_active_changed( void* arg) { MMSConnectionOfono* self = MMS_CONNECTION_OFONO(arg); - MMS_ASSERT(self->context == context); + GASSERT(self->context == context); if (context->active) { - MMS_DEBUG("Connection %s opened", self->connection.imsi); + GDEBUG("Connection %s opened", self->connection.imsi); mms_connection_ofono_set_state(self, MMS_CONNECTION_STATE_OPEN); } else { mms_connection_ofono_set_state(self, MMS_CONNECTION_STATE_CLOSED); @@ -125,10 +125,10 @@ mms_connection_ofono_interface_changed( void* arg) { MMSConnectionOfono* self = MMS_CONNECTION_OFONO(arg); - MMS_ASSERT(self->context == context); + GASSERT(self->context == context); if (context->ifname) { self->connection.netif = context->ifname; - MMS_DEBUG("Interface: %s", self->connection.netif); + GDEBUG("Interface: %s", self->connection.netif); } else { self->connection.netif = NULL; } @@ -141,10 +141,10 @@ mms_connection_ofono_mms_proxy_changed( void* arg) { MMSConnectionOfono* self = MMS_CONNECTION_OFONO(arg); - MMS_ASSERT(self->context == context); + GASSERT(self->context == context); if (context->mms_proxy) { self->connection.mmsproxy = context->mms_proxy; - MMS_DEBUG("MessageProxy: %s", self->connection.mmsproxy); + GDEBUG("MessageProxy: %s", self->connection.mmsproxy); } else { self->connection.mmsproxy = NULL; } @@ -157,10 +157,10 @@ mms_connection_ofono_mms_center_changed( void* arg) { MMSConnectionOfono* self = MMS_CONNECTION_OFONO(arg); - MMS_ASSERT(self->context == context); + GASSERT(self->context == context); if (context->mms_center) { self->connection.mmsc = context->mms_center; - MMS_DEBUG("MessageCenter: %s", self->connection.mmsc); + GDEBUG("MessageCenter: %s", self->connection.mmsc); } else { self->connection.mmsc = NULL; } @@ -173,9 +173,9 @@ mms_connection_ofono_imsi_changed( void* arg) { MMSConnectionOfono* self = MMS_CONNECTION_OFONO(arg); - MMS_ASSERT(self->sim == sim); + GASSERT(self->sim == sim); if (g_strcmp0(sim->imsi, self->connection.imsi)) { - MMS_DEBUG_("%s", sim->imsi); + GDEBUG_("%s", sim->imsi); mms_connection_ofono_cancel(self); } } @@ -187,10 +187,10 @@ mms_connection_ofono_present_changed( void* arg) { MMSConnectionOfono* self = MMS_CONNECTION_OFONO(arg); - MMS_ASSERT(self->sim == sim); - MMS_DEBUG_("%s", sim->present ? "true" : "false"); + GASSERT(self->sim == sim); + GDEBUG_("%s", sim->present ? "true" : "false"); if (!sim->present) { - MMS_DEBUG_("%s", sim->imsi); + GDEBUG_("%s", sim->imsi); mms_connection_ofono_cancel(self); } } @@ -203,7 +203,7 @@ mms_connection_ofono_activate_failed( void* arg) { MMSConnectionOfono* self = MMS_CONNECTION_OFONO(arg); - MMS_ASSERT(self->context == context); + GASSERT(self->context == context); mms_connection_ofono_cancel(self); } @@ -216,9 +216,9 @@ mms_connection_ofono_new( MMSConnectionOfono* self = g_object_new(MMS_TYPE_CONNECTION_OFONO, NULL); MMSConnection* conn = &self->connection; - MMS_ASSERT(ofono_simmgr_valid(sim)); - MMS_ASSERT(sim->present); - MMS_VERBOSE_("%p %s", self, sim->imsi); + GASSERT(ofono_simmgr_valid(sim)); + GASSERT(sim->present); + GVERBOSE_("%p %s", self, sim->imsi); conn->type = type; conn->imsi = self->imsi = g_strdup(sim->imsi); @@ -229,15 +229,15 @@ mms_connection_ofono_new( if (context->mms_proxy && context->mms_proxy[0]) { conn->mmsproxy = context->mms_proxy; - MMS_DEBUG("MessageProxy: %s", conn->mmsproxy); + GDEBUG("MessageProxy: %s", conn->mmsproxy); } if (context->mms_center && context->mms_center[0]) { conn->mmsc = context->mms_center; - MMS_DEBUG("MessageCenter: %s", conn->mmsc); + GDEBUG("MessageCenter: %s", conn->mmsc); } if (context->ifname && context->ifname[0]) { conn->netif = context->ifname; - MMS_DEBUG("Interface: %s", conn->netif); + GDEBUG("Interface: %s", conn->netif); } /* Listen for property changes */ @@ -286,8 +286,8 @@ mms_connection_ofono_dispose( GObject* object) { MMSConnectionOfono* self = MMS_CONNECTION_OFONO(object); - MMS_VERBOSE_("%p %s", self, self->imsi); - MMS_ASSERT(!mms_connection_is_active(&self->connection)); + GVERBOSE_("%p %s", self, self->imsi); + GASSERT(!mms_connection_is_active(&self->connection)); mms_connection_ofono_disconnect(self); if (self->sim) { ofono_simmgr_unref(self->sim); @@ -314,7 +314,7 @@ mms_connection_ofono_finalize( GObject* object) { MMSConnectionOfono* self = MMS_CONNECTION_OFONO(object); - MMS_VERBOSE_("%p %s", self, self->imsi); + GVERBOSE_("%p %s", self, self->imsi); g_free(self->imsi); G_OBJECT_CLASS(mms_connection_ofono_parent_class)->finalize(object); } @@ -341,7 +341,7 @@ void mms_connection_ofono_init( MMSConnectionOfono* self) { - MMS_VERBOSE_("%p", self); + GVERBOSE_("%p", self); } /* diff --git a/mms-connman-ofono/src/mms_connman_ofono.c b/mms-connman-ofono/src/mms_connman_ofono.c index 0323cb8..0283b32 100644 --- a/mms-connman-ofono/src/mms_connman_ofono.c +++ b/mms-connman-ofono/src/mms_connman_ofono.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_connman_ofono.h" @@ -23,9 +22,10 @@ #include /* Logging */ -#define MMS_LOG_MODULE_NAME mms_connman_log +#define GLOG_MODULE_NAME mms_connman_log #include "mms_connman_ofono_log.h" -MMS_LOG_MODULE_DEFINE("mms-connman-ofono"); +#include +GLOG_MODULE_DEFINE("mms-connman-ofono"); enum manager_handler_id { MANAGER_HANDLER_VALID_CHANGED, @@ -78,25 +78,25 @@ mms_connman_ofono_wait_valid( self->default_modem->modem && !ofono_modem_wait_valid(self->default_modem->modem, MMS_OFONO_TIMEOUT, &error)) { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } if (self->default_modem && self->default_modem->simmgr && !ofono_simmgr_wait_valid(self->default_modem->simmgr, MMS_OFONO_TIMEOUT, &error)) { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } if (self->default_modem && self->default_modem->connmgr && !ofono_connmgr_wait_valid(self->default_modem->connmgr, MMS_OFONO_TIMEOUT, &error)) { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } } else { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } } @@ -125,19 +125,19 @@ mms_connman_ofono_modem_for_imsi( return modem; } } - MMS_INFO("SIM %s is not avialable", imsi); + GINFO("SIM %s is not avialable", imsi); } else if (self->default_modem) { if (ofono_simmgr_valid(self->default_modem->simmgr)) { if (self->default_modem->simmgr->present) { return self->default_modem; } else { - MMS_INFO("SIM card is not present"); + GINFO("SIM card is not present"); } } else { - MMS_INFO("No SIM card found"); + GINFO("No SIM card found"); } } else { - MMS_WARN("No default modem"); + GWARN("No default modem"); } return NULL; } @@ -178,7 +178,7 @@ mms_connman_ofono_connection_gone( MMSOfonoModem* modem = value; if (((GObject*)modem->conn) == connection) { modem->conn = NULL; - MMS_VERBOSE_("%s", ofono_modem_path(modem->modem)); + GVERBOSE_("%s", ofono_modem_path(modem->modem)); break; } } @@ -215,7 +215,7 @@ mms_connman_ofono_open_connection( } return modem->conn; } else { - MMS_WARN("SIM %s has no MMS context", imsi); + GWARN("SIM %s has no MMS context", imsi); } } return NULL; @@ -243,9 +243,9 @@ mms_connman_ofono_select_default_modem( } if (self->default_modem != context) { if (context) { - MMS_INFO("Default modem %s", ofono_modem_path(context->modem)); + GINFO("Default modem %s", ofono_modem_path(context->modem)); } else { - MMS_INFO("No default modem"); + GINFO("No default modem"); } self->default_modem = context; } @@ -289,7 +289,7 @@ mms_connman_ofono_modem_added( { if (manager->valid) { MMSConnManOfono* self = MMS_CONNMAN_OFONO(arg); - MMS_ASSERT(manager == self->manager); + GASSERT(manager == self->manager); mms_connman_ofono_add_modem(self, modem); mms_connman_ofono_select_default_modem(self); } @@ -304,7 +304,7 @@ mms_connman_ofono_modem_removed( { if (manager->valid) { MMSConnManOfono* self = MMS_CONNMAN_OFONO(arg); - MMS_ASSERT(manager == self->manager); + GASSERT(manager == self->manager); g_hash_table_remove(self->modems, path); mms_connman_ofono_select_default_modem(self); } @@ -330,7 +330,7 @@ mms_connman_ofono_valid_changed( void* arg) { MMSConnManOfono* self = MMS_CONNMAN_OFONO(arg); - MMS_ASSERT(manager == self->manager); + GASSERT(manager == self->manager); if (manager->valid) { mms_connman_ofono_init_modems(self); } else { @@ -391,7 +391,7 @@ mms_connman_ofono_dispose( GObject* object) { MMSConnManOfono* self = MMS_CONNMAN_OFONO(object); - MMS_VERBOSE_(""); + GVERBOSE_(""); self->default_modem = NULL; g_hash_table_remove_all(self->modems); if (self->manager) { @@ -412,7 +412,7 @@ mms_connman_ofono_finalize( GObject* object) { MMSConnManOfono* self = MMS_CONNMAN_OFONO(object); - MMS_VERBOSE_(""); + GVERBOSE_(""); g_hash_table_destroy(self->modems); G_OBJECT_CLASS(mms_connman_ofono_parent_class)->finalize(object); } diff --git a/mms-engine/main.c b/mms-engine/main.c index fe85f80..0c568f5 100644 --- a/mms-engine/main.c +++ b/mms-engine/main.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include @@ -27,6 +26,8 @@ # include "mms_connman_ofono_log.h" #endif +#include + #define RET_OK (0) #define RET_ERR (1) @@ -43,7 +44,7 @@ typedef struct mms_app_options { /* All known log modules */ static MMSLogModule* mms_app_log_modules[] = { - &mms_log_default, + &gutil_log_default, #define MMS_LIB_LOG_MODULE(m) &(m), MMS_LIB_LOG_MODULES(MMS_LIB_LOG_MODULE) MMS_CONNMAN_LOG_MODULES(MMS_LIB_LOG_MODULE) @@ -57,7 +58,7 @@ mms_app_signal( gpointer arg) { MMSEngine* engine = arg; - MMS_INFO("Caught signal, shutting down..."); + GINFO("Caught signal, shutting down..."); mms_engine_stop(engine); return TRUE; } @@ -72,9 +73,9 @@ mms_app_bus_acquired( { MMSEngine* engine = arg; GError* error = NULL; - MMS_DEBUG("Bus acquired, starting..."); + GDEBUG("Bus acquired, starting..."); if (!mms_engine_register(engine, bus, &error)) { - MMS_ERR("Could not start: %s", MMS_ERRMSG(error)); + GERR("Could not start: %s", GERRMSG(error)); g_error_free(error); mms_engine_stop(engine); } @@ -87,7 +88,7 @@ mms_app_name_acquired( const gchar* name, gpointer arg) { - MMS_DEBUG("Acquired service name '%s'", name); + GDEBUG("Acquired service name '%s'", name); } static @@ -98,7 +99,7 @@ mms_app_name_lost( gpointer arg) { MMSEngine* engine = arg; - MMS_ERR("'%s' service already running or access denied", name); + GERR("'%s' service already running or access denied", name); mms_engine_stop(engine); } @@ -111,7 +112,7 @@ mms_app_option_loglevel( gpointer data, GError** error) { - return mms_log_parse_option(value, mms_app_log_modules, + return gutil_log_parse_option(value, mms_app_log_modules, G_N_ELEMENTS(mms_app_log_modules), error); } @@ -123,7 +124,7 @@ mms_app_option_logtype( gpointer data, GError** error) { - if (mms_log_set_type(value, MMS_APP_LOG_PREFIX)) { + if (gutil_log_set_type(value, MMS_APP_LOG_PREFIX)) { return TRUE; } else { if (error) { @@ -142,7 +143,7 @@ mms_app_option_verbose( gpointer data, GError** error) { - mms_log_default.level = MMS_LOGLEVEL_VERBOSE; + gutil_log_default.level = GLOG_LEVEL_VERBOSE; return TRUE; } @@ -178,7 +179,7 @@ mms_app_parse_options( char* idle_secs_help = g_strdup_printf( "Inactivity timeout in seconds [%d]", opt->config.idle_secs); - char* description = mms_log_description(NULL, 0); + char* description = gutil_log_description(NULL, 0); GOptionContext* options; GOptionEntry entries[] = { @@ -233,7 +234,7 @@ mms_app_parse_options( g_free(description); if (!ok) { - fprintf(stderr, "%s\n", MMS_ERRMSG(error)); + fprintf(stderr, "%s\n", GERRMSG(error)); g_error_free(error); *result = RET_ERR; return FALSE; @@ -252,9 +253,9 @@ mms_app_parse_options( #endif } else { #ifdef MMS_VERSION_STRING - MMS_INFO("Version %s starting", MMS_VERSION_STRING); + GINFO("Version %s starting", MMS_VERSION_STRING); #else - MMS_INFO("Starting"); + GINFO("Starting"); #endif if (size_limit_kb >= 0) { opt->settings.size_limit = size_limit_kb * 1024; @@ -275,10 +276,10 @@ mms_app_parse_options( if (opt->dir) opt->config.root_dir = opt->dir; if (keep_running) opt->flags |= MMS_ENGINE_FLAG_KEEP_RUNNING; if (session_bus) { - MMS_DEBUG("Attaching to session bus"); + GDEBUG("Attaching to session bus"); opt->bus_type = G_BUS_TYPE_SESSION; } else { - MMS_DEBUG("Attaching to system bus"); + GDEBUG("Attaching to system bus"); opt->bus_type = G_BUS_TYPE_SYSTEM; } *result = RET_OK; @@ -292,7 +293,7 @@ int main(int argc, char* argv[]) MMSAppOptions opt = {0}; mms_lib_init(argv[0]); gofono_log.name = "mms-ofono"; - mms_log_default.name = MMS_APP_LOG_PREFIX; + gutil_log_default.name = MMS_APP_LOG_PREFIX; mms_lib_default_config(&opt.config); mms_settings_sim_data_default(&opt.settings); if (mms_app_parse_options(&opt, argc, argv, &result)) { @@ -323,9 +324,9 @@ int main(int argc, char* argv[]) g_main_loop_unref(loop); mms_engine_unref(engine); } - MMS_INFO("Exiting"); + GINFO("Exiting"); } - if (mms_log_func == mms_log_syslog) { + if (gutil_log_func == gutil_log_syslog) { closelog(); } g_free(opt.dir); diff --git a/mms-engine/mms_engine.c b/mms-engine/mms_engine.c index b768694..549ffa4 100644 --- a/mms-engine/mms_engine.c +++ b/mms-engine/mms_engine.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_engine.h" @@ -20,9 +19,6 @@ #include "mms_handler_dbus.h" #include "mms_settings_dconf.h" #include "mms_transfer_list_dbus.h" -#include "mms_log.h" - -#include #ifdef SAILFISH # include "mms_connman_nemo.h" @@ -35,6 +31,9 @@ /* Generated code */ #include "org.nemomobile.MmsEngine.h" +#include +#include + /* Signals D-Bus proxy */ enum mms_engine_dbus_methods { MMS_ENGINE_METHOD_SEND_MESSAGE, @@ -105,8 +104,8 @@ mms_engine_start_timeout_callback( gpointer data) { MMSEngine* engine = data; - MMS_ASSERT(engine->start_timeout_id); - MMS_INFO("Shutting down due to inactivity..."); + GASSERT(engine->start_timeout_id); + GINFO("Shutting down due to inactivity..."); engine->start_timeout_id = 0; mms_engine_stop_schedule(engine); return FALSE; @@ -193,7 +192,7 @@ mms_engine_handle_send_message( g_free(imsi); } else { g_dbus_method_invocation_return_error(call, G_DBUS_ERROR, - G_DBUS_ERROR_FAILED, "%s", MMS_ERRMSG(error)); + G_DBUS_ERROR_FAILED, "%s", GERRMSG(error)); g_error_free(error); } @@ -230,7 +229,7 @@ mms_engine_handle_receive_message( { gsize len = 0; const guint8* bytes = g_variant_get_fixed_array(data, &len, 1); - MMS_DEBUG("Processing push %u bytes from %s", (guint)len, imsi); + GDEBUG("Processing push %u bytes from %s", (guint)len, imsi); if (imsi && bytes && len) { char* id = g_strdup_printf("%d", database_id); GBytes* push = g_bytes_new(bytes, len); @@ -243,7 +242,7 @@ mms_engine_handle_receive_message( org_nemomobile_mms_engine_complete_receive_message(proxy, call); } else { g_dbus_method_invocation_return_error(call, G_DBUS_ERROR, - G_DBUS_ERROR_FAILED, "%s", MMS_ERRMSG(error)); + G_DBUS_ERROR_FAILED, "%s", GERRMSG(error)); g_error_free(error); } g_bytes_unref(push); @@ -270,7 +269,7 @@ mms_engine_handle_send_read_report( { GError* error = NULL; char* id = g_strdup_printf("%d", database_id); - MMS_DEBUG_("%s %s %s %s %d", id, imsi, message_id, to, read_status); + GDEBUG_("%s %s %s %s %d", id, imsi, message_id, to, read_status); if (mms_dispatcher_send_read_report(engine->dispatcher, id, imsi, message_id, to, (read_status == 1) ? MMS_READ_STATUS_DELETED : MMS_READ_STATUS_READ, &error)) { @@ -280,7 +279,7 @@ mms_engine_handle_send_read_report( org_nemomobile_mms_engine_complete_send_read_report(proxy, call); } else { g_dbus_method_invocation_return_error(call, G_DBUS_ERROR, - G_DBUS_ERROR_FAILED, "%s", MMS_ERRMSG(error)); + G_DBUS_ERROR_FAILED, "%s", GERRMSG(error)); g_error_free(error); } g_free(id); @@ -298,7 +297,7 @@ mms_engine_handle_cancel( { char* id = NULL; if (database_id > 0) id = g_strdup_printf("%u", database_id); - MMS_DEBUG_("%s", id); + GDEBUG_("%s", id); mms_dispatcher_cancel(engine->dispatcher, id); org_nemomobile_mms_engine_complete_cancel(proxy, call); g_free(id); @@ -318,17 +317,17 @@ mms_engine_handle_push_notify( { gsize len = 0; const guint8* bytes = g_variant_get_fixed_array(data, &len, 1); - MMS_DEBUG("Received %u bytes from %s", (guint)len, imsi); + GDEBUG("Received %u bytes from %s", (guint)len, imsi); if (!type || g_ascii_strcasecmp(type, MMS_CONTENT_TYPE)) { - MMS_ERR("Unsupported content type %s", type); + GERR("Unsupported content type %s", type); g_dbus_method_invocation_return_error(call, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "Unsupported content type"); } else if (!imsi || !imsi[0]) { - MMS_ERR_("IMSI is missing"); + GERR_("IMSI is missing"); g_dbus_method_invocation_return_error(call, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "IMSI is missing"); } else if (!bytes || !len) { - MMS_ERR_("No data provided"); + GERR_("No data provided"); g_dbus_method_invocation_return_error(call, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No data provided"); } else { @@ -341,7 +340,7 @@ mms_engine_handle_push_notify( org_nemomobile_mms_engine_complete_push(proxy, call); } else { g_dbus_method_invocation_return_error(call, G_DBUS_ERROR, - G_DBUS_ERROR_FAILED, "%s", MMS_ERRMSG(err)); + G_DBUS_ERROR_FAILED, "%s", GERRMSG(err)); g_error_free(err); } g_bytes_unref(msg); @@ -378,7 +377,7 @@ mms_engine_handle_set_log_level( gint level, MMSEngine* engine) { - MMS_DEBUG_("%s:%d", module, level); + GDEBUG_("%s:%d", module, level); if (module && module[0]) { int i; for (i=0; ilog_count; i++) { @@ -389,7 +388,7 @@ mms_engine_handle_set_log_level( } } } else { - mms_log_default.level = level; + gutil_log_default.level = level; } org_nemomobile_mms_engine_complete_set_log_level(proxy, call); return TRUE; @@ -404,8 +403,8 @@ mms_engine_handle_set_log_type( const char* type, MMSEngine* engine) { - MMS_DEBUG_("%s", type); - mms_log_set_type(type, MMS_APP_LOG_PREFIX); + GDEBUG_("%s", type); + gutil_log_set_type(type, MMS_APP_LOG_PREFIX); org_nemomobile_mms_engine_complete_set_log_type(proxy, call); return TRUE; } @@ -423,14 +422,14 @@ mms_engine_handle_get_version( char* s = g_malloc(strlen(MMS_VERSION_STRING)+1); s[0] = 0; if (sscanf(MMS_VERSION_STRING, "%d.%d.%d%s", &v1, &v2, &v3, s) < 3) { - MMS_WARN_("unable to parse version %s", MMS_VERSION_STRING); + GWARN_("unable to parse version %s", MMS_VERSION_STRING); } else { - MMS_DEBUG_("version %d.%d.%d%s", v1, v2, v3, s); + GDEBUG_("version %d.%d.%d%s", v1, v2, v3, s); } org_nemomobile_mms_engine_complete_get_version(proxy, call, v1, v2, v3, s); g_free(s); #else - MMS_DEBUG_("oops"); + GDEBUG_("oops"); org_nemomobile_mms_engine_complete_get_version(proxy, call, 0, 0, 0, ""); #endif return TRUE; @@ -448,7 +447,7 @@ mms_engine_handle_migrate_settings( char* tmp = NULL; /* Querying settings will migrate per-SIM settings after upgrading * from 1.0.21 or older version of mme-engine */ - MMS_DEBUG_("%s", imsi); + GDEBUG_("%s", imsi); if (!imsi || !imsi[0]) { imsi = tmp = mms_connman_default_imsi(engine->cm); } @@ -568,7 +567,7 @@ mms_engine_run( MMSEngine* engine, GMainLoop* loop) { - MMS_ASSERT(!engine->loop); + GASSERT(!engine->loop); engine->loop = loop; engine->stopped = FALSE; engine->stop_requested = FALSE; @@ -628,7 +627,7 @@ mms_engine_delegate_dispatcher_done( MMSDispatcher* dispatcher) { MMSEngine* engine = mms_engine_from_dispatcher_delegate(delegate); - MMS_DEBUG("All done"); + GDEBUG("All done"); if (!engine->keep_running || engine->stop_requested) { mms_engine_stop_schedule(engine); } @@ -657,8 +656,8 @@ mms_engine_dispose( GObject* object) { MMSEngine* mms = MMS_ENGINE(object); - MMS_VERBOSE_("%p", mms); - MMS_ASSERT(!mms->loop); + GVERBOSE_("%p", mms); + GASSERT(!mms->loop); mms_engine_unregister(mms); mms_engine_start_timeout_cancel(mms); if (mms->proxy) { @@ -692,9 +691,9 @@ mms_engine_class_init( MMSEngineClass* klass) { GObjectClass* object_class = G_OBJECT_CLASS(klass); - MMS_ASSERT(object_class); + GASSERT(object_class); object_class->dispose = mms_engine_dispose; - MMS_VERBOSE_("done"); + GVERBOSE_("done"); } /* diff --git a/mms-handler-dbus/src/mms_handler_dbus.c b/mms-handler-dbus/src/mms_handler_dbus.c index 8345028..85143ab 100644 --- a/mms-handler-dbus/src/mms_handler_dbus.c +++ b/mms-handler-dbus/src/mms_handler_dbus.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Jolla Ltd. + * Copyright (C) 2013-2016 Jolla Ltd. * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify @@ -10,15 +10,15 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_handler_dbus.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_handler_log +#define GLOG_MODULE_NAME mms_handler_log #include "mms_lib_log.h" -MMS_LOG_MODULE_DEFINE("mms-handler-dbus"); +#include +GLOG_MODULE_DEFINE("mms-handler-dbus"); /* Generated code */ #include "org.nemomobile.MmsHandler.h" @@ -151,7 +151,7 @@ mms_handler_dbus_connect( G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, "org.nemomobile.MmsHandler", "/", NULL, &error); if (!dbus->proxy) { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } } @@ -176,18 +176,18 @@ mms_handler_dbus_message_notify_done( gboolean ok = org_nemomobile_mms_handler_call_message_notification_finish( ORG_NEMOMOBILE_MMS_HANDLER(proxy), &id, result, &error); if (ok) { - MMS_DEBUG_("id=%s", id); - MMS_ASSERT(id); + GDEBUG_("id=%s", id); + GASSERT(id); } else { - MMS_ERR("%s", MMS_ERRMSG(error)); - MMS_ASSERT(!id); + GERR("%s", GERRMSG(error)); + GASSERT(!id); g_error_free(error); } if (call->cb) { void* param = g_hash_table_lookup(dbus->notify_pending, call); call->cb(call, id, param); } - MMS_VERIFY(g_hash_table_remove(dbus->notify_pending, call)); + GVERIFY(g_hash_table_remove(dbus->notify_pending, call)); mms_handler_busy_dec(&dbus->handler); g_free(id); } @@ -230,7 +230,7 @@ mms_handler_dbus_message_notify_cancel( MMSHandler* handler, MMSHandlerMessageNotifyCall* call) { - MMS_ASSERT(call->cb); + GASSERT(call->cb); call->cb = NULL; g_cancellable_cancel(call->cancellable); } @@ -252,14 +252,14 @@ mms_handler_dbus_message_received_done( gboolean ok = org_nemomobile_mms_handler_call_message_received_finish( ORG_NEMOMOBILE_MMS_HANDLER(proxy), result, &error); if (!ok) { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } if (call->cb) { void* param = g_hash_table_lookup(dbus->received_pending, call); call->cb(call, call->msg, ok, param); } - MMS_VERIFY(g_hash_table_remove(dbus->received_pending, call)); + GVERIFY(g_hash_table_remove(dbus->received_pending, call)); mms_handler_busy_dec(&dbus->handler); } @@ -274,7 +274,7 @@ mms_handler_dbus_message_received( { MMSHandlerMessageReceivedCall* call = NULL; OrgNemomobileMmsHandler* proxy = mms_handler_dbus_connect(handler); - MMS_ASSERT(msg->id && msg->id[0]); + GASSERT(msg->id && msg->id[0]); if (msg->id && msg->id[0] && proxy) { MMSHandlerDbus* dbus = MMS_HANDLER_DBUS(handler); const char* nothing = NULL; @@ -313,7 +313,7 @@ mms_handler_dbus_message_received_cancel( MMSHandler* handler, MMSHandlerMessageReceivedCall* call) { - MMS_ASSERT(call->cb); + GASSERT(call->cb); call->cb = NULL; g_cancellable_cancel(call->cancellable); } @@ -336,7 +336,7 @@ mms_handler_dbus_call_done( if (ret) { g_variant_unref(ret); } else { - MMS_ERR("%s", MMS_ERRMSG(err)); + GERR("%s", GERRMSG(err)); g_error_free(err); } mms_handler_busy_dec(handler); @@ -352,7 +352,7 @@ mms_handler_dbus_message_receive_state_changed( MMS_RECEIVE_STATE state) { OrgNemomobileMmsHandler* proxy = mms_handler_dbus_connect(handler); - MMS_ASSERT(id && id[0]); + GASSERT(id && id[0]); if (id && id[0] && proxy) { mms_handler_ref(handler); mms_handler_busy_inc(handler); @@ -373,7 +373,7 @@ mms_handler_dbus_message_send_state_changed( const char* details) { OrgNemomobileMmsHandler* proxy = mms_handler_dbus_connect(handler); - MMS_ASSERT(id && id[0]); + GASSERT(id && id[0]); if (id && id[0] && proxy) { mms_handler_ref(handler); mms_handler_busy_inc(handler); @@ -394,7 +394,7 @@ mms_handler_dbus_message_sent( const char* msgid) { OrgNemomobileMmsHandler* proxy = mms_handler_dbus_connect(handler); - MMS_ASSERT(id && id[0]); + GASSERT(id && id[0]); if (id && id[0] && msgid && msgid[0] && proxy) { mms_handler_ref(handler); mms_handler_busy_inc(handler); diff --git a/mms-lib/Makefile b/mms-lib/Makefile index c24b820..ef62b35 100644 --- a/mms-lib/Makefile +++ b/mms-lib/Makefile @@ -103,10 +103,6 @@ ifneq ($(KEEP_SYMBOLS),0) RELEASE_FLAGS += -g endif -ifneq ($(MMS_LOG_SYSLOG),) -DEFINES += -DMMS_LOG_SYSLOG=$(MMS_LOG_SYSLOG) -endif - DEBUG_CFLAGS = $(DEFINES) $(DEBUG_FLAGS) $(DEBUG_DEFS) $(CFLAGS) RELEASE_CFLAGS = $(DEFINES) $(RELEASE_FLAGS) $(RELEASE_DEFS) $(CFLAGS) DEBUG_CPPFLAGS = -Wno-psabi $(RESIZE_CPPFLAGS) $(DEBUG_CFLAGS) diff --git a/mms-lib/include/mms_lib_log.h b/mms-lib/include/mms_lib_log.h index 8099898..04c2093 100644 --- a/mms-lib/include/mms_lib_log.h +++ b/mms-lib/include/mms_lib_log.h @@ -10,13 +10,12 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #ifndef JOLLA_MMS_LIB_LOG_H #define JOLLA_MMS_LIB_LOG_H -#include "mms_log.h" +#include "gutil_types.h" #define MMS_LIB_LOG_MODULES(log) \ log(mms_dispatcher_log)\ diff --git a/mms-lib/include/mms_log.h b/mms-lib/include/mms_log.h deleted file mode 100644 index 4f50bc1..0000000 --- a/mms-lib/include/mms_log.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2013-2016 Jolla Ltd. - * Contact: Slava Monich - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#ifndef JOLLA_MMS_LOG_H -#define JOLLA_MMS_LOG_H - -#include "mms_lib_types.h" - -#ifdef MMS_LOG_MODULE_NAME -# define GLOG_MODULE_NAME MMS_LOG_MODULE_NAME -#endif - -#include - -#define MMS_LOG_MODULE_CURRENT GLOG_MODULE_CURRENT - -#define mms_log gutil_log -#define mms_logv gutil_logv -#define mms_log_default gutil_log_default -#define mms_log_parse_option gutil_log_parse_option -#define mms_log_set_type gutil_log_set_type -#define mms_log_description gutil_log_description -#define mms_log_func gutil_log_func -#define mms_log_syslog gutil_log_syslog -#define mms_log_stdout_timestamp gutil_log_timestamp - -#define MMS_LOG_TYPE_STDOUT GLOG_TYPE_STDOUT - -#define MMS_LOGLEVEL_NONE GLOG_LEVEL_NONE -#define MMS_LOGLEVEL_ERR GLOG_LEVEL_ERR -#define MMS_LOGLEVEL_WARN GLOG_LEVEL_WARN -#define MMS_LOGLEVEL_INFO GLOG_LEVEL_INFO -#define MMS_LOGLEVEL_DEBUG GLOG_LEVEL_DEBUG -#define MMS_LOGLEVEL_VERBOSE GLOG_LEVEL_VERBOSE - -#define MMS_ERRMSG(err) GERRMSG(err) - -#define MMS_LOG_ENABLED GUTIL_LOG_ANY -#define MMS_LOG_ERR GUTIL_LOG_ERR -#define MMS_LOG_WARN GUTIL_LOG_WARN -#define MMS_LOG_INFO GUTIL_LOG_INFO -#define MMS_LOG_DEBUG GUTIL_LOG_DEBUG -#define MMS_LOG_VERBOSE GUTIL_LOG_VERBOSE -#define MMS_LOG_ASSERT GUTIL_LOG_ASSERT - -#define MMS_LOG_MODULE_DEFINE(x) GLOG_MODULE_DEFINE(x) -#define MMS_LOG_MODULE_DEFINE2(x,y) GLOG_MODULE_DEFINE2(x,y) - -#define MMS_ASSERT(expr) GASSERT(expr) -#define MMS_VERIFY(expr) GVERIFY(expr) - -#ifdef GLOG_VARARGS -# define MMS_ERR(f,args...) GERR(f,##args) -# define MMS_ERR_(f,args...) GERR_(f,##args) -# define MMS_WARN(f,args...) GWARN(f,##args) -# define MMS_WARN_(f,args...) GWARN_(f,##args) -# define MMS_INFO(f,args...) GINFO(f,##args) -# define MMS_INFO_(f,args...) GINFO_(f,##args) -# define MMS_DEBUG(f,args...) GDEBUG(f,##args) -# define MMS_DEBUG_(f,args...) GDEBUG_(f,##args) -# define MMS_VERBOSE(f,args...) GVERBOSE(f,##args) -# define MMS_VERBOSE_(f,args...) GVERBOSE_(f,##args) -#else -# define MMS_ERR GERR -# define MMS_ERR_ GERR_ -# define MMS_WARN GWARN -# define MMS_WARN_ GWARN_ -# define MMS_INFO GINFO -# define MMS_INFO_ GINFO_ -# define MMS_DEBUG GDEBUG -# define MMS_DEBUG_ GDEBUG_ -# define MMS_VERBOSE GVERBOSE -# define MMS_VERBOSE_ GVERBOSE_ -#endif /* GLOG_VARARGS */ - -#endif /* JOLLA_MMS_LOG_H */ - -/* - * Local Variables: - * mode: C - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/mms-lib/src/mms_attachment.c b/mms-lib/src/mms_attachment.c index 472cfd7..1e0cd28 100644 --- a/mms-lib/src/mms_attachment.c +++ b/mms-lib/src/mms_attachment.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Jolla Ltd. + * Copyright (C) 2013-2016 Jolla Ltd. * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_attachment.h" @@ -23,15 +22,14 @@ #endif /* Logging */ -#define MMS_LOG_MODULE_NAME mms_attachment_log -#include "mms_lib_log.h" +#define GLOG_MODULE_NAME mms_attachment_log #include "mms_error.h" -MMS_LOG_MODULE_DEFINE("mms-attachment"); +GLOG_MODULE_DEFINE("mms-attachment"); #define MMS_ATTACHMENT_DEFAULT_TYPE "application/octet-stream" #define CONTENT_TYPE_PARAM_NAME "name" -G_DEFINE_TYPE(MMSAttachment, mms_attachment, G_TYPE_OBJECT); +G_DEFINE_TYPE(MMSAttachment, mms_attachment, G_TYPE_OBJECT) #define MMS_ATTACHMENT(obj) \ (G_TYPE_CHECK_INSTANCE_CAST((obj), MMS_TYPE_ATTACHMENT, MMSAttachment)) @@ -58,7 +56,7 @@ mms_attachment_finalize( GObject* object) { MMSAttachment* at = MMS_ATTACHMENT(object); - MMS_VERBOSE_("%p", at); + GVERBOSE_("%p", at); if (at->map) g_mapped_file_unref(at->map); if (!at->config->keep_temp_files && !(at->flags & MMS_ATTACHMENT_KEEP_FILES)) { @@ -87,7 +85,7 @@ void mms_attachment_init( MMSAttachment* at) { - MMS_VERBOSE_("%p", at); + GVERBOSE_("%p", at); } static @@ -143,7 +141,7 @@ mms_attachment_write_smil( /* Check if we have text region, image region or both */ for (i=0; iflags & MMS_ATTACHMENT_SMIL)); + GASSERT(!(at->flags & MMS_ATTACHMENT_SMIL)); if (g_str_has_prefix(at->content_type, MEDIA_TYPE_TEXT_PREFIX)) { text_region = text_region_1; } else { @@ -173,7 +171,7 @@ mms_attachment_write_smil( const char* ct = at->content_type; const char* elem; const char* region; - MMS_ASSERT(!(at->flags & MMS_ATTACHMENT_SMIL)); + GASSERT(!(at->flags & MMS_ATTACHMENT_SMIL)); if (g_str_has_prefix(ct, MEDIA_TYPE_TEXT_PREFIX)) { elem = MEDIA_TEXT; region = REGION_TEXT; @@ -228,7 +226,7 @@ mms_attachment_guess_content_type( } if (!detected_type) { - MMS_WARN("No mime type for %s", path); + GWARN("No mime type for %s", path); detected_type = MMS_ATTACHMENT_DEFAULT_TYPE; } @@ -255,7 +253,7 @@ mms_attachment_new_smil( FILE* f = fdopen(fd, "w"); if (f) { gboolean ok; - MMS_VERBOSE("Writing SMIL %s", path); + GVERBOSE("Writing SMIL %s", path); ok = mms_attachment_write_smil(f, ats, n, error); fclose(f); if (ok) { @@ -264,7 +262,7 @@ mms_attachment_new_smil( ai.content_type = SMIL_CONTENT_TYPE "; charset=utf-8"; ai.content_id = NULL; smil = mms_attachment_new(config, &ai, error); - MMS_ASSERT(smil && (smil->flags & MMS_ATTACHMENT_SMIL)); + GASSERT(smil && (smil->flags & MMS_ATTACHMENT_SMIL)); } } else { MMS_ERROR(error, MMS_LIB_ERROR_IO, @@ -350,7 +348,7 @@ mms_attachment_new( content_type = mms_unparse_http_content_type((char**)ct); } - MMS_DEBUG("%s: %s", path, content_type); + GDEBUG("%s: %s", path, content_type); if (!strcmp(media_type, "image/jpeg")) { type = MMS_TYPE_ATTACHMENT_JPEG; diff --git a/mms-lib/src/mms_attachment_image.c b/mms-lib/src/mms_attachment_image.c index d44bfd4..a5658c7 100644 --- a/mms-lib/src/mms_attachment_image.c +++ b/mms-lib/src/mms_attachment_image.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2013-2014 Jolla Ltd. + * Copyright (C) 2013-2016 Jolla Ltd. + * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -9,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_attachment_image.h" @@ -21,10 +21,10 @@ #endif /* Logging */ -#define MMS_LOG_MODULE_NAME mms_attachment_log -#include "mms_lib_log.h" +#define GLOG_MODULE_NAME mms_attachment_log +#include -G_DEFINE_TYPE(MMSAttachmentImage, mms_attachment_image, MMS_TYPE_ATTACHMENT); +G_DEFINE_TYPE(MMSAttachmentImage, mms_attachment_image, MMS_TYPE_ATTACHMENT) #define MMS_ATTACHMENT_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ MMS_TYPE_ATTACHMENT_IMAGE, MMSAttachmentImage)) #define MMS_ATTACHMENT_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \ @@ -97,7 +97,7 @@ mms_attachment_image_resize_default( const unsigned int cols = src_cols/(next_step+1); const unsigned int rows = src_rows/(next_step+1); Image* dest; - MMS_DEBUG("Resizing (%ux%u -> %ux%u) with ImageMagick", + GDEBUG("Resizing (%ux%u -> %ux%u) with ImageMagick", src_cols, src_rows, cols, rows); dest = ResizeImage(src, cols, rows, BoxFilter, 1.0, &ex); if (dest) { @@ -107,17 +107,17 @@ mms_attachment_image_resize_default( info->filename[G_N_ELEMENTS(info->filename)-1] = 0; dest->filename[G_N_ELEMENTS(dest->filename)-1] = 0; if (WriteImage(info, dest)) { - MMS_DEBUG("Resized %s with ImageMagick", fname); + GDEBUG("Resized %s with ImageMagick", fname); ok = TRUE; } else { - MMS_ERR("Failed to write %s", dest->filename); + GERR("Failed to write %s", dest->filename); } DestroyImage(dest); } } DestroyImage(src); } else { - MMS_ERR("Failed to read %s", info->filename); + GERR("Failed to read %s", info->filename); } ClearMagickException(&ex); DestroyExceptionInfo(&ex); @@ -160,8 +160,8 @@ mms_attachment_image_resize_type_specific( klass->fn_resize_free(resize); resize = klass->fn_resize_new(image, at->original_file); if (!resize) return FALSE; - MMS_ASSERT(resize->image.width == image_size.width); - MMS_ASSERT(resize->image.height == image_size.height); + GASSERT(resize->image.width == image_size.width); + GASSERT(resize->image.height == image_size.height); resize->in = image_size; resize->out = out_size; can_resize = klass->fn_resize_prepare(resize, fname); @@ -174,7 +174,7 @@ mms_attachment_image_resize_type_specific( resize->in.height == resize->out.height) { /* Nothing to resize, image decompressor is doing all * the job for us */ - MMS_DEBUG("Decoder-assisted resize (%ux%u -> %ux%u)", + GDEBUG("Decoder-assisted resize (%ux%u -> %ux%u)", image_size.width, image_size.height, out_size.width, out_size.height); for (y=0; @@ -188,7 +188,7 @@ mms_attachment_image_resize_type_specific( gsize bufsize = 3*resize->out.width*sizeof(guint); guint* buf = g_malloc(bufsize); memset(buf, 0, bufsize); - MMS_DEBUG("Resizing (%ux%u -> %ux%u)", + GDEBUG("Resizing (%ux%u -> %ux%u)", image_size.width, image_size.height, out_size.width, out_size.height); for (y=0; @@ -237,7 +237,7 @@ mms_attachment_image_resize_type_specific( } if (y == resize->in.height) { - MMS_DEBUG("Resized %s", fname); + GDEBUG("Resized %s", fname); image->resize_step = next_step; ok = TRUE; } @@ -273,7 +273,7 @@ mms_attachment_image_resize( at->file_name = image->resized; at->map = map; } else { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); ok = FALSE; } diff --git a/mms-lib/src/mms_attachment_jpeg.c b/mms-lib/src/mms_attachment_jpeg.c index 4750408..b6addf1 100644 --- a/mms-lib/src/mms_attachment_jpeg.c +++ b/mms-lib/src/mms_attachment_jpeg.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2013-2014 Jolla Ltd. + * Copyright (C) 2013-2016 Jolla Ltd. + * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -9,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_attachment_image.h" @@ -20,14 +20,14 @@ #include /* Logging */ -#define MMS_LOG_MODULE_NAME mms_attachment_log -#include "mms_lib_log.h" +#define GLOG_MODULE_NAME mms_attachment_log +#include typedef MMSAttachmentImageClass MMSAttachmentJpegClass; typedef MMSAttachmentImage MMSAttachmentJpeg; G_DEFINE_TYPE(MMSAttachmentJpeg, mms_attachment_jpeg, \ - MMS_TYPE_ATTACHMENT_IMAGE); + MMS_TYPE_ATTACHMENT_IMAGE) #define MMS_ATTACHMENT_JPEG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ MMS_TYPE_ATTACHMENT_JPEG, MMSAttachmentJpeg)) @@ -59,7 +59,7 @@ mms_attachment_jpeg_error_log( buf[0] = 0; cinfo->err->format_message(cinfo, buf); buf[JMSG_LENGTH_MAX-1] = 0; - mms_log(MMS_LOG_MODULE_CURRENT, level, "%s", buf); + gutil_log(GLOG_MODULE_CURRENT, level, "%s", buf); g_free(buf); } @@ -69,7 +69,7 @@ mms_attachment_jpeg_error_exit( j_common_ptr cinfo) { MMSAttachmentJpegError* err = (MMSAttachmentJpegError*)cinfo->err; - mms_attachment_jpeg_error_log(MMS_LOGLEVEL_WARN, cinfo); + mms_attachment_jpeg_error_log(GLOG_LEVEL_WARN, cinfo); longjmp(err->setjmp_buf, 1); } @@ -78,7 +78,7 @@ void mms_attachment_jpeg_error_output( j_common_ptr cinfo) { - mms_attachment_jpeg_error_log(MMS_LOGLEVEL_DEBUG, cinfo); + mms_attachment_jpeg_error_log(GLOG_LEVEL_DEBUG, cinfo); } static diff --git a/mms-lib/src/mms_attachment_qt.cpp b/mms-lib/src/mms_attachment_qt.cpp index 3c2d54c..d6074bc 100644 --- a/mms-lib/src/mms_attachment_qt.cpp +++ b/mms-lib/src/mms_attachment_qt.cpp @@ -1,5 +1,6 @@ /* - * Copyright (C) 2013-2014 Jolla Ltd. + * Copyright (C) 2013-2016 Jolla Ltd. + * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -9,12 +10,11 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ extern "C" { -#define MMS_LOG_MODULE_NAME mms_attachment_log -#include "mms_lib_log.h" +#define GLOG_MODULE_NAME mms_attachment_log +#include #include "mms_attachment_image.h" } @@ -37,7 +37,7 @@ mms_attachment_image_resize_qt( const int w1 = w/(step+1); QImage scaled = qimage.scaledToWidth(w1, Qt::SmoothTransformation); if (scaled.save(fname)) { - MMS_DEBUG("Scaling %s (%dx%d -> %dx%d) with Qt", fname, w, h, + GDEBUG("Scaling %s (%dx%d -> %dx%d) with Qt", fname, w, h, scaled.width(), scaled.height()); image->resize_step = step; ok = TRUE; diff --git a/mms-lib/src/mms_codec.c b/mms-lib/src/mms_codec.c index 2a9d27c..ab364e8 100644 --- a/mms-lib/src/mms_codec.c +++ b/mms-lib/src/mms_codec.c @@ -1,9 +1,8 @@ /* - * * Multimedia Messaging Service * * Copyright (C) 2010-2011 Intel Corporation. All rights reserved. - * Copyright (C) 2013-2015 Jolla Ltd. + * Copyright (C) 2013-2016 Jolla Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -13,11 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * */ #ifdef HAVE_CONFIG_H @@ -42,9 +36,9 @@ #include "mms_codec.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_codec_log -#include "mms_lib_log.h" -MMS_LOG_MODULE_DEFINE("mms-codec"); +#define GLOG_MODULE_NAME mms_codec_log +#include +GLOG_MODULE_DEFINE("mms-codec"); #define MAX_ENC_VALUE_BYTES 6 @@ -540,7 +534,7 @@ static char *decode_encoded_string_with_mib_enum(const unsigned char *p, &bytes_read, &bytes_written, &error); if (!converted) { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } @@ -1355,7 +1349,7 @@ static gboolean mms_parse_attachments(struct wsp_header_iter *iter, * parsing the rest of the PDU. And yes, it does * happen in real life. */ - MMS_WARN("Failed to parse part headers"); + GWARN("Failed to parse part headers"); } if (wsp_header_iter_at_end(&hi) == FALSE) { diff --git a/mms-lib/src/mms_codec.h b/mms-lib/src/mms_codec.h index 527c5c6..8f7c079 100644 --- a/mms-lib/src/mms_codec.h +++ b/mms-lib/src/mms_codec.h @@ -1,9 +1,8 @@ /* - * * Multimedia Messaging Service * * Copyright (C) 2010-2011 Intel Corporation. All rights reserved. - * Copyright (C) 2013-2015 Jolla Ltd. + * Copyright (C) 2013-2016 Jolla Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -13,13 +12,13 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * */ +#ifndef MMS_CODEC_H +#define MMS_CODEC_H + +#include + enum mms_message_type { MMS_MESSAGE_TYPE_SEND_REQ = 128, MMS_MESSAGE_TYPE_SEND_CONF = 129, @@ -213,3 +212,5 @@ gboolean mms_message_decode(const unsigned char *pdu, unsigned int len, struct mms_message *out); gboolean mms_message_encode(struct mms_message *msg, int fd); void mms_message_free(struct mms_message *msg); + +#endif /* MMS_CODEC_H_ */ diff --git a/mms-lib/src/mms_connection.c b/mms-lib/src/mms_connection.c index 174cbd5..cd17ba6 100644 --- a/mms-lib/src/mms_connection.c +++ b/mms-lib/src/mms_connection.c @@ -10,14 +10,13 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_connection.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_connection_log -#include "mms_lib_log.h" +#define GLOG_MODULE_NAME mms_connection_log +#include G_DEFINE_ABSTRACT_TYPE(MMSConnection, mms_connection, G_TYPE_OBJECT) #define MMS_CONNECTION_GET_CLASS(obj) \ @@ -108,7 +107,7 @@ void mms_connection_init( MMSConnection* self) { - MMS_VERBOSE_("%p", self); + GVERBOSE_("%p", self); } /** @@ -119,7 +118,7 @@ void mms_connection_finalize( GObject* object) { - MMS_VERBOSE_("%p", object); + GVERBOSE_("%p", object); G_OBJECT_CLASS(mms_connection_parent_class)->finalize(object); } diff --git a/mms-lib/src/mms_connman.c b/mms-lib/src/mms_connman.c index 5b93160..6ad29de 100644 --- a/mms-lib/src/mms_connman.c +++ b/mms-lib/src/mms_connman.c @@ -10,14 +10,13 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_connman.h" /* Logging */ #define MMS_LOG_MODULE_NAME mms_connman_log -#include "mms_lib_log.h" +#include G_DEFINE_ABSTRACT_TYPE(MMSConnMan, mms_connman, G_TYPE_OBJECT) #define MMS_CONNMAN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\ @@ -75,7 +74,7 @@ void mms_connman_finalize( GObject* object) { - MMS_ASSERT(!MMS_CONNMAN(object)->busy); + GASSERT(!MMS_CONNMAN(object)->busy); G_OBJECT_CLASS(mms_connman_parent_class)->finalize(object); } @@ -145,11 +144,11 @@ mms_connman_busy_update( MMSConnMan* cm, int change) { - MMS_ASSERT(change); + GASSERT(change); if (cm && change) { cm->busy += change; - MMS_VERBOSE("busy count %d", cm->busy); - MMS_ASSERT(cm->busy >= 0); + GVERBOSE("busy count %d", cm->busy); + GASSERT(cm->busy >= 0); if (cm->busy < 1) { g_signal_emit(cm, mms_connman_sig[MMS_CONNMAN_SIGNAL_DONE], 0); } diff --git a/mms-lib/src/mms_dispatcher.c b/mms-lib/src/mms_dispatcher.c index fb73de5..52cc7fe 100644 --- a/mms-lib/src/mms_dispatcher.c +++ b/mms-lib/src/mms_dispatcher.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_dispatcher.h" @@ -27,10 +26,9 @@ #include /* Logging */ -#define MMS_LOG_MODULE_NAME mms_dispatcher_log -#include "mms_lib_log.h" +#define GLOG_MODULE_NAME mms_dispatcher_log #include "mms_error.h" -MMS_LOG_MODULE_DEFINE("mms-dispatcher"); +GLOG_MODULE_DEFINE("mms-dispatcher"); struct mms_dispatcher { gint ref_count; @@ -97,7 +95,7 @@ mms_dispatcher_drop_connection( MMSDispatcher* disp) { if (disp->connection) { - MMS_ASSERT(!mms_connection_is_active(disp->connection)); + GASSERT(!mms_connection_is_active(disp->connection)); mms_connection_remove_handler(disp->connection, disp->connection_changed_id); disp->connection_changed_id = 0; @@ -121,7 +119,7 @@ mms_dispatcher_close_connection( if (disp->connection) { mms_connection_close(disp->connection); /* Assert that connection state changes are asynchronous */ - MMS_ASSERT(disp->connection); + GASSERT(disp->connection); if (!mms_connection_is_active(disp->connection)) { mms_dispatcher_drop_connection(disp); } @@ -188,7 +186,7 @@ void mms_dispatcher_network_idle_run( MMSDispatcher* disp) { - MMS_ASSERT(disp->network_idle_id); + GASSERT(disp->network_idle_id); disp->network_idle_id = 0; mms_dispatcher_close_connection(disp); } @@ -200,7 +198,7 @@ mms_dispatcher_network_idle_check( { if (disp->connection && !disp->network_idle_id) { /* Schedule idle inactivity timeout callback */ - MMS_VERBOSE("Network connection is inactive"); + GVERBOSE("Network connection is inactive"); disp->network_idle_id = mms_dispatcher_timeout_callback_schedule(disp, disp->settings->config->idle_secs, mms_dispatcher_network_idle_run); } @@ -212,7 +210,7 @@ mms_dispatcher_network_idle_cancel( MMSDispatcher* disp) { if (disp->network_idle_id) { - MMS_VERBOSE("Cancel network inactivity timeout"); + GVERBOSE("Cancel network inactivity timeout"); g_source_remove(disp->network_idle_id); disp->network_idle_id = 0; } @@ -226,8 +224,8 @@ void mms_dispatcher_next_run( MMSDispatcher* disp) { - MMS_ASSERT(disp->next_run_id); - MMS_ASSERT(!disp->active_task); + GASSERT(disp->next_run_id); + GASSERT(!disp->active_task); disp->next_run_id = 0; if (!disp->active_task) { mms_dispatcher_run(disp); @@ -255,8 +253,8 @@ mms_dispatcher_connection_state_changed( { MMSDispatcher* disp = data; MMS_CONNECTION_STATE state = mms_connection_state(conn); - MMS_DEBUG("%s %s", conn->imsi, mms_connection_state_name(conn)); - MMS_ASSERT(conn == disp->connection); + GDEBUG("%s %s", conn->imsi, mms_connection_state_name(conn)); + GASSERT(conn == disp->connection); if (state == MMS_CONNECTION_STATE_FAILED || state == MMS_CONNECTION_STATE_CLOSED) { GList* entry; @@ -293,7 +291,7 @@ mms_dispatcher_set_delegate( MMSDispatcher* disp, MMSDispatcherDelegate* delegate) { - MMS_ASSERT(!disp->delegate || !delegate); + GASSERT(!disp->delegate || !delegate); disp->delegate = delegate; } @@ -328,8 +326,8 @@ mms_dispatcher_sort_cb( gboolean connection_is_open = mms_connection_state(disp->connection) == MMS_CONNECTION_STATE_OPEN; - MMS_ASSERT(task1); - MMS_ASSERT(task2); + GASSERT(task1); + GASSERT(task2); if (task1 == task2) { return 0; } @@ -419,7 +417,7 @@ mms_dispatcher_pick_next_task( (task->state == MMS_TASK_STATE_NEED_USER_CONNECTION) ? MMS_CONNECTION_TYPE_USER : MMS_CONNECTION_TYPE_AUTO); if (disp->connection) { - MMS_ASSERT(!disp->connection_changed_id); + GASSERT(!disp->connection_changed_id); disp->connection_changed_id = mms_connection_add_state_change_handler( disp->connection, @@ -458,9 +456,9 @@ mms_dispatcher_run( MMSDispatcher* disp) { MMSTask* task; - MMS_ASSERT(!disp->active_task); + GASSERT(!disp->active_task); while ((task = mms_dispatcher_pick_next_task(disp)) != NULL) { - MMS_DEBUG("%s %s", task->name, mms_task_state_name(task->state)); + GDEBUG("%s %s", task->name, mms_task_state_name(task->state)); disp->active_task = task; switch (task->state) { case MMS_TASK_STATE_READY: @@ -471,8 +469,8 @@ mms_dispatcher_run( case MMS_TASK_STATE_NEED_USER_CONNECTION: /* mms_dispatcher_pick_next_task() has checked that the right * connection is active, we can send/receive the data */ - MMS_ASSERT(mms_connection_is_open(disp->connection)); - MMS_ASSERT(!strcmp(task->imsi, disp->connection->imsi)); + GASSERT(mms_connection_is_open(disp->connection)); + GASSERT(!strcmp(task->imsi, disp->connection->imsi)); mms_task_transmit(task, disp->connection); break; @@ -530,7 +528,7 @@ mms_dispatcher_start( return TRUE; } } else { - MMS_ERR("Failed to create %s: %s", root_dir, strerror(errno)); + GERR("Failed to create %s: %s", root_dir, strerror(errno)); } return FALSE; } @@ -590,7 +588,7 @@ mms_dispatcher_receive_message( gboolean ok = FALSE; MMSPdu* pdu = mms_decode_bytes(bytes); if (pdu) { - MMS_ASSERT(pdu->type == MMS_MESSAGE_TYPE_NOTIFICATION_IND); + GASSERT(pdu->type == MMS_MESSAGE_TYPE_NOTIFICATION_IND); if (pdu->type == MMS_MESSAGE_TYPE_NOTIFICATION_IND) { const MMSConfig* config = disp->settings->config; ok = mms_dispatcher_queue_and_unref_task(disp, @@ -731,7 +729,7 @@ mms_dispatcher_handler_done( void* param) { MMSDispatcher* disp = param; - MMS_VERBOSE("Handler is inactive"); + GVERBOSE("Handler is inactive"); mms_dispatcher_next_run_schedule(disp); } @@ -745,7 +743,7 @@ mms_dispatcher_connman_done( void* param) { MMSDispatcher* disp = param; - MMS_VERBOSE("Connman is inactive"); + GVERBOSE("Connman is inactive"); mms_dispatcher_check_if_done(disp); } @@ -789,7 +787,7 @@ mms_dispatcher_finalize( MMSTask* task; const char* root_dir = disp->settings->config->root_dir; char* msg_dir = g_strconcat(root_dir, "/" MMS_MESSAGE_DIR "/", NULL); - MMS_VERBOSE_(""); + GVERBOSE_(""); mms_handler_remove_callback(disp->handler, disp->handler_done_id); mms_connman_remove_callback(disp->cm, disp->connman_done_id); mms_dispatcher_drop_connection(disp); @@ -817,7 +815,7 @@ mms_dispatcher_ref( MMSDispatcher* disp) { if (disp) { - MMS_ASSERT(disp->ref_count > 0); + GASSERT(disp->ref_count > 0); g_atomic_int_inc(&disp->ref_count); } return disp; @@ -828,7 +826,7 @@ mms_dispatcher_unref( MMSDispatcher* disp) { if (disp) { - MMS_ASSERT(disp->ref_count > 0); + GASSERT(disp->ref_count > 0); if (g_atomic_int_dec_and_test(&disp->ref_count)) { mms_dispatcher_finalize(disp); g_free(disp); diff --git a/mms-lib/src/mms_error.c b/mms-lib/src/mms_error.c index 59e2eb8..e177c16 100644 --- a/mms-lib/src/mms_error.c +++ b/mms-lib/src/mms_error.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2013-2014 Jolla Ltd. + * Copyright (C) 2013-2016 Jolla Ltd. + * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -9,10 +10,8 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ -#include "mms_log.h" #include "mms_error.h" void @@ -30,7 +29,7 @@ mms_error_valist( g_error_new_valist(MMS_LIB_ERROR, code, format, args2)); va_end(args2); } - mms_logv(module, MMS_LOGLEVEL_ERR, format, args); + gutil_logv(module, GLOG_LEVEL_ERR, format, args); } void diff --git a/mms-lib/src/mms_error.h b/mms-lib/src/mms_error.h index 671700f..771dc86 100644 --- a/mms-lib/src/mms_error.h +++ b/mms-lib/src/mms_error.h @@ -10,13 +10,13 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #ifndef JOLLA_MMS_ERROR_H #define JOLLA_MMS_ERROR_H #include "mms_lib_util.h" +#include void mms_error( @@ -36,13 +36,13 @@ mms_error_valist( #ifdef __GNUC__ # define MMS_ERROR(error,code,format,args...) \ - mms_error(MMS_LOG_MODULE_CURRENT, error, code, format, ##args) + mms_error(GLOG_MODULE_CURRENT, error, code, format, ##args) #else # define MMS_ERROR mms_error_static static inline void mms_error_static(GError** error, MMSLibError code, \ const char* format, ...) { \ va_list va; va_start(va,format); \ - mms_error_valist(MMS_LOG_MODULE_CURRENT, error, code, format, va); \ + mms_error_valist(GLOG_MODULE_CURRENT, error, code, format, va); \ va_end(va); \ } #endif /* __GNUC__ */ diff --git a/mms-lib/src/mms_file_util.c b/mms-lib/src/mms_file_util.c index 3138a48..798e034 100644 --- a/mms-lib/src/mms_file_util.c +++ b/mms-lib/src/mms_file_util.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Jolla Ltd. + * Copyright (C) 2013-2016 Jolla Ltd. * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify @@ -10,11 +10,9 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_file_util.h" -#include "mms_log.h" #include "mms_error.h" /** @@ -88,7 +86,7 @@ mms_remove_file_and_dir( char* dir = g_path_get_dirname(file); unlink(file); if (rmdir(dir) == 0) { - MMS_VERBOSE("Deleted %s", dir); + GVERBOSE("Deleted %s", dir); } g_free(dir); } @@ -145,7 +143,7 @@ mms_write_file( char* fname = g_strconcat(dir, "/", file, NULL); unlink(fname); if (g_file_set_contents(fname, data, size, &error)) { - MMS_VERBOSE("Created %s", fname); + GVERBOSE("Created %s", fname); chmod(fname, MMS_FILE_PERM); saved = TRUE; if (path) { @@ -153,12 +151,12 @@ mms_write_file( fname = NULL; } } else { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } g_free(fname); } else { - MMS_ERR("Failed to create directory %s: %s", dir, strerror(errno)); + GERR("Failed to create directory %s: %s", dir, strerror(errno)); } return saved; } @@ -323,7 +321,7 @@ mms_file_decode( } else if (ok) { if (mms_file_decode_step(&dec, NULL, 0, g_mime_encoding_flush, error)) { - MMS_DEBUG("Decoded %s (%d bytes) -> %s (%d bytes)", + GDEBUG("Decoded %s (%d bytes) -> %s (%d bytes)", src, (int)inbytes, dest, (int)dec.outbytes); } else { ok = FALSE; diff --git a/mms-lib/src/mms_handler.c b/mms-lib/src/mms_handler.c index f7c26e1..ad955ec 100644 --- a/mms-lib/src/mms_handler.c +++ b/mms-lib/src/mms_handler.c @@ -10,14 +10,13 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_handler.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_handler_log -#include "mms_lib_log.h" +#define GLOG_MODULE_NAME mms_handler_log +#include G_DEFINE_ABSTRACT_TYPE(MMSHandler, mms_handler, G_TYPE_OBJECT) @@ -33,7 +32,7 @@ enum { MMS_HANDLER_SIGNAL_COUNT }; -#define MMS_HANDLER_SIGNAL_DONE_NAME "done" +#define MMS_HANDLER_SIGNAL_DONE_NAME "mms-handler-done" static guint mms_handler_signals[MMS_HANDLER_SIGNAL_COUNT] = { 0 }; @@ -42,8 +41,8 @@ void mms_handler_finalize( GObject* object) { - MMS_VERBOSE_("%p", object); - MMS_ASSERT(!MMS_HANDLER(object)->busy); + GVERBOSE_("%p", object); + GASSERT(!MMS_HANDLER(object)->busy); G_OBJECT_CLASS(mms_handler_parent_class)->finalize(object); } @@ -65,15 +64,15 @@ void mms_handler_init( MMSHandler* h) { - MMS_VERBOSE_("%p", h); + GVERBOSE_("%p", h); } MMSHandler* mms_handler_ref( MMSHandler* h) { - if (h) { - MMS_ASSERT(MMS_HANDLER(h)); + if (G_LIKELY(h)) { + GASSERT(MMS_HANDLER(h)); g_object_ref(h); } return h; @@ -83,8 +82,8 @@ void mms_handler_unref( MMSHandler* h) { - if (h) { - MMS_ASSERT(MMS_HANDLER(h)); + if (G_LIKELY(h)) { + GASSERT(MMS_HANDLER(h)); g_object_unref(h); } } @@ -95,7 +94,7 @@ mms_handler_add_done_callback( mms_handler_event_fn fn, void* param) { - if (h && fn) { + if (G_LIKELY(h) && G_LIKELY(fn)) { return g_signal_connect_data(h, MMS_HANDLER_SIGNAL_DONE_NAME, G_CALLBACK(fn), param, NULL, 0); } @@ -107,7 +106,9 @@ mms_handler_remove_callback( MMSHandler* h, gulong handler_id) { - if (h && handler_id) g_signal_handler_disconnect(h, handler_id); + if (G_LIKELY(h) && G_LIKELY(handler_id)) { + g_signal_handler_disconnect(h, handler_id); + } } MMSHandlerMessageNotifyCall* @@ -121,7 +122,7 @@ mms_handler_message_notify( mms_handler_message_notify_complete_fn cb, void* param) { - if (h) { + if (G_LIKELY(h)) { MMSHandlerClass* klass = MMS_HANDLER_GET_CLASS(h); if (klass->fn_message_notify) { if (!from) from = ""; @@ -129,7 +130,6 @@ mms_handler_message_notify( return klass->fn_message_notify(h, imsi, from, subject, expiry, push, cb, param); } - MMS_ERR("mms_handler_message_notify not implemented"); } return NULL; } @@ -139,12 +139,10 @@ mms_handler_message_notify_cancel( MMSHandler* h, MMSHandlerMessageNotifyCall* call) { - if (h && call) { + if (G_LIKELY(h) && G_LIKELY(call)) { MMSHandlerClass* klass = MMS_HANDLER_GET_CLASS(h); if (klass->fn_message_notify_cancel) { klass->fn_message_notify_cancel(h, call); - } else { - MMS_ERR("mms_handler_message_notify_cancel not implemented"); } } } @@ -156,12 +154,11 @@ mms_handler_message_received( mms_handler_message_received_complete_fn cb, void* param) { - if (h) { + if (G_LIKELY(h)) { MMSHandlerClass* klass = MMS_HANDLER_GET_CLASS(h); if (klass->fn_message_received) { return klass->fn_message_received(h, msg, cb, param); } - MMS_ERR("mms_handler_message_received not implemented"); } return NULL; } @@ -171,12 +168,10 @@ mms_handler_message_received_cancel( MMSHandler* h, MMSHandlerMessageReceivedCall* call) { - if (h && call) { + if (G_LIKELY(h) && G_LIKELY(call)) { MMSHandlerClass* klass = MMS_HANDLER_GET_CLASS(h); if (klass->fn_message_received_cancel) { klass->fn_message_received_cancel(h, call); - } else { - MMS_ERR("mms_handler_message_notify_cancel not implemented"); } } } @@ -187,12 +182,11 @@ mms_handler_message_receive_state_changed( const char* id, MMS_RECEIVE_STATE state) { - if (h) { + if (G_LIKELY(h)) { MMSHandlerClass* klass = MMS_HANDLER_GET_CLASS(h); if (klass->fn_message_receive_state_changed) { return klass->fn_message_receive_state_changed(h, id, state); } - MMS_ERR("mms_handler_message_receive_state_changed not implemented"); } return FALSE; } @@ -204,12 +198,11 @@ mms_handler_message_send_state_changed( MMS_SEND_STATE state, const char* details) { - if (h) { + if (G_LIKELY(h)) { MMSHandlerClass* klass = MMS_HANDLER_GET_CLASS(h); if (klass->fn_message_send_state_changed) { return klass->fn_message_send_state_changed(h, id, state, details); } - MMS_ERR("mms_handler_message_send_state_changed not implemented"); } return FALSE; } @@ -220,12 +213,11 @@ mms_handler_message_sent( const char* id, const char* msgid) { - if (h) { + if (G_LIKELY(h)) { MMSHandlerClass* klass = MMS_HANDLER_GET_CLASS(h); if (klass->fn_message_sent) { return klass->fn_message_sent(h, id, msgid); } - MMS_ERR("mms_handler_message_sent not implemented"); } return FALSE; } @@ -238,12 +230,11 @@ mms_handler_delivery_report( const char* recipient, MMS_DELIVERY_STATUS ds) { - if (h) { + if (G_LIKELY(h)) { MMSHandlerClass* klass = MMS_HANDLER_GET_CLASS(h); if (klass->fn_delivery_report) { return klass->fn_delivery_report(h, imsi, msgid, recipient, ds); } - MMS_ERR("mms_handler_delivery_report not implemented"); } return FALSE; } @@ -256,12 +247,11 @@ mms_handler_read_report( const char* recipient, MMS_READ_STATUS rs) { - if (h) { + if (G_LIKELY(h)) { MMSHandlerClass* klass = MMS_HANDLER_GET_CLASS(h); if (klass->fn_read_report) { return klass->fn_read_report(h, imsi, msgid, recipient, rs); } - MMS_ERR("mms_handler_read_report not implemented"); } return FALSE; } @@ -272,12 +262,11 @@ mms_handler_read_report_send_status( const char* id, MMS_READ_REPORT_STATUS status) { - if (h) { + if (G_LIKELY(h)) { MMSHandlerClass* klass = MMS_HANDLER_GET_CLASS(h); if (klass->fn_read_report_send_status) { return klass->fn_read_report_send_status(h, id, status); } - MMS_ERR("mms_handler_read_report_send_status not implemented"); } return FALSE; } @@ -287,10 +276,10 @@ mms_handler_busy_update( MMSHandler* h, int change) { - MMS_ASSERT(change); - if (h && change) { + GASSERT(change); + if (G_LIKELY(h) && G_LIKELY(change)) { h->busy += change; - MMS_ASSERT(h->busy >= 0); + GASSERT(h->busy >= 0); if (h->busy < 1) { g_signal_emit(h, mms_handler_signals[MMS_HANDLER_SIGNAL_DONE], 0); } diff --git a/mms-lib/src/mms_message.c b/mms-lib/src/mms_message.c index b6628eb..c60a325 100644 --- a/mms-lib/src/mms_message.c +++ b/mms-lib/src/mms_message.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Jolla Ltd. + * Copyright (C) 2013-2016 Jolla Ltd. * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify @@ -10,15 +10,14 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_message.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_message_log -#include "mms_lib_log.h" -MMS_LOG_MODULE_DEFINE("mms-message"); +#define GLOG_MODULE_NAME mms_message_log +#include +GLOG_MODULE_DEFINE("mms-message"); static void @@ -46,7 +45,7 @@ void mms_message_finalize( MMSMessage* msg) { - MMS_VERBOSE_("%p", msg); + GVERBOSE_("%p", msg); g_free(msg->id); g_free(msg->message_id); g_free(msg->from); @@ -59,7 +58,7 @@ mms_message_finalize( if (msg->parts_dir) { if (!(msg->flags & MMS_MESSAGE_FLAG_KEEP_FILES)) { if (rmdir(msg->parts_dir) == 0) { - MMS_VERBOSE("Deleted %s", msg->parts_dir); + GVERBOSE("Deleted %s", msg->parts_dir); } } g_free(msg->parts_dir); @@ -67,7 +66,7 @@ mms_message_finalize( if (msg->msg_dir) { if (!(msg->flags & MMS_MESSAGE_FLAG_KEEP_FILES)) { if (rmdir(msg->msg_dir) == 0) { - MMS_VERBOSE("Deleted %s", msg->msg_dir); + GVERBOSE("Deleted %s", msg->msg_dir); } } g_free(msg->msg_dir); @@ -78,7 +77,7 @@ MMSMessage* mms_message_new() { MMSMessage* msg = g_new0(MMSMessage, 1); - MMS_VERBOSE_("%p", msg); + GVERBOSE_("%p", msg); msg->ref_count = 1; msg->priority = MMS_PRIORITY_NORMAL; return msg; @@ -89,7 +88,7 @@ mms_message_ref( MMSMessage* msg) { if (msg) { - MMS_ASSERT(msg->ref_count > 0); + GASSERT(msg->ref_count > 0); g_atomic_int_inc(&msg->ref_count); } return msg; @@ -100,7 +99,7 @@ mms_message_unref( MMSMessage* msg) { if (msg) { - MMS_ASSERT(msg->ref_count > 0); + GASSERT(msg->ref_count > 0); if (g_atomic_int_dec_and_test(&msg->ref_count)) { mms_message_finalize(msg); g_free(msg); diff --git a/mms-lib/src/mms_task.c b/mms-lib/src/mms_task.c index e526da2..a058b7b 100644 --- a/mms-lib/src/mms_task.c +++ b/mms-lib/src/mms_task.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_task.h" @@ -22,9 +21,9 @@ #endif /* Logging */ -#define MMS_LOG_MODULE_NAME MMS_TASK_LOG -#include "mms_lib_log.h" -MMS_LOG_MODULE_DEFINE("mms-task"); +#define GLOG_MODULE_NAME MMS_TASK_LOG +#include +GLOG_MODULE_DEFINE("mms-task"); #define MMS_TASK_DEFAULT_LIFETIME (600) @@ -64,7 +63,7 @@ mms_task_wakeup_callback( MMSTask* task = MMS_TASK(data); MMSTaskPriv* priv = task->priv; priv->wakeup_id = 0; - MMS_ASSERT(task->state == MMS_TASK_STATE_SLEEP); + GASSERT(task->state == MMS_TASK_STATE_SLEEP); mms_task_set_state(task, MMS_TASK_STATE_READY); return FALSE; } @@ -80,7 +79,7 @@ mms_task_schedule_wakeup( /* Cancel the previous sleep */ if (priv->wakeup_id) { - MMS_ASSERT(task->state == MMS_TASK_STATE_SLEEP); + GASSERT(task->state == MMS_TASK_STATE_SLEEP); g_source_remove(priv->wakeup_id); priv->wakeup_id = 0; } @@ -94,8 +93,8 @@ mms_task_schedule_wakeup( priv->wakeup_id = g_timeout_add_seconds_full(G_PRIORITY_DEFAULT, secs, mms_task_wakeup_callback, mms_task_ref(task), mms_task_wakeup_free); - MMS_ASSERT(priv->wakeup_id); - MMS_VERBOSE("%s sleeping for %u sec", task->name, secs); + GASSERT(priv->wakeup_id); + GVERBOSE("%s sleeping for %u sec", task->name, secs); } return (priv->wakeup_id > 0); @@ -118,7 +117,7 @@ mms_task_cancel_cb( { MMSTaskPriv* priv = task->priv; if (priv->wakeup_id) { - MMS_ASSERT(task->state == MMS_TASK_STATE_SLEEP); + GASSERT(task->state == MMS_TASK_STATE_SLEEP); g_source_remove(priv->wakeup_id); priv->wakeup_id = 0; } @@ -132,19 +131,19 @@ mms_task_finalize( GObject* object) { MMSTask* task = MMS_TASK(object); - MMS_VERBOSE_("%p", task); - MMS_ASSERT(!task->delegate); - MMS_ASSERT(!task->priv->wakeup_id); - MMS_ASSERT(mms_task_count > 0); + GVERBOSE_("%p", task); + GASSERT(!task->delegate); + GASSERT(!task->priv->wakeup_id); + GASSERT(mms_task_count > 0); if (!(--mms_task_count)) { - MMS_VERBOSE("Last task is gone"); + GVERBOSE("Last task is gone"); mms_task_order = 0; } if (task->id) { if (!task_config(task)->keep_temp_files) { char* dir = mms_task_dir(task); if (rmdir(dir) == 0) { - MMS_VERBOSE("Deleted %s", dir); + GVERBOSE("Deleted %s", dir); } g_free(dir); } @@ -172,7 +171,7 @@ void mms_task_init( MMSTask* task) { - MMS_VERBOSE_("%p", task); + GVERBOSE_("%p", task); mms_task_count++; task->order = mms_task_order++; task->priv = G_TYPE_INSTANCE_GET_PRIVATE(task, MMS_TYPE_TASK, MMSTaskPriv); @@ -223,9 +222,9 @@ void mms_task_run( MMSTask* task) { - MMS_ASSERT(task->state == MMS_TASK_STATE_READY); + GASSERT(task->state == MMS_TASK_STATE_READY); MMS_TASK_GET_CLASS(task)->fn_run(task); - MMS_ASSERT(task->state != MMS_TASK_STATE_READY); + GASSERT(task->state != MMS_TASK_STATE_READY); } void @@ -233,10 +232,10 @@ mms_task_transmit( MMSTask* task, MMSConnection* connection) { - MMS_ASSERT(task->state == MMS_TASK_STATE_NEED_CONNECTION || + GASSERT(task->state == MMS_TASK_STATE_NEED_CONNECTION || task->state == MMS_TASK_STATE_NEED_USER_CONNECTION); MMS_TASK_GET_CLASS(task)->fn_transmit(task, connection); - MMS_ASSERT(task->state != MMS_TASK_STATE_NEED_CONNECTION && + GASSERT(task->state != MMS_TASK_STATE_NEED_CONNECTION && task->state != MMS_TASK_STATE_NEED_USER_CONNECTION); } @@ -246,11 +245,11 @@ mms_task_network_unavailable( gboolean can_retry) { if (task->state != MMS_TASK_STATE_DONE) { - MMS_ASSERT(task->state == MMS_TASK_STATE_NEED_CONNECTION || + GASSERT(task->state == MMS_TASK_STATE_NEED_CONNECTION || task->state == MMS_TASK_STATE_NEED_USER_CONNECTION || task->state == MMS_TASK_STATE_TRANSMITTING); MMS_TASK_GET_CLASS(task)->fn_network_unavailable(task, can_retry); - MMS_ASSERT(task->state != MMS_TASK_STATE_NEED_CONNECTION && + GASSERT(task->state != MMS_TASK_STATE_NEED_CONNECTION && task->state != MMS_TASK_STATE_NEED_USER_CONNECTION && task->state != MMS_TASK_STATE_TRANSMITTING); } @@ -260,7 +259,7 @@ void mms_task_cancel( MMSTask* task) { - MMS_DEBUG_("%s", task->name); + GDEBUG_("%s", task->name); MMS_TASK_GET_CLASS(task)->fn_cancel(task); } @@ -271,13 +270,13 @@ mms_task_set_state( { MMSTaskPriv* priv = task->priv; if (task->state != state) { - MMS_DEBUG("%s %s -> %s", task->name, + GDEBUG("%s %s -> %s", task->name, mms_task_state_name(task->state), mms_task_state_name(state)); if (state == MMS_TASK_STATE_SLEEP && !priv->wakeup_id) { const unsigned int secs = task_config(task)->retry_secs; if (!mms_task_schedule_wakeup(task, secs)) { - MMS_DEBUG("%s SLEEP -> DONE (no time left)", task->name); + GDEBUG("%s SLEEP -> DONE (no time left)", task->name); MMS_TASK_GET_CLASS(task)->fn_cancel(task); state = MMS_TASK_STATE_DONE; } @@ -369,7 +368,7 @@ mms_task_make_id( } g_free(tmpl); } else { - MMS_ERR("Failed to create %s: %s", root_dir, strerror(errno)); + GERR("Failed to create %s: %s", root_dir, strerror(errno)); } g_free(msgdir); } diff --git a/mms-lib/src/mms_task_decode.c b/mms-lib/src/mms_task_decode.c index be32256..ff37361 100644 --- a/mms-lib/src/mms_task_decode.c +++ b/mms-lib/src/mms_task_decode.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_task.h" @@ -22,9 +21,10 @@ #include "mms_transfer_list.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_task_decode_log +#define GLOG_MODULE_NAME mms_task_decode_log #include "mms_lib_log.h" -MMS_LOG_MODULE_DEFINE2("mms-task-decode", MMS_TASK_LOG); +#include +GLOG_MODULE_DEFINE2("mms-task-decode", MMS_TASK_LOG); /* Class definition */ typedef MMSTaskClass MMSTaskDecodeClass; @@ -130,11 +130,11 @@ mms_task_decode_part( rename(part->orig, part->file); g_free(part->orig); part->orig = NULL; - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } } else { - MMS_ERR("Failed to rename %s to %s: %s", part->file, part->orig, + GERR("Failed to rename %s to %s: %s", part->file, part->orig, strerror(errno)); } } @@ -155,25 +155,25 @@ mms_task_decode_retrieve_conf( const struct mms_retrieve_conf* rc = &pdu->rc; MMSMessage* msg = mms_message_new(); -#if MMS_LOG_DEBUG +#if GUTIL_LOG_DEBUG char date[128]; strftime(date, sizeof(date), "%Y-%m-%dT%H:%M:%S%z", localtime(&rc->date)); date[sizeof(date)-1] = '\0'; -#endif /* MMS_LOG_DEBUG */ +#endif /* GUTIL_LOG_DEBUG */ - MMS_ASSERT(pdu->type == MMS_MESSAGE_TYPE_RETRIEVE_CONF); - MMS_INFO("Processing M-Retrieve.conf"); - MMS_INFO(" From: %s", rc->from); + GASSERT(pdu->type == MMS_MESSAGE_TYPE_RETRIEVE_CONF); + GINFO("Processing M-Retrieve.conf"); + GINFO(" From: %s", rc->from); -#if MMS_LOG_DEBUG - MMS_DEBUG(" To: %s", rc->to); - if (rc->cc) MMS_DEBUG(" Cc: %s", rc->cc); - MMS_DEBUG(" Message-ID: %s", rc->msgid); - MMS_DEBUG(" Transaction-ID: %s", pdu->transaction_id); - if (rc->subject) MMS_DEBUG(" Subject: %s", rc->subject); - MMS_DEBUG(" Date: %s", date); - MMS_DEBUG(" %u parts", nparts); -#endif /* MMS_LOG_DEBUG */ +#if GUTIL_LOG_DEBUG + GDEBUG(" To: %s", rc->to); + if (rc->cc) GDEBUG(" Cc: %s", rc->cc); + GDEBUG(" Message-ID: %s", rc->msgid); + GDEBUG(" Transaction-ID: %s", pdu->transaction_id); + if (rc->subject) GDEBUG(" Subject: %s", rc->subject); + GDEBUG(" Date: %s", date); + GDEBUG(" %u parts", nparts); +#endif /* GUTIL_LOG_DEBUG */ if (task_config(task)->keep_temp_files) { msg->flags |= MMS_MESSAGE_FLAG_KEEP_FILES; @@ -216,8 +216,8 @@ mms_task_decode_retrieve_conf( file = mms_task_decode_add_file_name(part_files, name); g_free(name); } - MMS_DEBUG("Part: %s %s", name, attach->content_type); - MMS_ASSERT(attach->offset < pdu_size); + GDEBUG("Part: %s %s", name, attach->content_type); + GASSERT(attach->offset < pdu_size); if (mms_write_file(msg->parts_dir, file, pdu_data + attach->offset, attach->length, &path)) { MMSMessagePart* part = g_new0(MMSMessagePart, 1); @@ -233,7 +233,7 @@ mms_task_decode_retrieve_conf( attach->transfer_encoding); if (enc > GMIME_CONTENT_ENCODING_BINARY) { /* The part actually needs some decoding */ - MMS_DEBUG("Decoding %s", attach->transfer_encoding); + GDEBUG("Decoding %s", attach->transfer_encoding); mms_task_decode_part(part,enc,msg->parts_dir,part_files); } } @@ -282,16 +282,16 @@ mms_task_decode_process_pdu( /* MMS server returned an error. Most likely, MMS message * has expired. We need more MMS_RECEIVE_STATE values to * better describe it to the user. */ - MMS_ERR("MMSC responded with %u", rc->retrieve_status); + GERR("MMSC responded with %u", rc->retrieve_status); mms_handler_message_receive_state_changed(task->handler, task->id, MMS_RECEIVE_STATE_DOWNLOAD_ERROR); return; } } else { - MMS_ERR("Unexpected MMS PDU type %u", (guint)pdu->type); + GERR("Unexpected MMS PDU type %u", (guint)pdu->type); } } else { - MMS_ERR("Failed to decode MMS PDU"); + GERR("Failed to decode MMS PDU"); } /* Tell MMS server that we didn't understand this PDU */ @@ -366,7 +366,7 @@ mms_task_decode_new( dec->task.priority = MMS_TASK_PRIORITY_POST_PROCESS; return &dec->task; } else if (error) { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } } diff --git a/mms-lib/src/mms_task_encode.c b/mms-lib/src/mms_task_encode.c index 0c66a63..fc0799c 100644 --- a/mms-lib/src/mms_task_encode.c +++ b/mms-lib/src/mms_task_encode.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_task.h" @@ -26,10 +25,10 @@ #include /* Logging */ -#define MMS_LOG_MODULE_NAME mms_task_encode_log +#define GLOG_MODULE_NAME mms_task_encode_log #include "mms_lib_log.h" #include "mms_error.h" -MMS_LOG_MODULE_DEFINE2("mms-task-encode", MMS_TASK_LOG); +GLOG_MODULE_DEFINE2("mms-task-encode", MMS_TASK_LOG); /* Class definition */ typedef MMSTaskClass MMSTaskEncodeClass; @@ -88,7 +87,7 @@ mms_encode_job_resize( MMSAttachment* resize_me = NULL; unsigned int largest_size = 0; int i; - MMS_DEBUG("Message is too big, need to resize"); + GDEBUG("Message is too big, need to resize"); for (i=0; inparts; i++) { MMSAttachment* part = enc->parts[i]; if (part->flags & MMS_ATTACHMENT_RESIZABLE) { @@ -103,19 +102,19 @@ mms_encode_job_resize( resize_me = part; } } else { - MMS_ERR("Can't stat %s: %s", fname, strerror(errno)); + GERR("Can't stat %s: %s", fname, strerror(errno)); } close(fd); } else { - MMS_ERR("Can't open %s: %s", fname, strerror(errno)); + GERR("Can't open %s: %s", fname, strerror(errno)); } } } if (resize_me) { - MMS_DEBUG("Resizing %s", resize_me->original_file); + GDEBUG("Resizing %s", resize_me->original_file); return mms_attachment_resize(resize_me, &job->settings->data); } else { - MMS_DEBUG("There is nothing to resize"); + GDEBUG("There is nothing to resize"); return FALSE; } } @@ -149,7 +148,7 @@ mms_encode_job_encode( ct[3] = "type"; ct[4] = SMIL_CONTENT_TYPE; ct[5] = NULL; - MMS_ASSERT(smil->flags & MMS_ATTACHMENT_SMIL); + GASSERT(smil->flags & MMS_ATTACHMENT_SMIL); mms->type = MMS_MESSAGE_TYPE_SEND_REQ; mms->version = MMS_VERSION; @@ -183,13 +182,13 @@ mms_encode_job_encode( int err = fstat(fd, &st); if (!err) { pdu_size = st.st_size; - MMS_DEBUG("Created %s (%d bytes)", job->path, (int)pdu_size); + GDEBUG("Created %s (%d bytes)", job->path, (int)pdu_size); } else { - MMS_ERR("Can't stat %s: %s", job->path, strerror(errno)); + GERR("Can't stat %s: %s", job->path, strerror(errno)); ok = FALSE; } } else { - MMS_ERR("Failed to encode message"); + GERR("Failed to encode message"); } close(fd); @@ -248,7 +247,7 @@ mms_encode_job_ref( MMSEncodeJob* job) { if (job) { - MMS_ASSERT(job->ref_count > 0); + GASSERT(job->ref_count > 0); g_atomic_int_inc(&job->ref_count); } return job; @@ -260,7 +259,7 @@ mms_encode_job_unref( MMSEncodeJob* job) { if (job) { - MMS_ASSERT(job->ref_count > 0); + GASSERT(job->ref_count > 0); if (g_atomic_int_dec_and_test(&job->ref_count)) { mms_task_unref(&job->enc->task); g_object_unref(job->cancellable); @@ -321,7 +320,7 @@ mms_task_encode_job_done( { if (enc->active_job == job) { MMSTask* task = &enc->task; - MMS_VERBOSE_("Encoding completion state %d", job->state); + GVERBOSE_("Encoding completion state %d", job->state); enc->active_job = NULL; if (job->state == MMS_ENCODE_STATE_DONE) { mms_task_queue_and_unref(task->delegate, @@ -335,7 +334,7 @@ mms_task_encode_job_done( mms_task_set_state(&enc->task, MMS_TASK_STATE_DONE); mms_encode_job_unref(job); } else { - MMS_VERBOSE_("Ignoring stale job completion"); + GVERBOSE_("Ignoring stale job completion"); } } @@ -356,10 +355,10 @@ mms_task_encode_run( mms_handler_message_send_state_changed(task->handler, task->id, MMS_SEND_STATE_ENCODING, NULL); mms_task_set_state(task, MMS_TASK_STATE_WORKING); - MMS_ASSERT(!enc->active_job); + GASSERT(!enc->active_job); enc->active_job = job; } else { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); mms_encode_job_unref(job); mms_encode_job_unref(job); @@ -480,7 +479,7 @@ mms_task_encode_prepare_attachments( g_ptr_array_add(array, attachment); } } else if (error && *error) { - MMS_ERR("%s", MMS_ERRMSG(*error)); + GERR("%s", GERRMSG(*error)); } g_free(detected_type); @@ -600,7 +599,7 @@ mms_task_encode_new( int nparts, GError** error) { - MMS_ASSERT(to && to[0]); + GASSERT(to && to[0]); if (to && to[0]) { int err; char* dir; @@ -624,7 +623,7 @@ mms_task_encode_new( enc->flags = flags; enc->transfers = mms_transfer_list_ref(transfers); - MMS_ASSERT(!error || !*error); + GASSERT(!error || !*error); g_free(dir); return &enc->task; } @@ -637,7 +636,7 @@ mms_task_encode_new( } else { MMS_ERROR(error, MMS_LIB_ERROR_ARGS, "Missing To: address"); } - MMS_ASSERT(!error || *error); + GASSERT(!error || *error); return NULL; } diff --git a/mms-lib/src/mms_task_http.c b/mms-lib/src/mms_task_http.c index a94cedd..5a985fb 100644 --- a/mms-lib/src/mms_task_http.c +++ b/mms-lib/src/mms_task_http.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_task_http.h" @@ -38,9 +37,10 @@ #endif /* Logging */ -#define MMS_LOG_MODULE_NAME MMS_TASK_HTTP_LOG +#define GLOG_MODULE_NAME MMS_TASK_HTTP_LOG #include "mms_lib_log.h" -MMS_LOG_MODULE_DEFINE2("mms-task-http", MMS_TASK_LOG); +#include +GLOG_MODULE_DEFINE2("mms-task-http", MMS_TASK_LOG); /* HTTP task state */ typedef enum _mms_http_state { @@ -111,7 +111,7 @@ mms_http_uri_parse( } uri = soup_uri_new(uri_to_parse); if (!uri) { - MMS_ERR("Could not parse %s as a URI", uri_to_parse); + GERR("Could not parse %s as a URI", uri_to_parse); } g_free(tmp_uri); } @@ -137,7 +137,7 @@ mms_http_create_session( if (ioctl(fd, SIOCGIFADDR, &ifr) >= 0) { SoupAddress* local_address = soup_address_new_from_sockaddr( &ifr.ifr_addr, sizeof(ifr.ifr_addr)); -# if MMS_LOG_DEBUG +# if GUTIL_LOG_DEBUG char buf[128]; int af = ifr.ifr_addr.sa_family; buf[0] = 0; @@ -151,22 +151,22 @@ mms_http_create_session( snprintf(buf, sizeof(buf), "
", af); } buf[sizeof(buf)-1] = 0; - MMS_DEBUG("MMS interface address %s", buf); -# endif /* MMS_LOG_DEBUG */ - MMS_ASSERT(local_address); + GDEBUG("MMS interface address %s", buf); +# endif /* GUTIL_LOG_DEBUG */ + GASSERT(local_address); session = soup_session_async_new_with_options( SOUP_SESSION_LOCAL_ADDRESS, local_address, NULL); g_object_unref(local_address); } else { - MMS_ERR("Failed to query IP address of %s: %s", + GERR("Failed to query IP address of %s: %s", conn->netif, strerror(errno)); } close(fd); } #endif /* _WIN32 */ } else { - MMS_WARN("MMS interface is unknown"); + GWARN("MMS interface is unknown"); } if (!session) { @@ -177,7 +177,7 @@ mms_http_create_session( if (conn->mmsproxy && conn->mmsproxy[0]) { SoupURI* proxy_uri = mms_http_uri_parse(conn->mmsproxy); if (proxy_uri) { - MMS_DEBUG("MMS proxy %s", conn->mmsproxy); + GDEBUG("MMS proxy %s", conn->mmsproxy); g_object_set(session, SOUP_SESSION_PROXY_URI, proxy_uri, NULL); soup_uri_free(proxy_uri); } @@ -214,7 +214,7 @@ mms_http_transfer_new( SOUP_MESSAGE_NEW_CONNECTION); if (cfg->uaprof && cfg->uaprof[0]) { const char* uaprof_header = "x-wap-profile"; - MMS_VERBOSE("%s %s", uaprof_header, cfg->uaprof); + GVERBOSE("%s %s", uaprof_header, cfg->uaprof); soup_message_headers_append(tx->message->request_headers, uaprof_header, cfg->uaprof); } @@ -249,7 +249,7 @@ mms_task_http_send_progress( MMSTaskHttpPriv* priv = http->priv; MMSHttpTransfer* tx = priv->tx; if (tx) { - MMS_ASSERT(tx->bytes_sent <= tx->bytes_to_send); + GASSERT(tx->bytes_sent <= tx->bytes_to_send); mms_transfer_list_transfer_send_progress(http->transfers, http->task.id, priv->transfer_type, tx->bytes_sent, tx->bytes_to_send); @@ -264,7 +264,7 @@ mms_task_http_receive_progress( MMSTaskHttpPriv* priv = http->priv; MMSHttpTransfer* tx = priv->tx; if (tx) { - MMS_ASSERT(tx->bytes_received <= tx->bytes_to_receive); + GASSERT(tx->bytes_received <= tx->bytes_to_receive); mms_transfer_list_transfer_receive_progress(http->transfers, http->task.id, priv->transfer_type, tx->bytes_received, tx->bytes_to_receive); @@ -337,19 +337,19 @@ mms_task_http_finished( if (priv->tx && priv->tx->session == session) { MMS_HTTP_STATE next_http_state; MMSTask* task = &http->task; - MMSHttpTransfer* tx = priv->tx; SoupStatus http_status = msg->status_code; -#if MMS_LOG_DEBUG +#if GUTIL_LOG_DEBUG + MMSHttpTransfer* tx = priv->tx; if (tx->bytes_received) { - MMS_DEBUG("HTTP status %u [%s] %u byte(s)", msg->status_code, + GDEBUG("HTTP status %u [%s] %u byte(s)", msg->status_code, soup_message_headers_get_content_type(msg->response_headers, NULL), tx->bytes_received); } else { - MMS_DEBUG("HTTP status %u (%s)", msg->status_code, + GDEBUG("HTTP status %u (%s)", msg->status_code, soup_status_get_phrase(msg->status_code)); } -#endif /* MMS_LOG_DEBUG */ +#endif /* GUTIL_LOG_DEBUG */ if (SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) { next_http_state = MMS_HTTP_DONE; @@ -366,14 +366,14 @@ mms_task_http_finished( } } else { next_http_state = MMS_HTTP_DONE; - MMS_WARN("HTTP error %u (%s)", msg->status_code, + GWARN("HTTP error %u (%s)", msg->status_code, soup_status_get_phrase(msg->status_code)); mms_task_set_state(task, MMS_TASK_STATE_DONE); } } mms_task_http_set_state(http, next_http_state, http_status); } else { - MMS_VERBOSE_("ignoring stale completion message"); + GVERBOSE_("ignoring stale completion message"); } } @@ -387,10 +387,10 @@ mms_task_http_write_next_chunk( MMSHttpTransfer* tx = priv->tx; #if MMS_LOG_VERBOSE if (tx->bytes_sent) { - MMS_VERBOSE("%u bytes sent", tx->bytes_sent); + GVERBOSE("%u bytes sent", tx->bytes_sent); } #endif - MMS_ASSERT(tx && tx->message == msg); + GASSERT(tx && tx->message == msg); if (tx && tx->message == msg) { void* chunk = g_malloc(MMS_HTTP_MAX_CHUNK); int nbytes = read(tx->send_fd, chunk, MMS_HTTP_MAX_CHUNK); @@ -413,14 +413,14 @@ mms_task_http_got_headers( { MMSTaskHttpPriv* priv = http->priv; MMSHttpTransfer* tx = priv->tx; - MMS_ASSERT(tx && tx->message == msg); + GASSERT(tx && tx->message == msg); if (tx && tx->message == msg) { - MMS_ASSERT(!tx->bytes_received); + GASSERT(!tx->bytes_received); tx->bytes_to_receive = (guint)soup_message_headers_get_content_length( msg->response_headers); #if MMS_LOG_VERBOSE if (tx->bytes_to_receive) { - MMS_VERBOSE("Receiving %u bytes", tx->bytes_to_receive); + GVERBOSE("Receiving %u bytes", tx->bytes_to_receive); } #endif mms_task_http_receive_progress(http); @@ -436,14 +436,14 @@ mms_task_http_got_chunk( { MMSTaskHttpPriv* priv = http->priv; MMSHttpTransfer* tx = priv->tx; - MMS_ASSERT(tx && tx->message == msg); + GASSERT(tx && tx->message == msg); if (tx && tx->message == msg) { tx->bytes_received += buf->length; - MMS_VERBOSE("%u bytes received", tx->bytes_received); + GVERBOSE("%u bytes received", tx->bytes_received); if (write(tx->receive_fd, buf->data, buf->length) == (int)buf->length) { mms_task_http_receive_progress(http); } else { - MMS_ERR("Write error: %s", strerror(errno)); + GERR("Write error: %s", strerror(errno)); mms_task_http_finish_transfer(http); mms_task_http_set_state(http, MMS_HTTP_PAUSED, 0); mms_task_set_state(&http->task, MMS_TASK_STATE_SLEEP); @@ -461,7 +461,7 @@ mms_task_http_start( int receive_fd = -1; guint bytes_to_send = 0; MMSTaskHttpPriv* priv = http->priv; - MMS_ASSERT(mms_connection_is_open(connection)); + GASSERT(mms_connection_is_open(connection)); mms_task_http_finish_transfer(http); /* Open the files */ @@ -473,12 +473,12 @@ mms_task_http_start( if (!err) { bytes_to_send = st.st_size; } else { - MMS_ERR("Can't stat %s: %s", priv->send_path, strerror(errno)); + GERR("Can't stat %s: %s", priv->send_path, strerror(errno)); close(send_fd); send_fd = -1; } } else { - MMS_ERR("Can't open %s: %s", priv->send_path, strerror(errno)); + GERR("Can't open %s: %s", priv->send_path, strerror(errno)); } } @@ -538,20 +538,20 @@ mms_task_http_start( } /* Start the transfer */ -#if MMS_LOG_DEBUG +#if GUTIL_LOG_DEBUG if (priv->send_path) { if (priv->receive_path) { - MMS_DEBUG("%s (%u bytes) -> %s -> %s", priv->send_path, + GDEBUG("%s (%u bytes) -> %s -> %s", priv->send_path, bytes_to_send, uri, priv->receive_path); } else { - MMS_DEBUG("%s (%u bytes) -> %s", priv->send_path, + GDEBUG("%s (%u bytes) -> %s", priv->send_path, bytes_to_send, uri); } } else { - MMS_DEBUG("%s -> %s", uri, priv->receive_path); + GDEBUG("%s -> %s", uri, priv->receive_path); } -#endif /* MMS_LOG_DEBUG */ +#endif /* GUTIL_LOG_DEBUG */ mms_task_http_set_state(http, MMS_HTTP_ACTIVE, 0); @@ -649,7 +649,7 @@ mms_task_http_finalize( { MMSTaskHttp* http = MMS_TASK_HTTP(object); MMSTaskHttpPriv* priv = http->priv; - MMS_ASSERT(!priv->tx); + GASSERT(!priv->tx); if (!task_config(&http->task)->keep_temp_files) { mms_remove_file_and_dir(priv->send_path); mms_remove_file_and_dir(priv->receive_path); @@ -721,7 +721,7 @@ mms_task_http_alloc( priv->connection_type = ct; if (send_file) { priv->send_path = mms_task_file(&http->task, send_file); - MMS_ASSERT(g_file_test(priv->send_path, G_FILE_TEST_IS_REGULAR)); + GASSERT(g_file_test(priv->send_path, G_FILE_TEST_IS_REGULAR)); } return http; } diff --git a/mms-lib/src/mms_task_notification.c b/mms-lib/src/mms_task_notification.c index 78517ad..f32954b 100644 --- a/mms-lib/src/mms_task_notification.c +++ b/mms-lib/src/mms_task_notification.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_task.h" @@ -21,10 +20,10 @@ #include "mms_transfer_list.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_task_notification_log +#define GLOG_MODULE_NAME mms_task_notification_log #include "mms_lib_log.h" #include "mms_error.h" -MMS_LOG_MODULE_DEFINE2("mms-task-notification", MMS_TASK_LOG); +GLOG_MODULE_DEFINE2("mms-task-notification", MMS_TASK_LOG); /* Class definition */ typedef MMSTaskClass MMSTaskNotificationClass; @@ -87,11 +86,11 @@ mms_task_notification_done( { MMSTaskNotification* ind = MMS_TASK_NOTIFICATION(param); MMSTask* task = &ind->task; - MMS_ASSERT(ind->notify == notify); + GASSERT(ind->notify == notify); ind->notify = NULL; if (id) { if (id[0]) { - MMS_DEBUG(" Database id: %s", id); + GDEBUG(" Database id: %s", id); if (task->id) { char* olddir = mms_task_dir(task); char* file = g_strconcat(olddir, "/" @@ -103,9 +102,9 @@ mms_task_notification_done( /* Move file to the new place */ char* newdir = mms_task_dir(task); if (rename(olddir, newdir) == 0) { - MMS_VERBOSE("Moved %s to %s", file, newdir); + GVERBOSE("Moved %s to %s", file, newdir); } else { - MMS_ERR("Failed to rename %s to %s: %s", olddir, + GERR("Failed to rename %s to %s: %s", olddir, newdir, strerror(errno)); } g_free(newdir); @@ -147,25 +146,25 @@ mms_task_notification_ind( MMSTask* task = &ind->task; const struct mms_notification_ind* ni = &ind->pdu->ni; -#if MMS_LOG_DEBUG +#if GUTIL_LOG_DEBUG char expiry[128]; strftime(expiry, sizeof(expiry), "%Y-%m-%dT%H:%M:%S%z", localtime(&ni->expiry)); expiry[sizeof(expiry)-1] = '\0'; - MMS_DEBUG("Processing M-Notification.ind"); - MMS_DEBUG(" From: %s", ni->from); - if (ni->subject) MMS_DEBUG(" Subject: %s", ni->subject); - MMS_DEBUG(" Size: %d bytes", ni->size); - MMS_DEBUG(" Location: %s", ni->location); - MMS_DEBUG(" Expiry: %s", expiry); -#endif /* MMS_LOG_DEBUG */ + GDEBUG("Processing M-Notification.ind"); + GDEBUG(" From: %s", ni->from); + if (ni->subject) GDEBUG(" Subject: %s", ni->subject); + GDEBUG(" Size: %d bytes", ni->size); + GDEBUG(" Location: %s", ni->location); + GDEBUG(" Expiry: %s", expiry); +#endif /* GUTIL_LOG_DEBUG */ if (task->deadline > ni->expiry) { task->deadline = ni->expiry; } - MMS_ASSERT(!ind->notify); + GASSERT(!ind->notify); mms_task_ref(task); ind->notify = mms_handler_message_notify(task->handler, task->imsi, mms_strip_address_type(ni->from), ni->subject, ni->expiry, @@ -195,9 +194,9 @@ mms_task_delivery_ind( MMSTask* task = &ind->task; const struct mms_delivery_ind* di = &ind->pdu->di; const char* to = mms_strip_address_type(di->to); - MMS_DEBUG("Processing M-Delivery.ind"); - MMS_DEBUG(" MMS message id: %s", di->msgid); - MMS_DEBUG(" Recipient: %s", to); + GDEBUG("Processing M-Delivery.ind"); + GDEBUG(" MMS message id: %s", di->msgid); + GDEBUG(" Recipient: %s", to); switch (di->dr_status) { case MMS_MESSAGE_DELIVERY_STATUS_EXPIRED: ds = MMS_DELIVERY_STATUS_EXPIRED; @@ -243,9 +242,9 @@ mms_task_read_orig_ind( MMSTask* task = &ind->task; const struct mms_read_ind* ri = &ind->pdu->ri; const char* to = mms_strip_address_type(ri->to); - MMS_DEBUG("Processing M-Read-Orig.ind"); - MMS_DEBUG(" MMS message id: %s", ri->msgid); - MMS_DEBUG(" Recipient: %s", to); + GDEBUG("Processing M-Read-Orig.ind"); + GDEBUG(" MMS message id: %s", ri->msgid); + GDEBUG(" Recipient: %s", to); switch (ri->rr_status) { case MMS_MESSAGE_READ_STATUS_READ: rs = MMS_READ_STATUS_READ; @@ -306,7 +305,7 @@ mms_task_notification_run( mms_task_read_orig_ind(ind); break; default: - MMS_INFO("Ignoring MMS push PDU of type %u", ind->pdu->type); + GINFO("Ignoring MMS push PDU of type %u", ind->pdu->type); mms_task_notification_unrecornized(task_config(task), ind->push); break; } @@ -341,7 +340,7 @@ mms_task_notification_finalize( GObject* object) { MMSTaskNotification* ind = MMS_TASK_NOTIFICATION(object); - MMS_ASSERT(!ind->notify); + GASSERT(!ind->notify); g_bytes_unref(ind->push); mms_message_free(ind->pdu); mms_transfer_list_unref(ind->transfers); @@ -382,18 +381,18 @@ mms_task_notification_new( GError** error) { MMSPdu* pdu = mms_decode_bytes(bytes); - MMS_ASSERT(!error || !(*error)); + GASSERT(!error || !(*error)); if (pdu) { MMSTaskNotification* ind; /* Looks like a legitimate MMS Push PDU */ -#if MMS_LOG_DEBUG - MMS_DEBUG(" MMS version: %u.%u", (pdu->version & 0x70) >> 4, +#if GUTIL_LOG_DEBUG + GDEBUG(" MMS version: %u.%u", (pdu->version & 0x70) >> 4, pdu->version & 0x0f); if (pdu->transaction_id) { - MMS_DEBUG(" MMS transaction id: %s", pdu->transaction_id); + GDEBUG(" MMS transaction id: %s", pdu->transaction_id); } -#endif /* MMS_LOG_DEBUG */ +#endif /* GUTIL_LOG_DEBUG */ ind = mms_task_alloc(MMS_TYPE_TASK_NOTIFICATION, settings, handler, "Notification", NULL, imsi); diff --git a/mms-lib/src/mms_task_publish.c b/mms-lib/src/mms_task_publish.c index 6565246..28598f2 100644 --- a/mms-lib/src/mms_task_publish.c +++ b/mms-lib/src/mms_task_publish.c @@ -10,16 +10,16 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_task.h" #include "mms_handler.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_task_publish_log +#define GLOG_MODULE_NAME mms_task_publish_log #include "mms_lib_log.h" -MMS_LOG_MODULE_DEFINE2("mms-task-publish", MMS_TASK_LOG); +#include +GLOG_MODULE_DEFINE2("mms-task-publish", MMS_TASK_LOG); /* Class definition */ typedef MMSTaskClass MMSTaskPublishClass; @@ -44,12 +44,12 @@ mms_task_publish_done( { MMSTaskPublish* pub = MMS_TASK_PUBLISH(param); if (ok) { - MMS_DEBUG("Done"); + GDEBUG("Done"); mms_task_set_state(&pub->task, MMS_TASK_STATE_DONE); } else if (mms_task_retry(&pub->task)) { - MMS_ERR("Failed to publish the message, will retry later..."); + GERR("Failed to publish the message, will retry later..."); } else { - MMS_ERR("Failed to publish the message"); + GERR("Failed to publish the message"); } mms_task_unref(&pub->task); } @@ -60,7 +60,7 @@ mms_task_publish_run( MMSTask* task) { MMSTaskPublish* pub = MMS_TASK_PUBLISH(task); - MMS_ASSERT(!pub->call); + GASSERT(!pub->call); mms_task_ref(task); pub->call = mms_handler_message_received(task->handler, pub->msg, mms_task_publish_done, pub); @@ -120,7 +120,7 @@ mms_task_publish_new( MMSHandler* handler, MMSMessage* msg) { - MMS_ASSERT(msg && msg->id); + GASSERT(msg && msg->id); if (msg && msg->id) { MMSTaskPublish* pub = mms_task_alloc(MMS_TYPE_TASK_PUBLISH, settings, handler, "Publish", msg->id, NULL); diff --git a/mms-lib/src/mms_task_read.c b/mms-lib/src/mms_task_read.c index eb86724..7fb7674 100644 --- a/mms-lib/src/mms_task_read.c +++ b/mms-lib/src/mms_task_read.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_task.h" @@ -19,14 +18,13 @@ #include "mms_handler.h" #include "mms_codec.h" #include "mms_util.h" -#include "mms_log.h" #include "mms_error.h" /* Class definition */ typedef MMSTaskHttpClass MMSTaskReadClass; typedef MMSTaskHttp MMSTaskRead; -G_DEFINE_TYPE(MMSTaskRead, mms_task_read, MMS_TYPE_TASK_HTTP); +G_DEFINE_TYPE(MMSTaskRead, mms_task_read, MMS_TYPE_TASK_HTTP) #define MMS_TYPE_TASK_READ (mms_task_read_get_type()) #define MMS_TASK_READ(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\ MMS_TYPE_TASK_READ, MMSTaskRead)) diff --git a/mms-lib/src/mms_task_retrieve.c b/mms-lib/src/mms_task_retrieve.c index 1a2a5b3..4deebb6 100644 --- a/mms-lib/src/mms_task_retrieve.c +++ b/mms-lib/src/mms_task_retrieve.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_task.h" @@ -20,10 +19,10 @@ #include "mms_codec.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_task_retrieve_log +#define GLOG_MODULE_NAME mms_task_retrieve_log #include "mms_lib_log.h" #include "mms_error.h" -MMS_LOG_MODULE_DEFINE2("mms-task-retrieve", MMS_TASK_HTTP_LOG); +GLOG_MODULE_DEFINE2("mms-task-retrieve", MMS_TASK_HTTP_LOG); /* Class definition */ typedef MMSTaskHttpClass MMSTaskRetrieveClass; @@ -32,7 +31,7 @@ typedef struct mms_task_retrieve { char* transaction_id; } MMSTaskRetrieve; -G_DEFINE_TYPE(MMSTaskRetrieve, mms_task_retrieve, MMS_TYPE_TASK_HTTP); +G_DEFINE_TYPE(MMSTaskRetrieve, mms_task_retrieve, MMS_TYPE_TASK_HTTP) #define MMS_TYPE_TASK_RETRIEVE (mms_task_retrieve_get_type()) #define MMS_TASK_RETRIEVE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\ MMS_TYPE_TASK_RETRIEVE, MMSTaskRetrieve)) @@ -125,9 +124,9 @@ mms_task_retrieve_new( GError** error) { const time_t now = time(NULL); - MMS_ASSERT(pdu); - MMS_ASSERT(pdu->type == MMS_MESSAGE_TYPE_NOTIFICATION_IND); - MMS_ASSERT(pdu->transaction_id); + GASSERT(pdu); + GASSERT(pdu->type == MMS_MESSAGE_TYPE_NOTIFICATION_IND); + GASSERT(pdu->transaction_id); if (pdu->ni.expiry > now) { MMSTaskRetrieve* retrieve = mms_task_http_alloc( MMS_TYPE_TASK_RETRIEVE, settings, handler, transfers, diff --git a/mms-lib/src/mms_task_send.c b/mms-lib/src/mms_task_send.c index 96dadbf..3e2c00d 100644 --- a/mms-lib/src/mms_task_send.c +++ b/mms-lib/src/mms_task_send.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_task.h" @@ -20,10 +19,10 @@ #include "mms_codec.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_task_send_log +#define GLOG_MODULE_NAME mms_task_send_log #include "mms_lib_log.h" #include "mms_error.h" -MMS_LOG_MODULE_DEFINE2("mms-task-send", MMS_TASK_HTTP_LOG); +GLOG_MODULE_DEFINE2("mms-task-send", MMS_TASK_HTTP_LOG); /* Class definition */ typedef MMSTaskHttpClass MMSTaskSendClass; @@ -77,12 +76,12 @@ mms_task_send_done( if (pdu->sc.rsp_status == MMS_MESSAGE_RSP_STATUS_OK) { if (pdu->sc.msgid && pdu->sc.msgid[0]) { msgid = pdu->sc.msgid; - MMS_INFO("Message ID %s", pdu->sc.msgid); + GINFO("Message ID %s", pdu->sc.msgid); } else { - MMS_ERR("Missing Message-ID"); + GERR("Missing Message-ID"); } } else { - MMS_ERR("MMSC responded with %u", pdu->sc.rsp_status); + GERR("MMSC responded with %u", pdu->sc.rsp_status); details = pdu->sc.rsp_text; switch (pdu->sc.rsp_status) { case MMS_MESSAGE_RSP_STATUS_ERR_SERVICE_DENIED: @@ -98,14 +97,14 @@ mms_task_send_done( } } } else { - MMS_ERR("Unexpected response from MMSC"); + GERR("Unexpected response from MMSC"); } } else { - MMS_ERR("Failed to parse MMSC response"); + GERR("Failed to parse MMSC response"); } g_mapped_file_unref(map); } else { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } } diff --git a/mms-lib/src/mms_transfer_list.c b/mms-lib/src/mms_transfer_list.c index 0545c07..71a0b12 100644 --- a/mms-lib/src/mms_transfer_list.c +++ b/mms-lib/src/mms_transfer_list.c @@ -10,14 +10,13 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_transfer_list.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_transfer_list_log -#include "mms_lib_log.h" +#define GLOG_MODULE_NAME mms_transfer_list_log +#include G_DEFINE_ABSTRACT_TYPE(MMSTransferList, mms_transfer_list, G_TYPE_OBJECT) @@ -45,7 +44,7 @@ mms_transfer_list_ref( MMSTransferList* self) { if (self) { - MMS_ASSERT(MMS_TRANSFER_LIST(self)); + GASSERT(MMS_TRANSFER_LIST(self)); g_object_ref(self); } return self; @@ -56,7 +55,7 @@ mms_transfer_list_unref( MMSTransferList* self) { if (self) { - MMS_ASSERT(MMS_TRANSFER_LIST(self)); + GASSERT(MMS_TRANSFER_LIST(self)); g_object_unref(self); } } diff --git a/mms-lib/test/common/Makefile b/mms-lib/test/common/Makefile index 2ee40df..e6e6829 100644 --- a/mms-lib/test/common/Makefile +++ b/mms-lib/test/common/Makefile @@ -65,8 +65,7 @@ MMS_LIB_DIR = ../.. MMS_LIB_BUILD_DIR = $(MMS_LIB_DIR)/build MMS_LIB_DEBUG_LIB = $(MMS_LIB_BUILD_DIR)/debug/$(MMS_LIB_LIB) MMS_LIB_RELEASE_LIB = $(MMS_LIB_BUILD_DIR)/release/$(MMS_LIB_LIB) -MMS_LIB_MAKE = $(MAKE) --no-print-directory -C $(MMS_LIB_DIR) \ - GCOV=$(GCOV) MMS_LOG_SYSLOG=0 +MMS_LIB_MAKE = $(MAKE) --no-print-directory -C $(MMS_LIB_DIR) GCOV=$(GCOV) # # Tools and flags diff --git a/mms-lib/test/common/test_connection.c b/mms-lib/test/common/test_connection.c index 0ada2dc..fa683ab 100644 --- a/mms-lib/test/common/test_connection.c +++ b/mms-lib/test/common/test_connection.c @@ -10,15 +10,14 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "test_connection.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_connection_log -#include "mms_lib_log.h" -MMS_LOG_MODULE_DEFINE("mms-connection-test"); +#define GLOG_MODULE_NAME mms_connection_log +#include +GLOG_MODULE_DEFINE("mms-connection-test"); typedef MMSConnectionClass MMSConnectionTestClass; typedef struct mms_connection_test { @@ -29,7 +28,7 @@ typedef struct mms_connection_test { char* netif; } MMSConnectionTest; -G_DEFINE_TYPE(MMSConnectionTest, mms_connection_test, MMS_TYPE_CONNECTION); +G_DEFINE_TYPE(MMSConnectionTest, mms_connection_test, MMS_TYPE_CONNECTION) #define MMS_TYPE_CONNECTION_TEST (mms_connection_test_get_type()) #define MMS_CONNECTION_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\ MMS_TYPE_CONNECTION_TEST, MMSConnectionTest)) @@ -139,7 +138,7 @@ void mms_connection_test_init( MMSConnectionTest* conn) { - MMS_VERBOSE_("%p", conn); + GVERBOSE_("%p", conn); } /* diff --git a/mms-lib/test/common/test_connman.c b/mms-lib/test/common/test_connman.c index 595671f..c42e42d 100644 --- a/mms-lib/test/common/test_connman.c +++ b/mms-lib/test/common/test_connman.c @@ -10,16 +10,15 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "test_connman.h" #include "test_connection.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_connman_log -#include "mms_lib_log.h" -MMS_LOG_MODULE_DEFINE("mms-connman-test"); +#define GLOG_MODULE_NAME mms_connman_log +#include +GLOG_MODULE_DEFINE("mms-connman-test"); typedef MMSConnManClass MMSConnManTestClass; typedef struct mms_connman_test { @@ -33,7 +32,7 @@ typedef struct mms_connman_test { void* connect_param; } MMSConnManTest; -G_DEFINE_TYPE(MMSConnManTest, mms_connman_test, MMS_TYPE_CONNMAN); +G_DEFINE_TYPE(MMSConnManTest, mms_connman_test, MMS_TYPE_CONNMAN) #define MMS_TYPE_CONNMAN_TEST (mms_connman_test_get_type()) #define MMS_CONNMAN_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\ MMS_TYPE_CONNMAN_TEST, MMSConnManTest)) @@ -94,7 +93,7 @@ mms_connman_test_close_connection( { MMSConnManTest* test = MMS_CONNMAN_TEST(cm); if (test->conn) { - MMS_DEBUG("Closing connection..."); + GDEBUG("Closing connection..."); mms_connman_test_make_busy(test); mms_connection_close(test->conn); mms_connection_unref(test->conn); diff --git a/mms-lib/test/common/test_handler.c b/mms-lib/test/common/test_handler.c index bd275d0..801087b 100644 --- a/mms-lib/test/common/test_handler.c +++ b/mms-lib/test/common/test_handler.c @@ -10,16 +10,15 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "test_handler.h" #include "mms_dispatcher.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_handler_log -#include "mms_lib_log.h" -MMS_LOG_MODULE_DEFINE("mms-handler-test"); +#define GLOG_MODULE_NAME mms_handler_log +#include +GLOG_MODULE_DEFINE("mms-handler-test"); /* Class definition */ typedef MMSHandlerClass MMSHandlerTestClass; @@ -95,7 +94,7 @@ enum mms_handler_signal { static guint mms_handler_test_signals[SIGNAL_COUNT] = { 0 }; -G_DEFINE_TYPE(MMSHandlerTest, mms_handler_test, MMS_TYPE_HANDLER); +G_DEFINE_TYPE(MMSHandlerTest, mms_handler_test, MMS_TYPE_HANDLER) #define MMS_TYPE_HANDLER_TEST (mms_handler_test_get_type()) #define MMS_HANDLER_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ MMS_TYPE_HANDLER_TEST, MMSHandlerTest)) @@ -104,7 +103,7 @@ static inline MMSHandlerRecordSend* mms_handler_test_record_send(MMSHandlerRecord* rec) { - MMS_ASSERT(rec->type == MMS_HANDLER_RECORD_SEND); + GASSERT(rec->type == MMS_HANDLER_RECORD_SEND); return MMS_CAST(rec, MMSHandlerRecordSend, rec); } @@ -112,7 +111,7 @@ static inline MMSHandlerRecordReceive* mms_handler_test_record_receive(MMSHandlerRecord* rec) { - MMS_ASSERT(rec->type == MMS_HANDLER_RECORD_RECEIVE); + GASSERT(rec->type == MMS_HANDLER_RECORD_RECEIVE); return MMS_CAST(rec, MMSHandlerRecordReceive, rec); } @@ -163,7 +162,7 @@ mms_handler_get_send_record_for_msgid_cb( MMSHandlerRecordSend* send = mms_handler_test_record_send(rec); MMSHandlerSendMsgIdSearch* search = user_data; if (!strcmp(send->msgid, search->msgid)) { - MMS_ASSERT(!search->send); + GASSERT(!search->send); search->send = send; } } @@ -371,8 +370,8 @@ mms_handler_test_hash_remove_record( if (rec->type == MMS_HANDLER_RECORD_RECEIVE) { MMSHandlerRecordReceive* recv = mms_handler_test_record_receive(rec); if (recv->notify) { - MMS_ASSERT(recv->notify->defer_id); - MMS_ASSERT(recv->notify->recv == recv); + GASSERT(recv->notify->defer_id); + GASSERT(recv->notify->recv == recv); g_source_remove(recv->notify->defer_id); recv->notify->defer_id = 0; recv->notify->recv = NULL; @@ -400,9 +399,9 @@ mms_handler_test_receive( { MMSHandlerRecordReceive* recv = data; MMSDispatcher* disp = recv->dispatcher; - MMS_ASSERT(recv->defer_id); - MMS_ASSERT(recv->dispatcher); - MMS_DEBUG("Initiating receive of message %s", recv->rec.id); + GASSERT(recv->defer_id); + GASSERT(recv->dispatcher); + GDEBUG("Initiating receive of message %s", recv->rec.id); recv->defer_id = 0; recv->dispatcher = NULL; mms_dispatcher_receive_message(disp, recv->rec.id, recv->rec.imsi, @@ -420,7 +419,7 @@ mms_handler_test_notify_delete( mms_handler_busy_dec(¬ify->test->handler); mms_handler_unref(¬ify->test->handler); if (notify->recv) { - MMS_ASSERT(!notify->recv->notify || notify->recv->notify == notify); + GASSERT(!notify->recv->notify || notify->recv->notify == notify); notify->recv->notify = NULL; } g_free(notify->id); @@ -503,17 +502,17 @@ mms_handler_test_message_notify( notify->param = param; if (test->prenotify_fn && !test->prenotify_fn(handler, imsi, from, subj, expiry, data, test->prenotify_data)) { - MMS_DEBUG("Rejecting push imsi=%s from=%s subj=%s", imsi, from, subj); + GDEBUG("Rejecting push imsi=%s from=%s subj=%s", imsi, from, subj); } else { MMSHandlerRecordReceive* recv = mms_handler_test_receive_create(test, imsi); const char* id = recv->rec.id; recv->data = g_bytes_ref(data); - MMS_DEBUG("Push %s imsi=%s from=%s subj=%s", id, imsi, from, subj); + GDEBUG("Push %s imsi=%s from=%s subj=%s", id, imsi, from, subj); recv->notify = notify; notify->recv = recv; if (test->dispatcher) { - MMS_DEBUG("Deferring push"); + GDEBUG("Deferring push"); recv->defer_id = g_idle_add(mms_handler_test_receive, recv); recv->dispatcher = mms_dispatcher_ref(test->dispatcher); notify->id = g_strdup(""); @@ -570,12 +569,12 @@ mms_handler_test_message_received( MMSHandlerTest* test = MMS_HANDLER_TEST(handler); MMSHandlerRecordReceive* recv = mms_handler_test_get_receive_record(test, msg->id); - MMS_DEBUG("Message %s from=%s subj=%s", msg->id, msg->from, msg->subject); - MMS_ASSERT(recv); + GDEBUG("Message %s from=%s subj=%s", msg->id, msg->from, msg->subject); + GASSERT(recv); if (recv) { MMSHandlerMessageReceivedCall* call = g_new0(MMSHandlerMessageReceivedCall,1); - MMS_ASSERT(!recv->msg); + GASSERT(!recv->msg); mms_message_unref(recv->msg); recv->msg = mms_message_ref(msg); mms_handler_busy_inc(handler); @@ -605,12 +604,12 @@ mms_handler_test_message_receive_state_changed( mms_handler_test_get_receive_record(MMS_HANDLER_TEST(handler), id); if (recv) { recv->state = state; - MMS_DEBUG("Message %s receive state %d", id, state); + GDEBUG("Message %s receive state %d", id, state); g_signal_emit(handler, mms_handler_test_signals[ SIGNAL_MESSAGE_RECEIVE_STATE_CHANGED], 0, id, state); return TRUE; } else { - MMS_ERR("No such incoming message: %s", id); + GERR("No such incoming message: %s", id); return FALSE; } } @@ -629,7 +628,7 @@ mms_handler_test_send_new( send->state = MMS_SEND_STATE_INVALID; send->delivery_status = MMS_DELIVERY_STATUS_INVALID; send->read_status = MMS_READ_STATUS_INVALID; - MMS_DEBUG("New send %s imsi=%s", id, imsi); + GDEBUG("New send %s imsi=%s", id, imsi); g_hash_table_replace(test->recs, id, &send->rec); return id; } @@ -649,15 +648,15 @@ mms_handler_test_message_send_state_changed( g_free(send->details); send->details = g_strdup(details); if (details) { - MMS_DEBUG("Message %s send state %d: %s", id, state, details); + GDEBUG("Message %s send state %d: %s", id, state, details); } else { - MMS_DEBUG("Message %s send state %d", id, state); + GDEBUG("Message %s send state %d", id, state); } g_signal_emit(handler, mms_handler_test_signals[ SIGNAL_MESSAGE_SEND_STATE_CHANGED], 0, id, state, details); return TRUE; } else { - MMS_ERR("No such outbound message: %s", id); + GERR("No such outbound message: %s", id); return FALSE; } } @@ -671,10 +670,10 @@ mms_handler_test_message_sent( { MMSHandlerTest* test = MMS_HANDLER_TEST(handler); MMSHandlerRecordSend* send = mms_handler_test_get_send_record(test, id); - MMS_DEBUG("Message %s sent, msgid=%s", id, msgid); - MMS_ASSERT(send); + GDEBUG("Message %s sent, msgid=%s", id, msgid); + GASSERT(send); if (send) { - MMS_ASSERT(!send->msgid); + GASSERT(!send->msgid); if (!send->msgid) { send->msgid = g_strdup(msgid); return TRUE; @@ -695,15 +694,15 @@ mms_handler_test_delivery_report( MMSHandlerTest* test = MMS_HANDLER_TEST(handler); MMSHandlerRecordSend* send = mms_handler_get_send_record_for_msgid(test, msgid); - MMS_DEBUG("Message %s delivered to %s", msgid, recipient); + GDEBUG("Message %s delivered to %s", msgid, recipient); if (send) { - MMS_ASSERT(send->delivery_status == MMS_DELIVERY_STATUS_INVALID); + GASSERT(send->delivery_status == MMS_DELIVERY_STATUS_INVALID); if (send->delivery_status == MMS_DELIVERY_STATUS_INVALID) { send->delivery_status = status; return TRUE; } } else { - MMS_DEBUG("Unknown message id %s (this may be OK)", msgid); + GDEBUG("Unknown message id %s (this may be OK)", msgid); } return FALSE; } @@ -720,15 +719,15 @@ mms_handler_test_read_report( MMSHandlerTest* test = MMS_HANDLER_TEST(handler); MMSHandlerRecordSend* send = mms_handler_get_send_record_for_msgid(test, msgid); - MMS_DEBUG("Message %s read by %s", msgid, recipient); + GDEBUG("Message %s read by %s", msgid, recipient); if (send) { - MMS_ASSERT(send->read_status == MMS_READ_STATUS_INVALID); + GASSERT(send->read_status == MMS_READ_STATUS_INVALID); if (send->read_status == MMS_READ_STATUS_INVALID) { send->read_status = status; return TRUE; } } else { - MMS_DEBUG("Unknown message id %s (this may be OK)", msgid); + GDEBUG("Unknown message id %s (this may be OK)", msgid); } return FALSE; } @@ -742,11 +741,11 @@ mms_handler_test_read_report_send_status( MMSHandlerRecordReceive* recv = mms_handler_test_get_receive_record(MMS_HANDLER_TEST(handler), id); if (recv) { - MMS_DEBUG("Read report %s status %d", id, status); + GDEBUG("Read report %s status %d", id, status); recv->read_report_status = status; return TRUE; } else { - MMS_DEBUG("Unknown record id %s", id); + GDEBUG("Unknown record id %s", id); return FALSE; } } @@ -831,7 +830,7 @@ mms_handler_test_set_prenotify_fn( void* user_data) { MMSHandlerTest* test = MMS_HANDLER_TEST(handler); - MMS_ASSERT(!test->prenotify_fn); + GASSERT(!test->prenotify_fn); test->prenotify_fn = cb; test->prenotify_data = user_data; } @@ -843,7 +842,7 @@ mms_handler_test_set_postnotify_fn( void* user_data) { MMSHandlerTest* test = MMS_HANDLER_TEST(handler); - MMS_ASSERT(!test->postnotify_fn); + GASSERT(!test->postnotify_fn); test->postnotify_fn = cb; test->postnotify_data = user_data; } diff --git a/mms-lib/test/common/test_http.c b/mms-lib/test/common/test_http.c index 7dc50e4..fbf6ea7 100644 --- a/mms-lib/test/common/test_http.c +++ b/mms-lib/test/common/test_http.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013-2016 Jolla Ltd. + * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -9,12 +10,11 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "test_http.h" -#include "mms_log.h" +#include #include @@ -55,7 +55,7 @@ test_http_callback( { TestHttp* http = data; char* uri = soup_uri_to_string(soup_message_get_uri (msg), FALSE); - MMS_VERBOSE("%s %s HTTP/1.%d", msg->method, uri, + GVERBOSE("%s %s HTTP/1.%d", msg->method, uri, soup_message_get_http_version(msg)); g_free(uri); if (msg->method == SOUP_METHOD_CONNECT) { @@ -205,7 +205,7 @@ test_http_new( http->port = soup_server_get_port(http->server); soup_server_run_async(http->server); #endif - MMS_DEBUG("Listening on port %hu", http->port); + GDEBUG("Listening on port %hu", http->port); soup_server_add_handler(http->server, NULL, test_http_callback, http, NULL); if (get_file || resp_content_type || resp_status) { test_http_add_response(http, get_file, resp_content_type, resp_status); @@ -218,7 +218,7 @@ test_http_ref( TestHttp* http) { if (http) { - MMS_ASSERT(http->ref_count > 0); + GASSERT(http->ref_count > 0); g_atomic_int_inc(&http->ref_count); } return http; @@ -229,7 +229,7 @@ test_http_unref( TestHttp* http) { if (http) { - MMS_ASSERT(http->ref_count > 0); + GASSERT(http->ref_count > 0); if (g_atomic_int_dec_and_test(&http->ref_count)) { test_http_close(http); g_ptr_array_unref(http->responses); diff --git a/mms-lib/test/common/test_transfer_list.c b/mms-lib/test/common/test_transfer_list.c index ce0d5eb..86f5073 100644 --- a/mms-lib/test/common/test_transfer_list.c +++ b/mms-lib/test/common/test_transfer_list.c @@ -10,15 +10,14 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "test_transfer_list.h" /* Logging */ -#define MMS_LOG_MODULE_NAME mms_transfer_list_log -#include "mms_lib_log.h" -MMS_LOG_MODULE_DEFINE("mms-transfer-list-test"); +#define GLOG_MODULE_NAME mms_transfer_list_log +#include +GLOG_MODULE_DEFINE("mms-transfer-list-test"); /* Class definition */ typedef MMSTransferListClass MMSTransferListTestClass; diff --git a/mms-lib/test/common/test_util.c b/mms-lib/test/common/test_util.c index fe15e2f..b5a3153 100644 --- a/mms-lib/test/common/test_util.c +++ b/mms-lib/test/common/test_util.c @@ -10,12 +10,12 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "test_util.h" #include "mms_file_util.h" -#include "mms_log.h" + +#include void test_dirs_init( @@ -26,7 +26,7 @@ test_dirs_init( dirs->root = g_mkdtemp(g_strconcat(tmp, "/", test, "_XXXXXX", NULL)); dirs->msg = g_strconcat(dirs->root, "/" MMS_MESSAGE_DIR, NULL); dirs->attic = g_strconcat(dirs->root, "/" MMS_ATTIC_DIR, NULL); - MMS_VERBOSE("Temporary directory %s", dirs->root); + GVERBOSE("Temporary directory %s", dirs->root); } static @@ -36,10 +36,10 @@ test_dir_remove( { if (rmdir(dir) < 0) { if (errno != ENOENT) { - MMS_ERR("Failed to remove %s: %s", dir, strerror(errno)); + GERR("Failed to remove %s: %s", dir, strerror(errno)); } } else { - MMS_VERBOSE("Deleted %s", dir); + GVERBOSE("Deleted %s", dir); } } diff --git a/mms-lib/test/test_delivery_ind/test_delivery_ind.c b/mms-lib/test/test_delivery_ind/test_delivery_ind.c index c9dfab8..5d98da4 100644 --- a/mms-lib/test/test_delivery_ind/test_delivery_ind.c +++ b/mms-lib/test/test_delivery_ind/test_delivery_ind.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "test_connman.h" @@ -23,6 +22,9 @@ #include "mms_settings.h" #include "mms_dispatcher.h" +#include +#include + #define RET_OK (0) #define RET_ERR (1) #define RET_TIMEOUT (2) @@ -81,10 +83,10 @@ test_finish( ds = mms_handler_test_delivery_status(test->handler, test->id); if (ds != desc->status) { test->ret = RET_ERR; - MMS_ERR("%s status %d, expected %d", name, ds, desc->status); + GERR("%s status %d, expected %d", name, ds, desc->status); } } - MMS_INFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", name); + GINFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", name); mms_handler_test_reset(test->handler); g_main_loop_quit(test->loop); } @@ -95,7 +97,7 @@ test_done( MMSDispatcherDelegate* delegate, MMSDispatcher* dispatcher) { - Test* test = MMS_CAST(delegate,Test,delegate); + Test* test = G_CAST(delegate,Test,delegate); if (!mms_handler_test_receive_pending(test->handler, NULL)) { test_finish(test); } @@ -109,7 +111,7 @@ test_timeout( Test* test = data; test->timeout_id = 0; test->ret = RET_TIMEOUT; - MMS_INFO("%s TIMEOUT", test->desc->name); + GINFO("%s TIMEOUT", test->desc->name); mms_connman_test_close_connection(test->cm); mms_dispatcher_cancel(test->disp, NULL); return FALSE; @@ -145,7 +147,7 @@ test_init( test->ret = RET_ERR; ok = TRUE; } else { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } g_free(ni); @@ -188,11 +190,11 @@ test_run_one( test.ret = RET_OK; g_main_loop_run(test.loop); } else { - MMS_INFO("%s FAILED", desc->name); + GINFO("%s FAILED", desc->name); } } else { - MMS_ERR("%s", MMS_ERRMSG(error)); - MMS_INFO("%s FAILED", desc->name); + GERR("%s", GERRMSG(error)); + GINFO("%s FAILED", desc->name); g_error_free(error); } g_bytes_unref(push); @@ -220,7 +222,7 @@ test_run( break; } } - if (!found) MMS_ERR("No such test: %s", name); + if (!found) GERR("No such test: %s", name); } else { for (i=0, ret = RET_OK; i 1 && !strcmp(argv[1], "-v")) { - mms_log_default.level = MMS_LOGLEVEL_VERBOSE; + gutil_log_default.level = GLOG_LEVEL_VERBOSE; memmove(argv + 1, argv + 2, (argc-2)*sizeof(argv[0])); argc--; } else { - mms_log_default.level = MMS_LOGLEVEL_INFO; - mms_task_notification_log.level = MMS_LOGLEVEL_NONE; - mms_log_stdout_timestamp = FALSE; + gutil_log_timestamp = FALSE; + gutil_log_default.level = GLOG_LEVEL_INFO; + mms_task_notification_log.level = GLOG_LEVEL_NONE; } if (argc == 2 && argv[1][0] != '-') { diff --git a/mms-lib/test/test_media_type/test_media_type.c b/mms-lib/test/test_media_type/test_media_type.c index 33d8757..dc3f482 100644 --- a/mms-lib/test/test_media_type/test_media_type.c +++ b/mms-lib/test/test_media_type/test_media_type.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2013-2014 Jolla Ltd. + * Copyright (C) 2013-2016 Jolla Ltd. + * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -9,11 +10,10 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ -#include "mms_log.h" #include "mms_codec.h" +#include typedef struct test_desc { const char* name; @@ -94,7 +94,7 @@ run_test( ok = TRUE; } g_strfreev(parsed); - MMS_INFO("%s: %s", ok ? "OK" : "FAILED", test->name); + GINFO("%s: %s", ok ? "OK" : "FAILED", test->name); return ok; } @@ -116,9 +116,9 @@ run_tests( int main(int argc, char* argv[]) { - mms_log_set_type(MMS_LOG_TYPE_STDOUT, "test_media_type"); - mms_log_stdout_timestamp = FALSE; - mms_log_default.level = MMS_LOGLEVEL_INFO; + gutil_log_set_type(GLOG_TYPE_STDOUT, "test_media_type"); + gutil_log_timestamp = FALSE; + gutil_log_default.level = GLOG_LEVEL_INFO; return !run_tests(media_type_tests, G_N_ELEMENTS(media_type_tests)); } diff --git a/mms-lib/test/test_mms_codec/test_mms_codec.c b/mms-lib/test/test_mms_codec/test_mms_codec.c index 254351e..f072a30 100644 --- a/mms-lib/test/test_mms_codec/test_mms_codec.c +++ b/mms-lib/test/test_mms_codec/test_mms_codec.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Jolla Ltd. + * Copyright (C) 2013-2016 Jolla Ltd. * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify @@ -10,13 +10,14 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_lib_util.h" #include "mms_lib_log.h" #include "mms_codec.h" +#include + #define DATA_DIR "data/" #define RET_OK (0) @@ -40,12 +41,12 @@ test_file( g_mapped_file_unref(map); mms_message_free(msg); if (ok) { - MMS_INFO("OK: %s", file); + GINFO("OK: %s", file); return TRUE; } - MMS_ERR("Failed to decode %s", file); + GERR("Failed to decode %s", file); } else { - MMS_ERR("%s", error->message); + GERR("%s", error->message); g_error_free(error); } return FALSE; @@ -95,13 +96,13 @@ int main(int argc, char* argv[]) if (g_option_context_parse(options, &argc, &argv, NULL)) { int i; - mms_log_set_type(MMS_LOG_TYPE_STDOUT, "test_mms_codec"); + gutil_log_set_type(GLOG_TYPE_STDOUT, "test_mms_codec"); if (verbose) { - mms_log_default.level = MMS_LOGLEVEL_VERBOSE; + gutil_log_default.level = GLOG_LEVEL_VERBOSE; } else { - mms_log_stdout_timestamp = FALSE; - mms_log_default.level = MMS_LOGLEVEL_INFO; - mms_codec_log.level = MMS_LOGLEVEL_ERR; + gutil_log_timestamp = FALSE; + gutil_log_default.level = GLOG_LEVEL_INFO; + mms_codec_log.level = GLOG_LEVEL_ERR; } ret = RET_OK; diff --git a/mms-lib/test/test_read_ind/test_read_ind.c b/mms-lib/test/test_read_ind/test_read_ind.c index d899eb9..417ba18 100644 --- a/mms-lib/test/test_read_ind/test_read_ind.c +++ b/mms-lib/test/test_read_ind/test_read_ind.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "test_connman.h" @@ -23,6 +22,9 @@ #include "mms_settings.h" #include "mms_dispatcher.h" +#include +#include + #define RET_OK (0) #define RET_ERR (1) #define RET_TIMEOUT (2) @@ -81,10 +83,10 @@ test_finish( rs = mms_handler_test_read_status(test->handler, test->id); if (rs != desc->status) { test->ret = RET_ERR; - MMS_ERR("%s status %d, expected %d", name, rs, desc->status); + GERR("%s status %d, expected %d", name, rs, desc->status); } } - MMS_INFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", name); + GINFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", name); mms_handler_test_reset(test->handler); g_main_loop_quit(test->loop); } @@ -95,7 +97,7 @@ test_done( MMSDispatcherDelegate* delegate, MMSDispatcher* dispatcher) { - Test* test = MMS_CAST(delegate,Test,delegate); + Test* test = G_CAST(delegate,Test,delegate); if (!mms_handler_test_receive_pending(test->handler, NULL)) { test_finish(test); } @@ -109,7 +111,7 @@ test_timeout( Test* test = data; test->timeout_id = 0; test->ret = RET_TIMEOUT; - MMS_INFO("%s TIMEOUT", test->desc->name); + GINFO("%s TIMEOUT", test->desc->name); mms_connman_test_close_connection(test->cm); mms_dispatcher_cancel(test->disp, NULL); return FALSE; @@ -145,7 +147,7 @@ test_init( test->ret = RET_ERR; ok = TRUE; } else { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } g_free(ni); @@ -188,11 +190,11 @@ test_run_one( test.ret = RET_OK; g_main_loop_run(test.loop); } else { - MMS_INFO("%s FAILED", desc->name); + GINFO("%s FAILED", desc->name); } } else { - MMS_ERR("%s", MMS_ERRMSG(error)); - MMS_INFO("%s FAILED", desc->name); + GERR("%s", GERRMSG(error)); + GINFO("%s FAILED", desc->name); g_error_free(error); } g_bytes_unref(push); @@ -220,7 +222,7 @@ test_run( break; } } - if (!found) MMS_ERR("No such test: %s", name); + if (!found) GERR("No such test: %s", name); } else { for (i=0, ret = RET_OK; i 1 && !strcmp(argv[1], "-v")) { - mms_log_default.level = MMS_LOGLEVEL_VERBOSE; + gutil_log_default.level = GLOG_LEVEL_VERBOSE; memmove(argv + 1, argv + 2, (argc-2)*sizeof(argv[0])); argc--; } else { - mms_log_default.level = MMS_LOGLEVEL_INFO; - mms_task_notification_log.level = MMS_LOGLEVEL_NONE; - mms_log_stdout_timestamp = FALSE; + gutil_log_timestamp = FALSE; + gutil_log_default.level = GLOG_LEVEL_INFO; + mms_task_notification_log.level = GLOG_LEVEL_NONE; } if (argc == 2 && argv[1][0] != '-') { diff --git a/mms-lib/test/test_read_report/test_read_report.c b/mms-lib/test/test_read_report/test_read_report.c index 6c7f3ef..751d58e 100644 --- a/mms-lib/test/test_read_report/test_read_report.c +++ b/mms-lib/test/test_read_report/test_read_report.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "test_connman.h" @@ -18,13 +17,14 @@ #include "test_http.h" #include "test_util.h" -#include "mms_log.h" #include "mms_codec.h" #include "mms_lib_log.h" #include "mms_lib_util.h" #include "mms_settings.h" #include "mms_dispatcher.h" +#include + #include #include @@ -93,30 +93,30 @@ test_done( test->ret = RET_ERR; if (mms_message_decode(resp_data, resp_len, pdu)) { if (pdu->type != MMS_MESSAGE_TYPE_READ_REC_IND) { - MMS_ERR("Unexpected PDU type %u", pdu->type); + GERR("Unexpected PDU type %u", pdu->type); } else if (pdu->ri.rr_status != desc->rr_status) { - MMS_ERR("Read status %d, expected %d", + GERR("Read status %d, expected %d", pdu->ri.rr_status, desc->rr_status); } else if (g_strcmp0(pdu->ri.to, desc->to)) { - MMS_ERR("Phone number %s, expected %s", + GERR("Phone number %s, expected %s", pdu->ri.to, desc->to); } else { MMS_READ_REPORT_STATUS status = mms_handler_test_read_report_status(test->handler, test->id); if (status != MMS_READ_REPORT_STATUS_OK) { - MMS_ERR("Unexpected status %d", status); + GERR("Unexpected status %d", status); } else { test->ret = RET_OK; } } } else { - MMS_ERR("Can't decode PDU"); + GERR("Can't decode PDU"); } mms_message_free(pdu); } } - MMS_INFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", name); + GINFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", name); g_main_loop_quit(test->loop); } @@ -128,7 +128,7 @@ test_timeout( Test* test = data; test->timeout_id = 0; test->ret = RET_TIMEOUT; - MMS_INFO("TIMEOUT"); + GINFO("TIMEOUT"); if (test->http) test_http_close(test->http); mms_connman_test_close_connection(test->cm); mms_dispatcher_cancel(test->disp, NULL); @@ -144,7 +144,7 @@ test_init( gboolean debug) { MMSSettings* settings = mms_settings_default_new(config); - MMS_DEBUG(">>>>>>>>>> %s <<<<<<<<<<", desc->name); + GDEBUG(">>>>>>>>>> %s <<<<<<<<<<", desc->name); test->desc = desc; test->cm = mms_connman_test_new(); test->handler = mms_handler_test_new(); @@ -198,11 +198,11 @@ test_read_report_once( test.ret = RET_OK; g_main_loop_run(test.loop); } else { - MMS_INFO("FAILED"); + GINFO("FAILED"); } } else { g_error_free(error); - MMS_INFO("FAILED"); + GINFO("FAILED"); } test_finalize(&test); return test.ret; @@ -226,7 +226,7 @@ test_read_report( break; } } - if (!found) MMS_ERR("No such test: %s", name); + if (!found) GERR("No such test: %s", name); } else { for (i=0, ret = RET_OK; i * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -9,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_attachment.h" @@ -18,6 +18,9 @@ #include "mms_lib_log.h" #include "mms_file_util.h" +#include +#include + #include #include #include @@ -192,7 +195,7 @@ test_jpeg_error_log( buf[0] = 0; cinfo->err->format_message(cinfo, buf); buf[JMSG_LENGTH_MAX] = 0; - mms_log(NULL, level, "%s", buf); + gutil_log(NULL, level, "%s", buf); g_free(buf); } @@ -202,7 +205,7 @@ test_jpeg_error_exit( j_common_ptr cinfo) { TestJpegError* err = (TestJpegError*)cinfo->err; - test_jpeg_error_log(MMS_LOGLEVEL_ERR, cinfo); + test_jpeg_error_log(GLOG_LEVEL_ERR, cinfo); longjmp(err->setjmp_buf, 1); } @@ -211,7 +214,7 @@ void test_jpeg_error_output( j_common_ptr cinfo) { - test_jpeg_error_log(MMS_LOGLEVEL_DEBUG, cinfo); + test_jpeg_error_log(GLOG_LEVEL_DEBUG, cinfo); } static @@ -232,7 +235,7 @@ boolean test_jpeg_APP1( j_decompress_ptr cinfo) { - TestJpegDecompress* dec = MMS_CAST(cinfo, TestJpegDecompress, pub); + TestJpegDecompress* dec = G_CAST(cinfo, TestJpegDecompress, pub); ExifLoader* eloader; ExifData* edata; unsigned int len; @@ -243,7 +246,7 @@ test_jpeg_APP1( buf[1] = test_jpeg_getc(cinfo); len = buf[0] << 8; len += buf[1]; - MMS_DEBUG("Marker 0x%02X %u bytes", cinfo->unread_marker, len); + GDEBUG("Marker 0x%02X %u bytes", cinfo->unread_marker, len); if (len < 2) ERREXIT(cinfo, JERR_BAD_LENGTH); /* Feed the whole thing to the Exit loader */ @@ -271,7 +274,7 @@ test_jpeg_APP1( /* Actually there are two bytes there but the second one * should be zero */ dec->orientation = orientation->data[0]; - MMS_DEBUG("Orientation %d", dec->orientation); + GDEBUG("Orientation %d", dec->orientation); } exif_data_unref(edata); } @@ -385,10 +388,10 @@ test_run_one( if (!strcmp(at->file_name, testfile)) { ret = RET_OK; } else { - MMS_DEBUG("Reset didn't work"); + GDEBUG("Reset didn't work"); } } else { - MMS_ERR("Output size mismatch: (%ux%u) vs (%ux%u)", + GERR("Output size mismatch: (%ux%u) vs (%ux%u)", size.width, size.height, test->size.width, test->size.height); } @@ -401,15 +404,15 @@ test_run_one( mms_attachment_unref(at); mms_attachment_unref(at); } else { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } } else { - MMS_ERR("Failed to copy %s -> %s", test->file, testfile); + GERR("Failed to copy %s -> %s", test->file, testfile); } g_free(testfile); } - MMS_INFO("%s: %s", (ret == RET_OK) ? "OK" : "FAILED", test->name); + GINFO("%s: %s", (ret == RET_OK) ? "OK" : "FAILED", test->name); g_free(name); g_free(tmpl); return ret; @@ -432,7 +435,7 @@ test_run( break; } } - if (!found) MMS_ERR("No such test: %s", name); + if (!found) GERR("No such test: %s", name); } else { for (i=0, ret = RET_OK; i #include #define RET_OK (0) @@ -374,7 +374,7 @@ test_files_equal( } } if (!equal) { - MMS_ERR("%s is not identical to %s", path1, path2); + GERR("%s is not identical to %s", path1, path2); } return equal; } @@ -412,21 +412,21 @@ test_validate_parts( } if (strcmp(expect->content_type, part->content_type)) { - MMS_ERR("Content type mismatch: expected %s, got %s", + GERR("Content type mismatch: expected %s, got %s", expect->content_type, part->content_type); return RET_ERR; } if (strcmp(expect->file_name, fname)) { - MMS_ERR("File name mismatch: expected %s, got %s", + GERR("File name mismatch: expected %s, got %s", expect->file_name, fname); return RET_ERR; } if (!part->content_id) { - MMS_ERR("Missing content id"); + GERR("Missing content id"); return RET_ERR; } if (strcmp(expect->content_id, part->content_id)) { - MMS_ERR("Content-ID mismatch: expected %s, got %s", + GERR("Content-ID mismatch: expected %s, got %s", expect->content_id, part->content_id); return RET_ERR; } @@ -435,7 +435,7 @@ test_validate_parts( } return RET_OK; } - MMS_ERR("%u parts expected, got %u", desc->nparts, nparts); + GERR("%u parts expected, got %u", desc->nparts, nparts); return RET_ERR; } } @@ -452,7 +452,7 @@ test_finish( state = mms_handler_test_receive_state(test->handler, NULL); if (state != desc->expected_state) { test->ret = RET_ERR; - MMS_ERR("%s state %d, expected %d", name, state, + GERR("%s state %d, expected %d", name, state, desc->expected_state); } else { const void* resp_data = NULL; @@ -467,21 +467,21 @@ test_finish( test->ret = test_validate_parts(test); } else { test->ret = RET_ERR; - MMS_ERR("%s reply %u, expected %u", name, + GERR("%s reply %u, expected %u", name, pdu->type, desc->reply_msg); } } else { test->ret = RET_ERR; - MMS_ERR("%s can't decode reply message", name); + GERR("%s can't decode reply message", name); } mms_message_free(pdu); } else { test->ret = RET_ERR; - MMS_ERR("%s expects no reply", name); + GERR("%s expects no reply", name); } } else if (desc->reply_msg) { test->ret = RET_ERR; - MMS_ERR("%s expects reply", name); + GERR("%s expects reply", name); } } } @@ -501,7 +501,7 @@ test_finish( g_free(f1); g_free(f2); } - MMS_INFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", name); + GINFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", name); mms_handler_test_reset(test->handler); g_signal_handler_disconnect(test->handler, test->msgreceived_id); g_main_loop_quit(test->loop); @@ -527,7 +527,7 @@ test_timeout( Test* test = data; test->timeout_id = 0; test->ret = RET_TIMEOUT; - MMS_INFO("%s TIMEOUT", test->desc->name); + GINFO("%s TIMEOUT", test->desc->name); if (test->http) test_http_close(test->http); mms_connman_test_close_connection(test->cm); mms_dispatcher_cancel(test->disp, NULL); @@ -560,7 +560,7 @@ test_cancel_msg_proc( void* param) { TestCancelMsg* cancel = param; - MMS_VERBOSE("Cancelling message %s", cancel->msg->id); + GVERBOSE("Cancelling message %s", cancel->msg->id); mms_dispatcher_cancel(cancel->disp, cancel->msg->id); mms_dispatcher_unref(cancel->disp); mms_message_unref(cancel->msg); @@ -598,7 +598,7 @@ test_init( char* ni = g_strconcat(DATA_DIR, dir, "/", desc->ni_file, NULL); char* rc = desc->rc_file ? g_strconcat(DATA_DIR, dir, "/", desc->rc_file, NULL) : NULL; - MMS_DEBUG(">>>>>>>>>> %s <<<<<<<<<<", desc->name); + GDEBUG(">>>>>>>>>> %s <<<<<<<<<<", desc->name); memset(test, 0, sizeof(*test)); test->config = config; test->notification_ind = g_mapped_file_new(ni, FALSE, &error); @@ -641,12 +641,12 @@ test_init( test->ret = RET_ERR; ok = TRUE; } else { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } g_mapped_file_unref(test->notification_ind); } else { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } g_free(ni); @@ -695,7 +695,7 @@ test_retrieve_once( test.ret = RET_OK; g_main_loop_run(test.loop); } else { - MMS_INFO("%s FAILED", desc->name); + GINFO("%s FAILED", desc->name); } } else { g_error_free(error); @@ -703,7 +703,7 @@ test_retrieve_once( test.ret = RET_OK; test_finish(&test); } else { - MMS_INFO("%s FAILED", desc->name); + GINFO("%s FAILED", desc->name); } } g_bytes_unref(push); @@ -732,7 +732,7 @@ test_retrieve( break; } } - if (!found) MMS_ERR("No such test: %s", name); + if (!found) GERR("No such test: %s", name); } else { for (i=0, ret = RET_OK; i +#include + #define RET_OK (0) #define RET_ERR (1) #define RET_TIMEOUT (2) @@ -54,8 +55,8 @@ test_done( MMSDispatcherDelegate* delegate, MMSDispatcher* dispatcher) { - Test* test = MMS_CAST(delegate,Test,delegate); - MMS_INFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", + Test* test = G_CAST(delegate,Test,delegate); + GINFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", test->desc->name); g_main_loop_quit(test->loop); } @@ -68,7 +69,7 @@ test_timeout( Test* test = data; test->timeout_id = 0; test->ret = RET_TIMEOUT; - MMS_INFO("%s TIMEOUT", test->desc->name); + GINFO("%s TIMEOUT", test->desc->name); mms_dispatcher_cancel(test->disp, NULL); return FALSE; } @@ -128,7 +129,7 @@ test_cancel( { Test* test = param; test->cancel_id = 0; - MMS_DEBUG("Asynchronous cancel %s", test->id ? test->id : "all"); + GDEBUG("Asynchronous cancel %s", test->id ? test->id : "all"); mms_dispatcher_cancel(test->disp, test->id); return FALSE; } @@ -141,9 +142,9 @@ test_postnotify_cancel_async( void* param) { Test* test = param; - MMS_ASSERT(!test->id); - MMS_ASSERT(!test->cancel_id); - MMS_DEBUG("Scheduling asynchronous cancel for %s", id); + GASSERT(!test->id); + GASSERT(!test->cancel_id); + GDEBUG("Scheduling asynchronous cancel for %s", id); test->id = g_strdup(id); test->cancel_id = g_idle_add_full(G_PRIORITY_HIGH, test_cancel, test, NULL); } @@ -156,7 +157,7 @@ test_postnotify_cancel( void* param) { Test* test = param; - MMS_DEBUG("Cancel all"); + GDEBUG("Cancel all"); mms_dispatcher_cancel(test->disp, NULL); } @@ -172,9 +173,9 @@ test_prenotify_cancel_async( void* param) { Test* test = param; - MMS_ASSERT(!test->cancel_id); + GASSERT(!test->cancel_id); /* High priority item gets executed before notification is completed */ - MMS_DEBUG("Scheduling asynchronous cancel"); + GDEBUG("Scheduling asynchronous cancel"); test->cancel_id = g_idle_add_full(G_PRIORITY_HIGH, test_cancel, test, NULL); return TRUE; } @@ -187,7 +188,7 @@ test_once( Test test; MMSConfig config; GError* error = NULL; - MMS_VERBOSE(">>>>>>>>>>>>>> %s <<<<<<<<<<<<<<", desc->name); + GVERBOSE(">>>>>>>>>>>>>> %s <<<<<<<<<<<<<<", desc->name); mms_lib_default_config(&config); config.root_dir = "."; /* Dispatcher will attempt to create it */ test_init(&test, &config, desc); @@ -285,13 +286,13 @@ int main(int argc, char* argv[]) { int ret; mms_lib_init(argv[0]); - mms_log_default.name = "test_retrieve_cancel"; + gutil_log_default.name = "test_retrieve_cancel"; if (argc > 1 && !strcmp(argv[1], "-v")) { - mms_log_stdout_timestamp = TRUE; - mms_log_default.level = MMS_LOGLEVEL_VERBOSE; + gutil_log_timestamp = TRUE; + gutil_log_default.level = GLOG_LEVEL_VERBOSE; } else { - mms_log_stdout_timestamp = FALSE; - mms_log_default.level = MMS_LOGLEVEL_INFO; + gutil_log_timestamp = FALSE; + gutil_log_default.level = GLOG_LEVEL_INFO; } ret = test_run(); mms_lib_deinit(); diff --git a/mms-lib/test/test_retrieve_no_proxy/test_retrieve_no_proxy.c b/mms-lib/test/test_retrieve_no_proxy/test_retrieve_no_proxy.c index af18e26..d45efbe 100644 --- a/mms-lib/test/test_retrieve_no_proxy/test_retrieve_no_proxy.c +++ b/mms-lib/test/test_retrieve_no_proxy/test_retrieve_no_proxy.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "test_connman.h" @@ -18,7 +17,6 @@ #include "test_http.h" #include "test_util.h" -#include "mms_log.h" #include "mms_codec.h" #include "mms_file_util.h" #include "mms_lib_log.h" @@ -26,6 +24,7 @@ #include "mms_settings.h" #include "mms_dispatcher.h" +#include #include #include @@ -61,7 +60,7 @@ test_finish( state = mms_handler_test_receive_state(test->handler, NULL); if (state != MMS_RECEIVE_STATE_DECODING) { test->ret = RET_ERR; - MMS_ERR("Unexpected state %d", state); + GERR("Unexpected state %d", state); } else { const void* resp_data = NULL; gsize resp_len = 0; @@ -72,20 +71,20 @@ test_finish( if (mms_message_decode(resp_data, resp_len, pdu)) { if (pdu->type != MMS_MESSAGE_TYPE_ACKNOWLEDGE_IND) { test->ret = RET_ERR; - MMS_ERR("Unexpected reply %u", pdu->type); + GERR("Unexpected reply %u", pdu->type); } } else { test->ret = RET_ERR; - MMS_ERR("Failed to decode reply message"); + GERR("Failed to decode reply message"); } mms_message_free(pdu); } else { test->ret = RET_ERR; - MMS_ERR("Reply expected"); + GERR("Reply expected"); } } } - MMS_INFO("%s", (test->ret == RET_OK) ? "OK" : "FAILED"); + GINFO("%s", (test->ret == RET_OK) ? "OK" : "FAILED"); mms_handler_test_reset(test->handler); g_main_loop_quit(test->loop); } @@ -108,7 +107,7 @@ test_timeout( Test* test = data; test->timeout_id = 0; test->ret = RET_TIMEOUT; - MMS_INFO("TIMEOUT"); + GINFO("TIMEOUT"); if (test->http) test_http_close(test->http); mms_connman_test_close_connection(test->cm); mms_dispatcher_cancel(test->disp, NULL); @@ -170,7 +169,7 @@ test_init( test->ret = RET_ERR; ok = TRUE; } else { - MMS_ERR("%s", MMS_ERRMSG(err)); + GERR("%s", GERRMSG(err)); g_error_free(err); } return ok; @@ -212,11 +211,11 @@ test_retrieve_no_proxy( test.ret = RET_OK; g_main_loop_run(test.loop); } else { - MMS_INFO("FAILED"); + GINFO("FAILED"); } } else { g_error_free(error); - MMS_INFO("FAILED"); + GINFO("FAILED"); } test_finalize(&test); return test.ret; @@ -233,18 +232,18 @@ int main(int argc, char* argv[]) mms_lib_init(argv[0]); mms_lib_default_config(&config); - mms_log_default.name = test; + gutil_log_default.name = test; if (argc > 1 && !strcmp(argv[1], "-v")) { - mms_log_default.level = MMS_LOGLEVEL_VERBOSE; + gutil_log_default.level = GLOG_LEVEL_VERBOSE; argc--; } else { - mms_log_default.level = MMS_LOGLEVEL_INFO; + gutil_log_timestamp = FALSE; + gutil_log_default.level = GLOG_LEVEL_INFO; mms_task_decode_log.level = mms_task_retrieve_log.level = mms_task_http_log.level = - mms_task_notification_log.level = MMS_LOGLEVEL_NONE; - mms_log_stdout_timestamp = FALSE; + mms_task_notification_log.level = GLOG_LEVEL_NONE; } if (argc == 1) { diff --git a/mms-lib/test/test_retrieve_order/test_retrieve_order.c b/mms-lib/test/test_retrieve_order/test_retrieve_order.c index c5cfa01..4d16b79 100644 --- a/mms-lib/test/test_retrieve_order/test_retrieve_order.c +++ b/mms-lib/test/test_retrieve_order/test_retrieve_order.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "test_connman.h" @@ -25,6 +24,7 @@ #include "mms_settings.h" #include "mms_dispatcher.h" +#include #include #define RET_OK (0) @@ -122,7 +122,7 @@ test_finish( if (test->ret == RET_OK) { guint n = test->receive_states->len; if (n != desc->num_receive_states) { - MMS_ERR("Unexpected number of state changes %u", n); + GERR("Unexpected number of state changes %u", n); test->ret = RET_ERR; } else { guint i; @@ -130,17 +130,17 @@ test_finish( TestReceiveStateEvent* event = test->receive_states->pdata[i]; const TestReceiveState* expected = desc->receive_states + i; if (g_strcmp0(event->id, expected->id)) { - MMS_ERR("Unexpected task id %s at %u", event->id, i); + GERR("Unexpected task id %s at %u", event->id, i); test->ret = RET_ERR; } if (event->state != expected->state) { - MMS_ERR("Unexpected state %d at %u", event->state, i); + GERR("Unexpected state %d at %u", event->state, i); test->ret = RET_ERR; } } } } - MMS_INFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", name); + GINFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", name); mms_handler_test_reset(test->handler); g_signal_handler_disconnect(test->handler, test->receive_state_event_id); g_main_loop_quit(test->loop); @@ -166,7 +166,7 @@ test_timeout( Test* test = data; test->timeout_id = 0; test->ret = RET_TIMEOUT; - MMS_INFO("%s TIMEOUT", test->desc->name); + GINFO("%s TIMEOUT", test->desc->name); if (test->http) test_http_close(test->http); mms_connman_test_close_connection(test->cm); mms_dispatcher_cancel(test->disp, NULL); @@ -210,7 +210,7 @@ test_init( guint i; MMSSettings* settings = mms_settings_default_new(config); - MMS_DEBUG(">>>>>>>>>> %s <<<<<<<<<<", desc->name); + GDEBUG(">>>>>>>>>> %s <<<<<<<<<<", desc->name); memset(test, 0, sizeof(*test)); test->config = config; test->files = g_ptr_array_new_full(0, test_free_mapped_files); @@ -228,7 +228,7 @@ test_init( TestMappedFiles* files = g_new0(TestMappedFiles, 1); files->notification_ind = g_mapped_file_new(ni, FALSE, &err); if (err) { - MMS_ERR("%s", MMS_ERRMSG(err)); + GERR("%s", GERRMSG(err)); g_error_free(err); err = NULL; } @@ -238,7 +238,7 @@ test_init( /* Add empty responses for ack */ test_http_add_response(test->http, NULL, NULL, SOUP_STATUS_OK); if (err) { - MMS_ERR("%s", MMS_ERRMSG(err)); + GERR("%s", GERRMSG(err)); g_error_free(err); err = NULL; } @@ -321,7 +321,7 @@ test_order_once( } } if (test.ret != RET_OK) { - MMS_INFO("FAILED: %s", desc->name); + GINFO("FAILED: %s", desc->name); } test_finalize(&test); return test.ret; @@ -348,7 +348,7 @@ test_order( break; } } - if (!found) MMS_ERR("No such test: %s", name); + if (!found) GERR("No such test: %s", name); } else { for (i=0, ret = RET_OK; i #include #include @@ -287,25 +286,25 @@ test_finish( details = mms_handler_test_send_details(test->handler, test->id); if (state != desc->expected_state) { test->ret = RET_ERR; - MMS_ERR("%s state %d, expected %d", name, state, + GERR("%s state %d, expected %d", name, state, desc->expected_state); } else if (g_strcmp0(details, desc->details)) { test->ret = RET_ERR; - MMS_ERR("%s details '%s', expected '%s'", name, details, + GERR("%s details '%s', expected '%s'", name, details, desc->details); } else if (desc->msgid) { const char* msgid = mms_handler_test_send_msgid(test->handler, test->id); if (!msgid || strcmp(msgid, desc->msgid)) { test->ret = RET_ERR; - MMS_ERR("%s msgid %s, expected %s", name, msgid, desc->msgid); + GERR("%s msgid %s, expected %s", name, msgid, desc->msgid); } else if (msgid && !desc->msgid) { test->ret = RET_ERR; - MMS_ERR("%s msgid is not expected", name); + GERR("%s msgid is not expected", name); } } } - MMS_INFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", name); + GINFO("%s: %s", (test->ret == RET_OK) ? "OK" : "FAILED", name); mms_handler_test_reset(test->handler); g_main_loop_quit(test->loop); } @@ -330,7 +329,7 @@ test_timeout( Test* test = data; test->timeout_id = 0; test->ret = RET_TIMEOUT; - MMS_INFO("%s TIMEOUT", test->desc->name); + GINFO("%s TIMEOUT", test->desc->name); if (test->http) test_http_close(test->http); mms_connman_test_close_connection(test->cm); mms_dispatcher_cancel(test->disp, NULL); @@ -343,7 +342,7 @@ test_cancel( void* param) { Test* test = param; - MMS_DEBUG("Cancelling %s", test->id); + GDEBUG("Cancelling %s", test->id); mms_dispatcher_cancel(test->disp, test->id); } @@ -361,7 +360,7 @@ test_init( char* f = g_strconcat(DATA_DIR, desc->name, "/", desc->resp_file, NULL); test->resp_file = g_mapped_file_new(f, FALSE, &error); if (!test->resp_file) { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } g_free(f); @@ -464,10 +463,10 @@ test_run_once( test.ret = RET_OK; g_main_loop_run(test.loop); } else if (!imsi2 && (desc->flags & TEST_FLAG_NO_SIM)) { - MMS_INFO("OK: %s", desc->name); + GINFO("OK: %s", desc->name); test.ret = RET_OK; } else { - MMS_INFO("FAILED: %s", desc->name); + GINFO("FAILED: %s", desc->name); } if (error) g_error_free(error); g_free(imsi); @@ -497,7 +496,7 @@ test_run( break; } } - if (!found) MMS_ERR("No such test: %s", name); + if (!found) GERR("No such test: %s", name); } else { for (i=0, ret = RET_OK; i * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -9,16 +10,16 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_settings_dconf.h" #include /* Logging */ -#define MMS_LOG_MODULE_NAME mms_settings_log +#define GLOG_MODULE_NAME mms_settings_log #include "mms_lib_log.h" -MMS_LOG_MODULE_DEFINE("mms-settings-dconf"); +#include +GLOG_MODULE_DEFINE("mms-settings-dconf"); typedef MMSSettingsClass MMSSettingsDconfClass; typedef struct mms_settings_dconf { @@ -30,7 +31,7 @@ typedef struct mms_settings_dconf { gulong changed_signal_id; } MMSSettingsDconf; -G_DEFINE_TYPE(MMSSettingsDconf, mms_settings_dconf, MMS_TYPE_SETTINGS); +G_DEFINE_TYPE(MMSSettingsDconf, mms_settings_dconf, MMS_TYPE_SETTINGS) #define MMS_TYPE_SETTINGS_DCONF mms_settings_dconf_get_type() #define MMS_SETTINGS_DCONF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \ MMS_TYPE_SETTINGS_DCONF, MMSSettingsDconfClass)) @@ -75,7 +76,7 @@ mms_settings_dconf_get_uint32( } else if (klass == G_VARIANT_CLASS_INT32) { /* Typical result of updating dconf value from command line */ gint32 i32 = g_variant_get_int32(variant); - MMS_ASSERT(i32 >= 0); + GASSERT(i32 >= 0); if (i32 >= 0) { *value = i32; return TRUE; @@ -83,14 +84,14 @@ mms_settings_dconf_get_uint32( /* The rest is not so typical */ } else if (klass == G_VARIANT_CLASS_INT16) { gint16 i16 = g_variant_get_int16(variant); - MMS_ASSERT(i16 >= 0); + GASSERT(i16 >= 0); if (i16 >= 0) { *value = i16; return TRUE; } } else if (klass == G_VARIANT_CLASS_INT64) { gint64 i64 = g_variant_get_int64(variant); - MMS_ASSERT(i64 >= 0 && i64 <= (gint64)UINT_MAX); + GASSERT(i64 >= 0 && i64 <= (gint64)UINT_MAX); if (i64 >= 0 && i64 <= (gint64)UINT_MAX) { *value = (unsigned int)i64; return TRUE; @@ -114,10 +115,10 @@ mms_settings_dconf_get_uint32( return TRUE; } } else { - MMS_ERR("Unexpected variant type \'%c\'", (char)klass); + GERR("Unexpected variant type \'%c\'", (char)klass); return FALSE; } - MMS_ERR("Unable to convert variant type \'%c\'", (char)klass); + GERR("Unable to convert variant type \'%c\'", (char)klass); } return FALSE; } @@ -129,7 +130,7 @@ mms_settings_dconf_update_user_agent( GVariant* variant) { const char* value = g_variant_get_string(variant, NULL); - MMS_DEBUG(MMS_DCONF_KEY_USER_AGENT " = %s", value); + GDEBUG(MMS_DCONF_KEY_USER_AGENT " = %s", value); g_free(dest->user_agent); dest->data.user_agent = dest->user_agent = g_strdup(value); } @@ -141,7 +142,7 @@ mms_settings_dconf_update_uaprof( GVariant* variant) { const char* value = g_variant_get_string(variant, NULL); - MMS_DEBUG(MMS_DCONF_KEY_UAPROF " = %s", value); + GDEBUG(MMS_DCONF_KEY_UAPROF " = %s", value); g_free(dest->uaprof); dest->data.uaprof = dest->uaprof = g_strdup(value); } @@ -153,9 +154,9 @@ mms_settings_dconf_update_size_limit( GVariant* variant) { if (mms_settings_dconf_get_uint32(variant, &dest->data.size_limit)) { - MMS_DEBUG(MMS_DCONF_KEY_SIZE_LIMIT " = %u", dest->data.size_limit); + GDEBUG(MMS_DCONF_KEY_SIZE_LIMIT " = %u", dest->data.size_limit); } else { - MMS_WARN("Unable to decode " MMS_DCONF_KEY_SIZE_LIMIT " value"); + GWARN("Unable to decode " MMS_DCONF_KEY_SIZE_LIMIT " value"); } } @@ -166,9 +167,9 @@ mms_settings_dconf_update_max_pixels( GVariant* variant) { if (mms_settings_dconf_get_uint32(variant, &dest->data.max_pixels)) { - MMS_DEBUG(MMS_DCONF_KEY_MAX_PIXELS " = %u", dest->data.max_pixels); + GDEBUG(MMS_DCONF_KEY_MAX_PIXELS " = %u", dest->data.max_pixels); } else { - MMS_WARN("Unable to decode " MMS_DCONF_KEY_MAX_PIXELS " value"); + GWARN("Unable to decode " MMS_DCONF_KEY_MAX_PIXELS " value"); } } @@ -179,7 +180,7 @@ mms_settings_dconf_update_allow_dr( GVariant* variant) { const gboolean value = g_variant_get_boolean(variant); - MMS_DEBUG(MMS_DCONF_KEY_ALLOW_DR " = %s", value ? "true" : "false"); + GDEBUG(MMS_DCONF_KEY_ALLOW_DR " = %s", value ? "true" : "false"); dest->data.allow_dr = value; } @@ -232,12 +233,12 @@ mms_settings_dconf_key_changed( unsigned int override = key->override_flag; if (override && (dconf->settings.flags & override) == override) { /* Value is fixed from the command line */ - MMS_DEBUG("%s changed (ignored)", name); + GDEBUG("%s changed (ignored)", name); } else { /* Query and parse the value */ char* path = g_strconcat(dconf->dir, name, NULL); GVariant* value = dconf_client_read(dconf->client, path); - MMS_ASSERT(value); + GASSERT(value); if (value) { key->fn_update(&dconf->imsi_data, value); g_variant_unref(value); @@ -245,7 +246,7 @@ mms_settings_dconf_key_changed( g_free(path); } } else { - MMS_DEBUG("Key %s/%s changed - ignoring", dconf->dir, name); + GDEBUG("Key %s/%s changed - ignoring", dconf->dir, name); } } @@ -258,7 +259,7 @@ mms_settings_dconf_changed( const char* tag, MMSSettingsDconf* dconf) { - MMS_ASSERT(dconf->client == client); + GASSERT(dconf->client == client); if (dconf->dir) { if (*changes && **changes) { /* Multiple values have changed */ @@ -279,7 +280,7 @@ mms_settings_dconf_changed( } } } - MMS_DEBUG("Path %s has changed - ignoring", prefix); + GDEBUG("Path %s has changed - ignoring", prefix); } static @@ -289,7 +290,7 @@ mms_settings_dconf_unwatch( { if (dconf->dir) { unsigned int i; - MMS_DEBUG("Detaching from %s", dconf->dir); + GDEBUG("Detaching from %s", dconf->dir); for (i=0; idir, key->name, NULL); @@ -324,7 +325,7 @@ mms_settings_dconf_get_sim_data( mms_settings_sim_data_copy(&dconf->imsi_data, &settings->sim_defaults.data); - MMS_DEBUG("Attaching to %s", dir); + GDEBUG("Attaching to %s", dir); /* Migrate settings from old to the new location. */ names = dconf_client_list(dconf->client, dir_old, &n); @@ -336,15 +337,15 @@ mms_settings_dconf_get_sim_data( char* from = g_strconcat(dir_old, name, NULL); char* to = g_strconcat(dir, name, NULL); GVariant* value = dconf_client_read(dconf->client, from); - MMS_DEBUG("Migrating %s -> %s", from, to); - MMS_ASSERT(value); + GDEBUG("Migrating %s -> %s", from, to); + GASSERT(value); if (value) { GError* error = NULL; if (!dconf_client_write_sync(dconf->client, to, value, NULL, NULL, &error) || !dconf_client_write_sync(dconf->client, from, NULL, NULL, NULL, &error)) { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } g_variant_unref(value); diff --git a/mms-transfer-list-dbus/src/mms_transfer_dbus.c b/mms-transfer-list-dbus/src/mms_transfer_dbus.c index 717e73f..1045669 100644 --- a/mms-transfer-list-dbus/src/mms_transfer_dbus.c +++ b/mms-transfer-list-dbus/src/mms_transfer_dbus.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_transfer_dbus.h" @@ -18,6 +17,10 @@ #include +/* Logging */ +#define GLOG_MODULE_NAME mms_transfer_list_log +#include + /* Generated code */ #include "org.nemomobile.MmsEngine.TransferList.h" @@ -85,7 +88,7 @@ mms_transfer_dbus_new( if (!g_dbus_interface_skeleton_export( G_DBUS_INTERFACE_SKELETON(priv->proxy), priv->bus, priv->path, &error)) { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } return self; @@ -182,7 +185,7 @@ mms_transfer_dbus_update_flags( } if (priv->flags != flags) { priv->flags = flags; - MMS_DEBUG("Update flags => %u", priv->flags); + GDEBUG("Update flags => %u", priv->flags); } } @@ -234,7 +237,7 @@ mms_transfer_dbus_handle_enable_updates( MMSTransferDbusClient* client = NULL; const char* sender = g_dbus_method_invocation_get_sender(call); cookie = ++(priv->last_update_cookie); - MMS_VERBOSE_("%s %u -> %u", sender, cookie, flags); + GVERBOSE_("%s %u -> %u", sender, cookie, flags); /* Create client context if necessary */ if (priv->clients) { @@ -256,10 +259,10 @@ mms_transfer_dbus_handle_enable_updates( GINT_TO_POINTER(flags)); if ((priv->flags & flags) != flags) { priv->flags |= flags; - MMS_DEBUG("Update flags => %u", priv->flags); + GDEBUG("Update flags => %u", priv->flags); } } else { - MMS_WARN("Client provided no update flags!"); + GWARN("Client provided no update flags!"); } org_nemomobile_mms_engine_transfer_complete_enable_updates(proxy, @@ -280,7 +283,7 @@ mms_transfer_dbus_handle_disable_updates( MMSTransferDbusClient* client = NULL; const char* sender = g_dbus_method_invocation_get_sender(call); - MMS_VERBOSE_("%s %u", sender, cookie); + GVERBOSE_("%s %u", sender, cookie); org_nemomobile_mms_engine_transfer_complete_disable_updates(proxy, call); if (priv->clients) { diff --git a/mms-transfer-list-dbus/src/mms_transfer_list_dbus.c b/mms-transfer-list-dbus/src/mms_transfer_list_dbus.c index 2ddf7e4..9095289 100644 --- a/mms-transfer-list-dbus/src/mms_transfer_list_dbus.c +++ b/mms-transfer-list-dbus/src/mms_transfer_list_dbus.c @@ -10,7 +10,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * */ #include "mms_transfer_list_dbus.h" @@ -20,7 +19,10 @@ #include /* Log module */ -MMS_LOG_MODULE_DEFINE("mms-transfer-list-dbus"); +#define GLOG_MODULE_NAME mms_transfer_list_log +#include "mms_lib_log.h" +#include +GLOG_MODULE_DEFINE("mms-transfer-list"); /* Generated code */ #include "org.nemomobile.MmsEngine.TransferList.h" @@ -84,7 +86,7 @@ mms_transfer_destroy_cb( { MMSTransferDbus* transfer = MMS_TRANSFER_DBUS(data); MMSTransferListDbus* list = MMS_TRANSFER_LIST_DBUS(transfer->list); - MMS_DEBUG("Transfer %s finished", transfer->path); + GDEBUG("Transfer %s finished", transfer->path); mms_transfer_dbus_finished(transfer); org_nemomobile_mms_engine_transfer_list_emit_transfer_finished(list->proxy, transfer->path); @@ -106,7 +108,7 @@ mms_transfer_list_dbus_bus_cb( if (!g_dbus_interface_skeleton_export( G_DBUS_INTERFACE_SKELETON(self->proxy), self->bus, MMS_TRANSFER_LIST_DBUS_PATH, &error)) { - MMS_ERR("%s", MMS_ERRMSG(error)); + GERR("%s", GERRMSG(error)); g_error_free(error); } } @@ -131,7 +133,7 @@ mms_transfer_list_dbus_transfer_started( { MMSTransferListDbus* self = MMS_TRANSFER_LIST_DBUS(list); MMSTransferDbus* transfer = mms_transfer_dbus_new(self->bus, id, type); - MMS_DEBUG("Transfer %s started", transfer->path); + GDEBUG("Transfer %s started", transfer->path); transfer->list = self; g_hash_table_replace(self->transfers, &transfer->key, transfer); org_nemomobile_mms_engine_transfer_list_emit_transfer_started(self->proxy, @@ -150,7 +152,7 @@ mms_transfer_list_dbus_transfer_finished( key.id = id; key.type = type; if (!g_hash_table_remove(self->transfers, &key)) { - MMS_WARN("Transfer %s/%s not found", id, type); + GWARN("Transfer %s/%s not found", id, type); } } @@ -169,7 +171,7 @@ mms_transfer_list_dbus_find( if (transfer) { return transfer; } else { - MMS_WARN("Transfer %s/%s not found", id, type); + GWARN("Transfer %s/%s not found", id, type); return NULL; } } @@ -224,16 +226,16 @@ mms_transfer_list_dbus_handle_get( GHashTableIter it; g_hash_table_iter_init(&it, self->transfers); paths = g_new(const char*, n+1); - MMS_VERBOSE("%u transfer(s)", n); + GVERBOSE("%u transfer(s)", n); while (i < n && g_hash_table_iter_next(&it, NULL, &value)) { MMSTransferDbus* transfer = value; - MMS_VERBOSE(" %s", transfer->path); + GVERBOSE(" %s", transfer->path); paths[i++] = transfer->path; } paths[i++] = NULL; list = paths; } else { - MMS_VERBOSE("No transfers"); + GVERBOSE("No transfers"); list = &null; } org_nemomobile_mms_engine_transfer_list_complete_get(proxy, call, list); diff --git a/rpm/mms-engine.spec b/rpm/mms-engine.spec index 8ffadd6..78460d6 100644 --- a/rpm/mms-engine.spec +++ b/rpm/mms-engine.spec @@ -27,7 +27,7 @@ BuildRequires: pkgconfig(libsoup-2.4) >= 2.38 BuildRequires: pkgconfig(libwspcodec) >= 2.2 BuildRequires: pkgconfig(libgofono) >= 2.0.0 BuildRequires: pkgconfig(libgofonoext) >= 1.0.4 -BuildRequires: pkgconfig(libglibutil) >= 1.0.5 +BuildRequires: pkgconfig(libglibutil) >= 1.0.11 BuildRequires: pkgconfig(Qt5Gui) #BuildRequires: pkgconfig(ImageMagick)