Bug Summary

File:src/main.c
Warning:line 182, 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 main.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -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-14/lib/clang/14.0.6 -D HAVE_CONFIG_H -I . -I .. -I ../cut-n-paste/toolbar-editor -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -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/gio-unix-2.0 -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/cafe-desktop-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -I /usr/include/ctk-3.0/unix-print -I /usr/local/include/libbean-1.0 -I /usr/include/gobject-introspection-1.0 -I /usr/include/exempi-2.0 -I /usr/include/librsvg-2.0 -D EOC_DATA_DIR="/usr/local/share/eoc" -D EOC_LOCALE_DIR="/usr/local/share/locale" -I /usr/include/gobject-introspection-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../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/2023-06-09-093339-31414-1 -x c main.c
1/* Eye Of Cafe - Main
2 *
3 * Copyright (C) 2000-2006 The Free Software Foundation
4 *
5 * Author: Lucas Rocha <lucasr@gnome.org>
6 *
7 * Based on code by:
8 * - Federico Mena-Quintero <federico@gnu.org>
9 * - Jens Finke <jens@gnome.org>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
24 */
25
26#ifdef HAVE_CONFIG_H1
27#include "config.h"
28#endif
29#ifdef HAVE_INTROSPECTION1
30#include <girepository.h>
31#endif
32
33#include "eoc-session.h"
34#include "eoc-debug.h"
35#include "eoc-thumbnail.h"
36#include "eoc-job-queue.h"
37#include "eoc-application.h"
38#include "eoc-application-internal.h"
39#include "eoc-util.h"
40
41#include <string.h>
42#include <stdlib.h>
43#include <glib/gi18n.h>
44
45#if HAVE_EXEMPI1
46#include <exempi/xmp.h>
47#endif
48
49#define EOC_CSS_FILE_PATH"/usr/local/share/eoc" "/" "eoc.css" EOC_DATA_DIR"/usr/local/share/eoc" G_DIR_SEPARATOR_S"/" "eoc.css"
50
51static EocStartupFlags flags;
52
53static gboolean fullscreen = FALSE(0);
54static gboolean slide_show = FALSE(0);
55static gboolean disable_collection = FALSE(0);
56static gboolean force_new_instance = FALSE(0);
57static gchar **startup_files = NULL((void*)0);
58
59static gboolean
60_print_version_and_exit (const gchar *option_name,
61 const gchar *value,
62 gpointer data,
63 GError **error)
64{
65 g_print("%s %s\n", _("Eye of CAFE Image Viewer")gettext ("Eye of CAFE Image Viewer"), VERSION"1.24.1");
66 exit (EXIT_SUCCESS0);
67 return TRUE(!(0));
68}
69
70static const GOptionEntry goption_options[] =
71{
72 { "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &fullscreen, N_("Open in fullscreen mode")("Open in fullscreen mode"), NULL((void*)0) },
73 { "disable-image-collection", 'c', 0, G_OPTION_ARG_NONE, &disable_collection, N_("Disable image collection")("Disable image collection"), NULL((void*)0) },
74 { "slide-show", 's', 0, G_OPTION_ARG_NONE, &slide_show, N_("Open in slideshow mode")("Open in slideshow mode"), NULL((void*)0) },
75 { "new-instance", 'n', 0, G_OPTION_ARG_NONE, &force_new_instance, N_("Start a new instance instead of reusing an existing one")("Start a new instance instead of reusing an existing one"), NULL((void*)0) },
76 { "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
77 _print_version_and_exit, N_("Show the application's version")("Show the application's version"), NULL((void*)0)},
78 { NULL((void*)0) }
79};
80
81static void
82set_startup_flags (void)
83{
84 if (fullscreen)
85 flags |= EOC_STARTUP_FULLSCREEN;
86
87 if (disable_collection)
88 flags |= EOC_STARTUP_DISABLE_COLLECTION;
89
90 if (slide_show)
91 flags |= EOC_STARTUP_SLIDE_SHOW;
92}
93
94int
95main (int argc, char **argv)
96{
97 GError *error = NULL((void*)0);
98 GOptionContext *ctx;
99 GFile *css_file;
100 CtkCssProvider *provider;
101
102 bindtextdomain (GETTEXT_PACKAGE"eoc", EOC_LOCALE_DIR"/usr/local/share/locale");
103 bind_textdomain_codeset (GETTEXT_PACKAGE"eoc", "UTF-8");
104 textdomain (GETTEXT_PACKAGE"eoc");
105
106 cdk_set_allowed_backends ("wayland,x11");
107
108 ctx = g_option_context_new (_("[FILE…]")gettext ("[FILE…]"));
109 g_option_context_add_main_entries (ctx, goption_options, PACKAGE"eoc");
110 /* Option groups are free'd together with the context
111 * Using ctk_get_option_group here initializes ctk during parsing */
112 g_option_context_add_group (ctx, ctk_get_option_group (TRUE(!(0))));
113#ifdef HAVE_INTROSPECTION1
114 g_option_context_add_group (ctx, g_irepository_get_option_group ());
115#endif
116
117 if (!g_option_context_parse (ctx, &argc, &argv, &error)) {
118 gchar *help_msg;
119
120 /* I18N: The '%s' is replaced with eoc's command name. */
121 help_msg = g_strdup_printf (_("Run '%s --help' to see a full "gettext ("Run '%s --help' to see a full " "list of available command line "
"options.")
122 "list of available command line "gettext ("Run '%s --help' to see a full " "list of available command line "
"options.")
123 "options.")gettext ("Run '%s --help' to see a full " "list of available command line "
"options.")
, argv[0]);
124 g_printerr ("%s\n%s\n", error->message, help_msg);
125 g_error_free (error);
126 g_free (help_msg);
127 g_option_context_free (ctx);
128
129 return 1;
130 }
131 g_option_context_free (ctx);
132
133
134 set_startup_flags ();
135
136#ifdef HAVE_EXEMPI1
137 xmp_init();
138#endif
139 eoc_debug_init ();
140 eoc_job_queue_init ();
141 eoc_thumbnail_init ();
142
143 /* Load special style properties for EocThumbView's scrollbar */
144 css_file = g_file_new_for_uri ("resource:///org/cafe/eoc/ui/eoc.css");
145 provider = ctk_css_provider_new ();
146 if (G_UNLIKELY (!ctk_css_provider_load_from_file(provider,(!ctk_css_provider_load_from_file(provider, css_file, &error
))
147 css_file,(!ctk_css_provider_load_from_file(provider, css_file, &error
))
148 &error))(!ctk_css_provider_load_from_file(provider, css_file, &error
))
)
149 {
150 g_critical ("Could not load CSS data: %s", error->message);
151 g_clear_error (&error);
152 } else {
153 ctk_style_context_add_provider_for_screen (
154 cdk_screen_get_default(),
155 CTK_STYLE_PROVIDER (provider)((((CtkStyleProvider*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((provider)), ((ctk_style_provider_get_type (
)))))))
,
156 CTK_STYLE_PROVIDER_PRIORITY_APPLICATION600);
157 }
158 g_object_unref (provider);
159 g_object_unref (css_file);
160
161 /* Add application specific icons to search path */
162 ctk_icon_theme_append_search_path (ctk_icon_theme_get_default (),
163 EOC_DATA_DIR"/usr/local/share/eoc" G_DIR_SEPARATOR_S"/" "icons");
164
165 ctk_window_set_default_icon_name ("eoc");
166 g_set_application_name (_("Eye of CAFE Image Viewer")gettext ("Eye of CAFE Image Viewer"));
167
168 g_object_set (ctk_settings_get_default (), "ctk-button-images", TRUE(!(0)), NULL((void*)0));
169 g_object_set (ctk_settings_get_default (), "ctk-menu-images", TRUE(!(0)), NULL((void*)0));
170
171 EOC_APP(eoc_application_get_instance ())->priv->flags = flags;
172 if (force_new_instance) {
173 GApplicationFlags app_flags = g_application_get_flags (G_APPLICATION (EOC_APP)((((GApplication*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((eoc_application_get_instance ()))), ((g_application_get_type
()))))))
);
174 app_flags |= G_APPLICATION_NON_UNIQUE;
175 g_application_set_flags (G_APPLICATION (EOC_APP)((((GApplication*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((eoc_application_get_instance ()))), ((g_application_get_type
()))))))
, app_flags);
176 }
177
178 g_application_run (G_APPLICATION (EOC_APP)((((GApplication*) (void *) g_type_check_instance_cast ((GTypeInstance
*) (((eoc_application_get_instance ()))), ((g_application_get_type
()))))))
, argc, argv);
179 g_object_unref (EOC_APP(eoc_application_get_instance ()));
180
181 if (startup_files)
182 g_strfreev (startup_files);
This statement is never executed
183
184#ifdef HAVE_EXEMPI1
185 xmp_terminate();
186#endif
187 return 0;
188}