No issues found
Tool | Failure ID | Location | Function | Message | Data |
---|---|---|---|---|---|
clang-analyzer | no-output-found | thumbnailer-mock.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None |
1 /*
2 * Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
18 */
19
20 #include <glib-object.h>
21 #include <gobject/gvaluecollector.h>
22
23 #include "empty-gobject.h"
24 #include "thumbnailer-mock.h"
25
26 static GList *calls = NULL;
27
28 void
29 dbus_mock_call_log_reset ()
30 {
31 if (calls) {
32 g_list_foreach (calls, (GFunc)g_free, NULL);
33 g_list_free (calls);
34 calls = NULL;
35 }
36 }
37
38 GList *
39 dbus_mock_call_log_get ()
40 {
41 return calls;
42 }
43
44 #if 0
45
46 static void
47 dbus_mock_call_log_append (const gchar *function_name)
48 {
49 calls = g_list_append (calls, g_strdup (function_name));
50 }
51
52
53 /* Port to gdbus */
54 /*
55 * DBus overrides
56 */
57
58 DBusGConnection *
59 dbus_g_bus_get (DBusBusType type, GError **error)
60 {
61 return (DBusGConnection *) empty_object_new ();
62 }
63
64 DBusGProxy *
65 dbus_g_proxy_new_for_name (DBusGConnection *connection,
66 const gchar *service,
67 const gchar *path,
68 const gchar *interface )
69 {
70 return (DBusGProxy *) empty_object_new ();
71 }
72
73 gboolean
74 dbus_g_proxy_call (DBusGProxy *proxy,
75 const gchar *function_name,
76 GError **error,
77 GType first_arg_type, ...)
78 {
79 va_list args;
80 GType arg_type;
81 const gchar *supported_mimes[] = { "mock/one", "mock/two", NULL};
82 int counter;
83
84 g_assert (g_strcmp0 (function_name, "GetSupported") == 0);
85
86 /*
87 G_TYPE_INVALID,
88 G_TYPE_STRV, &uri_schemes,
89 G_TYPE_STRV, &mime_types,
90 G_TYPE_INVALID);
91
92 Set the mock values in the second parameter :)
93 */
94
95 va_start (args, first_arg_type);
96 arg_type = va_arg (args, GType);
97
98 counter = 1;
99 while (arg_type != G_TYPE_INVALID) {
100
101 if (arg_type == G_TYPE_STRV && counter == 2) {
102 gchar *local_error = NULL;
103 GValue value = { 0, };
104 g_value_init (&value, arg_type);
105 g_value_set_boxed (&value, supported_mimes);
106 G_VALUE_LCOPY (&value,
107 args, 0,
108 &local_error);
109 g_free (local_error);
110 g_value_unset (&value);
111 } else {
112 gpointer *out_param;
113 out_param = va_arg (args, gpointer *);
114 }
115 arg_type = va_arg (args, GType);
116 counter += 1;
117 }
118
119 va_end (args);
120 return TRUE;
121 }
122
123
124 void
125 dbus_g_proxy_call_no_reply (DBusGProxy *proxy,
126 const char *method,
127 GType first_arg_type,
128 ...)
129 {
130 dbus_mock_call_log_append (method);
131 }
132 #endif