From: <svn...@op...> - 2009-07-13 12:01:16
|
Author: bellmich Date: Mon Jul 13 14:01:07 2009 New Revision: 1176 URL: http://libsyncml.opensync.org/changeset/1176 Log: migrated check_san from SmlError to GError Modified: trunk/tests/check_san.c Modified: trunk/tests/check_san.c ============================================================================== --- trunk/tests/check_san.c Mon Jul 13 14:00:10 2009 (r1175) +++ trunk/tests/check_san.c Mon Jul 13 14:01:07 2009 (r1176) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ */ #include "tests/support.h" +#include "libsyncml/sml_error_internals.h" /* If the notification is a normal SyncML message then a manager is * required. The easiest way are two function which create and destroy @@ -33,14 +34,14 @@ unsigned int defaultMaxMsgSize = 10240; unsigned int defaultMaxObjSize = 1024000; - SmlError *error = NULL; + GError *error = NULL; _tsp = smlTransportNew(SML_TRANSPORT_HTTP_SERVER, &error); - sml_fail_unless(_tsp != NULL, "%s", smlErrorPrint(&error)); - sml_fail_unless(error == NULL, "%s", smlErrorPrint(&error)); + sml_fail_unless(_tsp != NULL, "%s", error->message); + sml_fail_unless(error == NULL, "%s", error->message); SmlManager *manager = smlManagerNew(_tsp, &error); - sml_fail_unless(manager != NULL, "%s", smlErrorPrint(&error)); - sml_fail_unless(error == NULL, "%s", smlErrorPrint(&error)); + sml_fail_unless(manager != NULL, "%s", error->message); + sml_fail_unless(error == NULL, "%s", error->message); smlManagerSetLocalMaxMsgSize(manager, defaultMaxMsgSize); smlManagerSetLocalMaxObjSize(manager, defaultMaxObjSize); @@ -58,7 +59,7 @@ { setup_testbed(NULL); - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationNew(SML_SAN_VERSION_12, SML_SAN_UIMODE_USER, SML_SAN_INITIATOR_USER, 0, "test", "/", SML_MIMETYPE_UNKNOWN, &error); sml_fail_unless(san != NULL, NULL); sml_fail_unless(error == NULL, NULL); @@ -71,7 +72,7 @@ { setup_testbed(NULL); - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationNew(SML_SAN_VERSION_12, SML_SAN_UIMODE_UNSPECIFIED, SML_SAN_INITIATOR_USER, 0, "tttt", "/", SML_MIMETYPE_UNKNOWN, &error); sml_fail_unless(san != NULL, NULL); sml_fail_unless(error == NULL, NULL); @@ -104,7 +105,7 @@ { setup_testbed(NULL); - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationNew(SML_SAN_VERSION_12, SML_SAN_UIMODE_USER, SML_SAN_INITIATOR_SERVER, 65535, "ttttt", "/", SML_MIMETYPE_UNKNOWN, &error); sml_fail_unless(san != NULL, NULL); sml_fail_unless(error == NULL, NULL); @@ -137,7 +138,7 @@ { setup_testbed(NULL); - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationNew(SML_SAN_VERSION_12, SML_SAN_UIMODE_USER, SML_SAN_INITIATOR_SERVER, 65535, "ttttt", "/", SML_MIMETYPE_UNKNOWN, &error); sml_fail_unless(san != NULL, NULL); sml_fail_unless(error == NULL, NULL); @@ -176,7 +177,7 @@ { setup_testbed(NULL); - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationNew(SML_SAN_VERSION_12, SML_SAN_UIMODE_USER, SML_SAN_INITIATOR_SERVER, 65535, "ttttt", "/", SML_MIMETYPE_UNKNOWN, &error); sml_fail_unless(san != NULL, NULL); sml_fail_unless(error == NULL, NULL); @@ -221,7 +222,7 @@ { setup_testbed(NULL); - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationNew(SML_SAN_VERSION_12, SML_SAN_UIMODE_USER, SML_SAN_INITIATOR_SERVER, 65535, "OpenSync", "/", SML_MIMETYPE_UNKNOWN, &error); sml_fail_unless(san != NULL, NULL); sml_fail_unless(error == NULL, NULL); @@ -265,7 +266,7 @@ { setup_testbed(NULL); - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationNew(SML_SAN_VERSION_11, SML_SAN_UIMODE_USER, SML_SAN_INITIATOR_SERVER, 65535, "ttttt", "/", SML_MIMETYPE_XML, &error); sml_fail_unless(san != NULL, NULL); sml_fail_unless(error == NULL, NULL); @@ -330,7 +331,7 @@ 0x00, 0x00, 0x07, //Content type 0x05, 0x74, 0x74, 0x74, 0x74, 0x00 }; //Server URI; - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationParse((char *) target, sizeof(target), &error); sml_fail_unless(san != NULL, NULL); sml_fail_unless(error == NULL, NULL); @@ -369,7 +370,7 @@ 0x00, //server identifier 0x00}; //num syncs - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationParse((char *) target, sizeof(target), &error); sml_fail_unless(san != NULL, NULL); sml_fail_unless(error == NULL, NULL); @@ -396,11 +397,11 @@ 0x00, 0x00, //Session id 0x00}; //num syncs - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationParse((char *) target, sizeof(target), &error); sml_fail_unless(san == NULL, NULL); sml_fail_unless(error != NULL, NULL); - smlErrorDeref(&error); + SML_ERROR_FREE(error); } END_TEST @@ -415,11 +416,11 @@ 0x01, //server identifier 0x00}; //num syncs - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationParse((char *) target, sizeof(target), &error); sml_fail_unless(san == NULL, NULL); sml_fail_unless(error != NULL, NULL); - smlErrorDeref(&error); + SML_ERROR_FREE(error); } END_TEST @@ -434,11 +435,11 @@ 0x01, 0x00,//server identifier 0x10}; //num syncs - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationParse((char *) target, sizeof(target), &error); sml_fail_unless(san == NULL, NULL); sml_fail_unless(error != NULL, NULL); - smlErrorDeref(&error); + SML_ERROR_FREE(error); } END_TEST @@ -453,11 +454,11 @@ 0x01, 0x00,//server identifier 0x00}; //num syncs - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationParse(target, sizeof(target), &error); sml_fail_unless(san == NULL, NULL); sml_fail_unless(error != NULL, NULL); - smlErrorDeref(&error); + SML_ERROR_FREE(error); } END_TEST @@ -475,11 +476,11 @@ 0x00, 0x00, 0x07, //Content type 0x05, 0x74, 0x74, 0x74, 0x74, 0x00}; //Server URI; - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationParse((char *) target, sizeof(target), &error); sml_fail_unless(san == NULL, NULL); sml_fail_unless(error != NULL, NULL); - smlErrorDeref(&error); + SML_ERROR_FREE(error); } END_TEST @@ -497,11 +498,11 @@ 0x00, 0x00, 0x07, //Content type 0x01}; //Server URI; - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationParse((char *) target, sizeof(target), &error); sml_fail_unless(san == NULL, NULL); sml_fail_unless(error != NULL, NULL); - smlErrorDeref(&error); + SML_ERROR_FREE(error); } END_TEST @@ -519,11 +520,11 @@ 0x00, 0x00, 0x07, //Content type 0x01, 0x00, 0x00}; //Server URI; - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationParse((char *) target, sizeof(target), &error); sml_fail_unless(san == NULL, NULL); sml_fail_unless(error != NULL, NULL); - smlErrorDeref(&error); + SML_ERROR_FREE(error); } END_TEST @@ -531,7 +532,7 @@ { setup_testbed(NULL); - SmlError *error = NULL; + GError *error = NULL; SmlNotification *san = smlNotificationNew(SML_SAN_VERSION_12, SML_SAN_UIMODE_USER, SML_SAN_INITIATOR_SERVER, 65535, "ttttt", "/", &error); sml_fail_unless(san != NULL, NULL); sml_fail_unless(error == NULL, NULL); @@ -547,7 +548,7 @@ sml_fail_unless(smlNotificationAssemble(san, &buffer, &size, &error), NULL); sml_fail_unless(error == NULL, NULL); - SmlBool smlNotificationSend(SmlNotification *san, SmlTransport *tsp, SmlTransportSendCb callback, void *userdata, SmlError **error) + gboolean smlNotificationSend(SmlNotification *san, SmlTransport *tsp, SmlTransportSendCb callback, void *userdata, GError **error) sml_fail_unless(size == sizeof(target), NULL); |