[Spice-devel] [spice-gtk v3 13/19] log: use spice_critical instead of g_critical
Victor Toso
victortoso at redhat.com
Sat Mar 12 14:32:14 UTC 2016
---
src/channel-base.c | 6 ++---
src/channel-display-mjpeg.c | 2 +-
src/channel-display.c | 2 +-
src/channel-main.c | 4 +--
src/channel-usbredir.c | 2 +-
src/spice-channel.c | 63 +++++++++++++++++++++++----------------------
src/spice-grabsequence.c | 3 ++-
src/spice-widget.c | 8 +++---
8 files changed, 46 insertions(+), 44 deletions(-)
diff --git a/src/channel-base.c b/src/channel-base.c
index 13e4ced..93609d4 100644
--- a/src/channel-base.c
+++ b/src/channel-base.c
@@ -170,12 +170,12 @@ void spice_channel_handle_migrate(SpiceChannel *channel, SpiceMsgIn *in)
if (mig->flags & SPICE_MIGRATE_NEED_DATA_TRANSFER) {
spice_channel_recv_msg(channel, get_msg_handler, &data);
if (!data) {
- g_critical("expected SPICE_MSG_MIGRATE_DATA, got empty message");
+ spice_critical("expected SPICE_MSG_MIGRATE_DATA, got empty message");
goto end;
} else if (spice_header_get_msg_type(data->header, c->use_mini_header) !=
SPICE_MSG_MIGRATE_DATA) {
- g_critical("expected SPICE_MSG_MIGRATE_DATA, got %d",
- spice_header_get_msg_type(data->header, c->use_mini_header));
+ spice_critical("expected SPICE_MSG_MIGRATE_DATA, got %d",
+ spice_header_get_msg_type(data->header, c->use_mini_header));
goto end;
}
}
diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c
index 95d5b33..0c1f2f1 100644
--- a/src/channel-display-mjpeg.c
+++ b/src/channel-display-mjpeg.c
@@ -34,7 +34,7 @@ static void mjpeg_src_init(struct jpeg_decompress_struct *cinfo)
static boolean mjpeg_src_fill(struct jpeg_decompress_struct *cinfo)
{
- g_critical("need more input data");
+ spice_critical("need more input data");
return 0;
}
diff --git a/src/channel-display.c b/src/channel-display.c
index 8e4d3ea..8bd5e06 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -1482,7 +1482,7 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in)
}
if (op->multi_media_time == 0) {
- g_critical("Received frame with invalid 0 timestamp! perhaps wrong graphic driver?");
+ spice_critical("Received frame with invalid 0 timestamp! perhaps wrong graphic driver?");
op->multi_media_time = mmtime + 100; /* workaround... */
}
diff --git a/src/channel-main.c b/src/channel-main.c
index f3913e6..f7bdf3e 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2638,8 +2638,8 @@ static void spice_main_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg)
if (c->state == SPICE_CHANNEL_STATE_MIGRATION_HANDSHAKE) {
if (type != SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK &&
type != SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_NACK) {
- g_critical("unexpected msg (%d)."
- "Only MIGRATE_DST_SEAMLESS_ACK/NACK are allowed", type);
+ spice_critical("unexpected msg (%d)."
+ "Only MIGRATE_DST_SEAMLESS_ACK/NACK are allowed", type);
return;
}
}
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index 844bb27..efdc447 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -512,7 +512,7 @@ static void usbredir_log(void *user_data, int level, const char *msg)
switch (level) {
case usbredirparser_error:
- g_critical("%s", msg); break;
+ spice_critical("%s", msg); break;
case usbredirparser_warning:
spice_warning("%s", msg); break;
default:
diff --git a/src/spice-channel.c b/src/spice-channel.c
index 4dbc1b8..6225831 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -1242,7 +1242,7 @@ static void spice_channel_send_link(SpiceChannel *channel)
c->marshallers = spice_message_marshallers_get();
break;
default:
- g_critical("unknown major %d", protocol);
+ spice_critical("unknown major %d", protocol);
return;
}
@@ -1489,15 +1489,15 @@ static gboolean spice_channel_perform_auth_sasl(SpiceChannel *channel)
err = sasl_client_init(NULL);
CHANNEL_DEBUG(channel, "Client initialize SASL authentication %d", err);
if (err != SASL_OK) {
- g_critical("failed to initialize SASL library: %d (%s)",
- err, sasl_errstring(err, NULL, NULL));
+ spice_critical("failed to initialize SASL library: %d (%s)",
+ err, sasl_errstring(err, NULL, NULL));
goto error;
}
/* Get local address in form IPADDR:PORT */
addr = g_socket_get_local_address(c->sock, NULL);
if (!addr) {
- g_critical("failed to get local address");
+ spice_critical("failed to get local address");
goto error;
}
if ((g_socket_address_get_family(addr) == G_SOCKET_FAMILY_IPV4 ||
@@ -1509,7 +1509,7 @@ static gboolean spice_channel_perform_auth_sasl(SpiceChannel *channel)
/* Get remote address in form IPADDR:PORT */
addr = g_socket_get_remote_address(c->sock, NULL);
if (!addr) {
- g_critical("failed to get peer address");
+ spice_critical("failed to get peer address");
goto error;
}
if ((g_socket_address_get_family(addr) == G_SOCKET_FAMILY_IPV4 ||
@@ -1531,8 +1531,8 @@ static gboolean spice_channel_perform_auth_sasl(SpiceChannel *channel)
&saslconn);
if (err != SASL_OK) {
- g_critical("Failed to create SASL client context: %d (%s)",
- err, sasl_errstring(err, NULL, NULL));
+ spice_critical("Failed to create SASL client context: %d (%s)",
+ err, sasl_errstring(err, NULL, NULL));
goto error;
}
@@ -1542,7 +1542,7 @@ static gboolean spice_channel_perform_auth_sasl(SpiceChannel *channel)
ssf = SSL_get_cipher_bits(c->ssl, NULL);
err = sasl_setprop(saslconn, SASL_SSF_EXTERNAL, &ssf);
if (err != SASL_OK) {
- g_critical("cannot set SASL external SSF %d (%s)",
+ spice_critical("cannot set SASL external SSF %d (%s)",
err, sasl_errstring(err, NULL, NULL));
goto error;
}
@@ -1559,7 +1559,7 @@ static gboolean spice_channel_perform_auth_sasl(SpiceChannel *channel)
err = sasl_setprop(saslconn, SASL_SEC_PROPS, &secprops);
if (err != SASL_OK) {
- g_critical("cannot set security props %d (%s)",
+ spice_critical("cannot set security props %d (%s)",
err, sasl_errstring(err, NULL, NULL));
goto error;
}
@@ -1569,7 +1569,7 @@ static gboolean spice_channel_perform_auth_sasl(SpiceChannel *channel)
if (c->has_error)
goto error;
if (len > SASL_MAX_MECHLIST_LEN) {
- g_critical("mechlistlen %d too long", len);
+ spice_critical("mechlistlen %d too long", len);
goto error;
}
@@ -1590,8 +1590,8 @@ restart:
&clientoutlen,
&mechname);
if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
- g_critical("Failed to start SASL negotiation: %d (%s)",
- err, sasl_errdetail(saslconn));
+ spice_critical("Failed to start SASL negotiation: %d (%s)",
+ err, sasl_errdetail(saslconn));
goto error;
}
@@ -1608,8 +1608,8 @@ restart:
mechname, clientoutlen, clientout, clientout);
if (clientoutlen > SASL_MAX_DATA_LEN) {
- g_critical("SASL negotiation data too long: %d bytes",
- clientoutlen);
+ spice_critical("SASL negotiation data too long: %d bytes",
+ clientoutlen);
goto error;
}
@@ -1637,8 +1637,8 @@ restart:
if (c->has_error)
goto error;
if (len > SASL_MAX_DATA_LEN) {
- g_critical("SASL negotiation data too long: %d bytes",
- len);
+ spice_critical("SASL negotiation data too long: %d bytes",
+ len);
goto error;
}
@@ -1673,8 +1673,8 @@ restart:
&clientout,
&clientoutlen);
if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
- g_critical("Failed SASL step: %d (%s)",
- err, sasl_errdetail(saslconn));
+ spice_critical("Failed SASL step: %d (%s)",
+ err, sasl_errdetail(saslconn));
goto error;
}
@@ -1720,7 +1720,7 @@ restart:
if (c->has_error)
goto error;
if (len > SASL_MAX_DATA_LEN) {
- g_critical("SASL negotiation data too long: %d bytes", len);
+ spice_critical("SASL negotiation data too long: %d bytes", len);
goto error;
}
@@ -1755,14 +1755,14 @@ restart:
if (!c->ssl) {
err = sasl_getprop(saslconn, SASL_SSF, &val);
if (err != SASL_OK) {
- g_critical("cannot query SASL ssf on connection %d (%s)",
- err, sasl_errstring(err, NULL, NULL));
+ spice_critical("cannot query SASL ssf on connection %d (%s)",
+ err, sasl_errstring(err, NULL, NULL));
goto error;
}
ssf = *(const int *)val;
CHANNEL_DEBUG(channel, "SASL SSF value %d", ssf);
if (ssf < 56) { /* 56 == DES level, good for Kerberos */
- g_critical("negotiation SSF %d was not strong enough", ssf);
+ spice_critical("negotiation SSF %d was not strong enough", ssf);
goto error;
}
}
@@ -1813,8 +1813,8 @@ static gboolean spice_channel_recv_link_msg(SpiceChannel *channel)
c->peer_hdr.size - c->peer_pos);
c->peer_pos += rc;
if (c->peer_pos != c->peer_hdr.size) {
- g_critical("%s: %s: incomplete link reply (%d/%d)",
- c->name, __FUNCTION__, rc, c->peer_hdr.size);
+ spice_critical("%s: %s: incomplete link reply (%d/%d)",
+ c->name, __FUNCTION__, rc, c->peer_hdr.size);
goto error;
}
switch (c->peer_msg->error) {
@@ -1959,8 +1959,9 @@ void spice_channel_recv_msg(SpiceChannel *channel,
c->peer_hdr.minor_version,
&sub_in->psize, &sub_in->pfree);
if (sub_in->parsed == NULL) {
- g_critical("failed to parse sub-message: %s type %d",
- c->name, spice_header_get_msg_type(sub_in->header, c->use_mini_header));
+ spice_critical("failed to parse sub-message: %s type %d",
+ c->name,
+ spice_header_get_msg_type(sub_in->header, c->use_mini_header));
goto end;
}
msg_handler(channel, sub_in, data);
@@ -1986,8 +1987,8 @@ void spice_channel_recv_msg(SpiceChannel *channel,
in->parsed = c->parser(in->data, in->data + msg_size, msg_type,
c->peer_hdr.minor_version, &in->psize, &in->pfree);
if (in->parsed == NULL) {
- g_critical("failed to parse message: %s type %d",
- c->name, msg_type);
+ spice_critical("failed to parse message: %s type %d",
+ c->name, msg_type);
goto end;
}
@@ -2427,7 +2428,7 @@ static void *spice_channel_coroutine(void *data)
if (spice_session_get_client_provided_socket(c->session)) {
if (c->fd < 0) {
- g_critical("fd not provided!");
+ spice_critical("fd not provided!");
c->event = SPICE_CHANNEL_ERROR_CONNECT;
goto cleanup;
}
@@ -2463,7 +2464,7 @@ reconnect:
if (c->tls) {
c->ctx = SSL_CTX_new(SSLv23_method());
if (c->ctx == NULL) {
- g_critical("SSL_CTX_new failed");
+ spice_critical("SSL_CTX_new failed");
c->event = SPICE_CHANNEL_ERROR_TLS;
goto cleanup;
}
@@ -2497,7 +2498,7 @@ reconnect:
c->ssl = SSL_new(c->ctx);
if (c->ssl == NULL) {
- g_critical("SSL_new failed");
+ spice_critical("SSL_new failed");
c->event = SPICE_CHANNEL_ERROR_TLS;
goto cleanup;
}
diff --git a/src/spice-grabsequence.c b/src/spice-grabsequence.c
index a51d9e6..6fbc85b 100644
--- a/src/spice-grabsequence.c
+++ b/src/spice-grabsequence.c
@@ -19,6 +19,7 @@
*/
#include "config.h"
+#include "common/log.h"
#include <string.h>
#include <gdk/gdk.h>
@@ -92,7 +93,7 @@ SpiceGrabSequence *spice_grab_sequence_new_from_string(const gchar *str)
sequence->keysyms[i] =
(guint)gdk_keyval_from_name(keysymstr[i]);
if (sequence->keysyms[i] == 0) {
- g_critical("Invalid key: %s", keysymstr[i]);
+ spice_critical("Invalid key: %s", keysymstr[i]);
}
}
g_strfreev(keysymstr);
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 7a2844b..52f87ff 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -587,7 +587,7 @@ static void spice_display_init(SpiceDisplay *display)
#ifdef USE_EPOXY
if (!spice_egl_init(display, &err)) {
- g_critical("egl init failed: %s", err->message);
+ spice_critical("egl init failed: %s", err->message);
g_clear_error(&err);
}
#endif
@@ -869,7 +869,7 @@ static gboolean win32_clip_cursor(void)
workarea = mi.rcWork;
if (!IntersectRect(&rect, &window, &workarea)) {
- g_critical("error clipping cursor");
+ spice_critical("error clipping cursor");
return false;
}
@@ -1829,7 +1829,7 @@ static void realize(GtkWidget *widget)
#ifdef USE_EPOXY
if (!spice_egl_realize_display(display, gtk_widget_get_window(GTK_WIDGET(display)), &err)) {
- g_critical("egl realize failed: %s", err->message);
+ spice_critical("egl realize failed: %s", err->message);
g_clear_error(&err);
}
#endif
@@ -2479,7 +2479,7 @@ static void gl_scanout(SpiceDisplay *display)
set_egl_enabled(display, true);
if (!spice_egl_update_scanout(display, scanout, &err)) {
- g_critical("update scanout failed: %s", err->message);
+ spice_critical("update scanout failed: %s", err->message);
g_clear_error(&err);
}
}
--
2.5.0
More information about the Spice-devel
mailing list