[Spice-devel] [spice-gtk PATCH v2 11/17] log: use spice_critical instead of g_critical
Victor Toso
victortoso at redhat.com
Fri Jan 8 00:51:41 PST 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 | 2 +-
8 files changed, 43 insertions(+), 41 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 a99228d..9dfa0a7 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -1386,7 +1386,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 30f0db8..d1e9673 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 7d940fd..6560e3b 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -1174,7 +1174,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;
}
@@ -1421,15 +1421,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 ||
@@ -1441,7 +1441,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 ||
@@ -1463,8 +1463,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;
}
@@ -1474,7 +1474,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;
}
@@ -1491,7 +1491,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;
}
@@ -1501,7 +1501,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;
}
@@ -1522,8 +1522,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;
}
@@ -1540,8 +1540,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;
}
@@ -1569,8 +1569,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;
}
@@ -1605,8 +1605,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;
}
@@ -1652,7 +1652,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;
}
@@ -1687,14 +1687,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;
}
}
@@ -1745,8 +1745,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) {
@@ -1891,8 +1891,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);
@@ -1918,8 +1919,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;
}
@@ -2359,7 +2360,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;
}
@@ -2395,7 +2396,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;
}
@@ -2429,7 +2430,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 26bf96f..0b2ad03 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 32307fb..7bfbf0b 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -861,7 +861,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;
}
--
2.5.0
More information about the Spice-devel
mailing list