Debian Codegraph @

pkcs11/gkm/gkm-test.c

raw
1 /*
2 * gnome-keyring
3 *
4 * Copyright (C) 2010 Stefan Walter
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
21 #include "config.h"
22
23 #include "gkm-attributes.h"
24 #include "gkm-log.h"
25 #include "gkm-test.h"
26 #include "gkm-util.h"
27
28 #include "pkcs11/pkcs11.h"
29 #include "pkcs11/pkcs11i.h"
30
31 #include <glib.h>
32
33 #include <string.h>
34
35 void
36 gkm_assertion_message_cmprv (const gchar *domain, const gchar *file, gint line,
37 const gchar *func, const gchar *expr,
38 CK_RV arg1, const gchar *cmp, CK_RV arg2)
39 {
40 gchar *s;
41 s = g_strdup_printf ("assertion failed (%s): (%s %s %s)", expr,
42 gkm_log_rv (arg1), cmp, gkm_log_rv (arg2));
43 g_assertion_message (domain, file, line, func, s);
44 g_free (s);
45 }
46
47 void
48 gkm_assertion_message_cmpulong (const gchar *domain, const gchar *file, gint line,
49 const gchar *func, const gchar *expr,
50 CK_ULONG arg1, const gchar *cmp, CK_ULONG arg2)
51 {
52 char *s = NULL;
53 s = g_strdup_printf ("assertion failed (%s): (0x%08llx %s 0x%08llx)", expr,
54 (long long unsigned)arg1, cmp, (long long unsigned)arg2);
55 g_assertion_message (domain, file, line, func, s);
56 g_free (s);
57 }