Bug Summary

File:test-server.c
Warning:line 106, column 3
This statement is never executed

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test-server.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/lib/llvm-16/lib/clang/16 -D HAVE_CONFIG_H -I . -I .. -I .. -I .. -D GRAPA_RESOURCE_UI_PATH="/org/cafe/Grapa/ui" -D FR_PREFIX="/usr" -D FR_SYSCONFDIR="/usr/etc" -D FR_DATADIR="/usr/share" -D PRIVDATADIR="/usr/share/grapa/" -D FR_LIBDIR="/usr/lib" -D PKG_DATA_DIR="/usr/share/grapa" -D PIXMAPSDIR="/usr/share/pixmaps" -D GLADEDIR="" -D LOCALEDIR="/usr/share/locale" -D SHDIR="/usr/libexec/grapa/" -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/gio-unix-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/json-glib-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -internal-isystem /usr/lib/llvm-16/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-03-29-001607-51145-1 -x c test-server.c
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3/*
4 * Grapa
5 *
6 * Copyright (C) 2010 The Free Software Foundation, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include <config.h>
23#include <gio/gio.h>
24
25
26GMainLoop *loop;
27
28
29static void
30grapa_getsupportedtypes_ready_cb (GObject *source_object,
31 GAsyncResult *res,
32 gpointer user_data)
33{
34 GDBusProxy *proxy;
35 GVariant *values;
36 GError *error = NULL((void*)0);
37
38 proxy = G_DBUS_PROXY (source_object)((((GDBusProxy*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((source_object)), ((g_dbus_proxy_get_type ()))))))
;
39 values = g_dbus_proxy_call_finish (proxy, res, &error);
40 if (values == NULL((void*)0)) {
41 g_error ("%s\n", error->message);
42 g_clear_error (&error);
43 }
44 else {
45 GVariantIter argument_iter;
46 GVariant *array_of_types;
47 GVariantIter type_iter;
48 GVariant *supported_type;
49 int n = 0;
50
51 g_variant_iter_init (&argument_iter, values);
52 array_of_types = g_variant_iter_next_value (&argument_iter);
53
54 g_variant_iter_init (&type_iter, array_of_types);
55 while ((supported_type = g_variant_iter_next_value (&type_iter))) {
56 char *mime_type = NULL((void*)0);
57 char *default_ext = NULL((void*)0);
58 char *description = NULL((void*)0);
59 char *key;
60 char *value;
61 GVariantIter value_iter;
62
63 g_variant_iter_init (&value_iter, supported_type);
64 while (g_variant_iter_next (&value_iter, "{ss}", &key, &value)) {
65 if (g_strcmp0 (key, "mime-type") == 0)
66 mime_type = g_strdup (value)g_strdup_inline (value);
67 else if (g_strcmp0 (key, "default-extension") == 0)
68 default_ext = g_strdup (value)g_strdup_inline (value);
69 else if (g_strcmp0 (key, "description") == 0)
70 description = g_strdup (value)g_strdup_inline (value);
71
72 g_free (key);
73 g_free (value);
74 }
75
76 n++;
77 g_print ("%d)\tmime-type: %s\n\tdefault-extension: %s\n\tdescription: %s\n", n, mime_type, default_ext, description);
78
79 g_free (description);
80 g_free (default_ext);
81 g_free (mime_type);
82 g_variant_unref (supported_type);
83 }
84
85 g_variant_unref (array_of_types);
86 }
87
88 g_object_unref (proxy);
89 g_main_loop_quit (loop);
90}
91
92
93static void
94grapa_addtoarchive_ready_cb (GObject *source_object,
95 GAsyncResult *res,
96 gpointer user_data)
97{
98 GDBusProxy *proxy;
99 GVariant *values;
100 GError *error = NULL((void*)0);
101
102 proxy = G_DBUS_PROXY (source_object)((((GDBusProxy*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((source_object)), ((g_dbus_proxy_get_type ()))))))
;
103 values = g_dbus_proxy_call_finish (proxy, res, &error);
104 if (values == NULL((void*)0)) {
105 g_error ("%s\n", error->message);
106 g_clear_error (&error);
This statement is never executed
107 }
108
109 if (values != NULL((void*)0))
110 g_variant_unref (values);
111 g_object_unref (proxy);
112
113 g_main_loop_quit (loop);
114}
115
116
117static void
118on_signal (GDBusProxy *proxy,
119 char *sender_name,
120 char *signal_name,
121 GVariant *parameters,
122 gpointer user_data)
123{
124 if (g_strcmp0 (signal_name, "Progress") == 0) {
125 double fraction;
126 char *details;
127
128 g_variant_get (parameters, "(ds)", &fraction, &details);
129 g_print ("Progress: %f (%s)\n", fraction, details);
130
131 g_free (details);
132 }
133}
134
135
136int
137main (int argc, char *argv[])
138{
139 GDBusConnection *connection;
140 GError *error = NULL((void*)0);
141
142 connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL((void*)0), &error);
143 if (connection != NULL((void*)0)) {
144 GDBusProxy *proxy;
145
146 proxy = g_dbus_proxy_new_sync (connection,
147 G_DBUS_PROXY_FLAGS_NONE,
148 NULL((void*)0),
149 "org.cafe.Grapa",
150 "/org/cafe/Grapa",
151 "org.cafe.ArchiveManager",
152 NULL((void*)0),
153 &error);
154
155 if (proxy != NULL((void*)0)) {
156
157 g_signal_connect (proxy,g_signal_connect_data ((proxy), ("g-signal"), (((GCallback) (
on_signal))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
158 "g-signal",g_signal_connect_data ((proxy), ("g-signal"), (((GCallback) (
on_signal))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
159 G_CALLBACK (on_signal),g_signal_connect_data ((proxy), ("g-signal"), (((GCallback) (
on_signal))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
160 NULL)g_signal_connect_data ((proxy), ("g-signal"), (((GCallback) (
on_signal))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
161
162 /* -- GetSupportedTypes -- */
163
164 g_dbus_proxy_call (proxy,
165 "GetSupportedTypes",
166 g_variant_new ("(s)", "create"),
167 G_DBUS_CALL_FLAGS_NONE,
168 G_MAXINT2147483647,
169 NULL((void*)0),
170 grapa_getsupportedtypes_ready_cb,
171 NULL((void*)0));
172
173 /* -- AddToArchive -- */
174
175 char *archive;
176 char **files;
177
178 archive = g_strdup ("file:///home/paolo/Scrivania/firefox-4.0b8pre.tar.gz")g_strdup_inline ("file:///home/paolo/Scrivania/firefox-4.0b8pre.tar.gz"
)
;
179 files = g_new0 (char *, 2)((char * *) g_malloc0_n ((2), sizeof (char *)));
180 files[0] = g_strdup ("file:///home/paolo/Scrivania/firefox-4.0b8pre")g_strdup_inline ("file:///home/paolo/Scrivania/firefox-4.0b8pre"
)
;
181 files[1] = NULL((void*)0);
182
183 g_dbus_proxy_call (proxy,
184 "AddToArchive",
185 g_variant_new ("(s^asb)",
186 archive,
187 files,
188 FALSE(0)),
189 G_DBUS_CALL_FLAGS_NONE,
190 G_MAXINT2147483647,
191 NULL((void*)0),
192 grapa_addtoarchive_ready_cb,
193 NULL((void*)0));
194
195 g_free (archive);
196 g_strfreev (files);
197
198 /* -- Compress -- */
199
200 char *destination;
201
202 files = g_new0 (char *, 2)((char * *) g_malloc0_n ((2), sizeof (char *)));
203 files[0] = g_strdup ("file:///home/paolo/Scrivania/firefox-4.0b8pre")g_strdup_inline ("file:///home/paolo/Scrivania/firefox-4.0b8pre"
)
;
204 files[1] = NULL((void*)0);
205 destination = g_strdup ("file:///home/paolo/Scrivania")g_strdup_inline ("file:///home/paolo/Scrivania");
206
207 g_dbus_proxy_call (proxy,
208 "Compress",
209 g_variant_new ("(^assb)",
210 files,
211 destination,
212 TRUE(!(0))),
213 G_DBUS_CALL_FLAGS_NONE,
214 G_MAXINT2147483647,
215 NULL((void*)0),
216 grapa_addtoarchive_ready_cb,
217 NULL((void*)0));
218
219 g_strfreev (files);
220 g_free (destination);
221
222 /* -- Extract -- */
223
224 g_dbus_proxy_call (proxy,
225 "Extract",
226 g_variant_new ("(ssb)",
227 "file:///home/paolo/Scrivania/test.tar.gz",
228 "file:///home/paolo/Scrivania",
229 TRUE(!(0))),
230 G_DBUS_CALL_FLAGS_NONE,
231 G_MAXINT2147483647,
232 NULL((void*)0),
233 grapa_addtoarchive_ready_cb,
234 NULL((void*)0));
235
236 /* -- ExtractHere -- */
237
238 g_dbus_proxy_call (proxy,
239 "ExtractHere",
240 g_variant_new ("(sb)",
241 "file:///home/paolo/Scrivania/test.tar.gz",
242 TRUE(!(0))),
243 G_DBUS_CALL_FLAGS_NONE,
244 G_MAXINT2147483647,
245 NULL((void*)0),
246 grapa_addtoarchive_ready_cb,
247 NULL((void*)0));
248 }
249 }
250
251 loop = g_main_loop_new (NULL((void*)0), FALSE(0));
252 g_main_loop_run (loop);
253
254 return 0;
255}