From f0598095d13acbd64358bdf6f7f517ff762846c2 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 12 Jul 2011 01:51:37 +0300 Subject: [PATCH] gobex: Premit raw OBEX error codes within G_OBEX_ERROR GError domain --- gobex/gobex-defs.h | 5 ++++- gobex/gobex-transfer.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gobex/gobex-defs.h b/gobex/gobex-defs.h index 776615ff2..9c2ab53ee 100644 --- a/gobex/gobex-defs.h +++ b/gobex/gobex-defs.h @@ -30,8 +30,11 @@ typedef enum { G_OBEX_DATA_REF, } GObexDataPolicy; +#define G_OBEX_ERROR_FIRST (0xff + 1) +#define G_OBEX_PROTO_ERROR(code) ((code) < G_OBEX_ERROR_FIRST) + typedef enum { - G_OBEX_ERROR_PARSE_ERROR, + G_OBEX_ERROR_PARSE_ERROR = G_OBEX_ERROR_FIRST, G_OBEX_ERROR_INVALID_ARGS, G_OBEX_ERROR_DISCONNECTED, G_OBEX_ERROR_TIMEOUT, diff --git a/gobex/gobex-transfer.c b/gobex/gobex-transfer.c index 8434366da..a23442e68 100644 --- a/gobex/gobex-transfer.c +++ b/gobex/gobex-transfer.c @@ -150,7 +150,7 @@ static void transfer_response(GObex *obex, GError *err, GObexPacket *rsp, rspcode = g_obex_packet_get_operation(rsp, &final); if (rspcode != G_OBEX_RSP_SUCCESS && rspcode != G_OBEX_RSP_CONTINUE) { - err = g_error_new(G_OBEX_ERROR, G_OBEX_ERROR_FAILED, + err = g_error_new(G_OBEX_ERROR, rspcode, "Transfer failed (0x%02x)", rspcode); goto failed; } -- 2.47.3