Bug Summary

File:weather-wx.c
Warning:line 30, column 18
Value stored to 'session' during its initialization is never read

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 weather-wx.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 -fhalf-no-semantic-interposition -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/libcafeweather -resource-dir /usr/lib/llvm-16/lib/clang/16 -D HAVE_CONFIG_H -I . -I .. -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/webp -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 .. -I . -I /usr/include/libxml2 -I /usr/include/libsoup-3.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 -I /usr/include/sysprof-6 -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 -D G_LOG_DOMAIN="CafeWeather" -D CAFELOCALEDIR="/usr/share/locale" -D CAFEWEATHER_XML_LOCATION_DIR="/usr/share/libcafeweather" -D PIC -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/libcafeweather -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-02-11-015129-15479-1 -x c weather-wx.c
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2/* weather-wx.c - Weather server functions (WX Radar)
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 as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * 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, see
16 * <http://www.gnu.org/licenses/>.
17 */
18
19#ifdef HAVE_CONFIG_H1
20#include <config.h>
21#endif
22
23#define CAFEWEATHER_I_KNOW_THIS_IS_UNSTABLE
24#include "weather.h"
25#include "weather-priv.h"
26
27static void
28wx_finish (GObject *object, GAsyncResult *result, gpointer data)
29{
30 SoupSession *session = SOUP_SESSION (object);
Value stored to 'session' during its initialization is never read
31 SoupMessage *msg = soup_session_get_async_result_message (SOUP_SESSION (object), result);
32 WeatherInfo *info = (WeatherInfo *)data;
33 GdkPixbufAnimation *animation;
34 GBytes *response_body = NULL((void*)0);
35
36 g_return_if_fail (info != NULL)do { if ((info != ((void*)0))) { } else { g_return_if_fail_warning
("CafeWeather", ((const char*) (__func__)), "info != NULL");
return; } } while (0)
;
37
38response_body = soup_session_send_and_read_finish(SOUP_SESSION(object),
39 result, NULL((void*)0)/*&error*/);
40
41 if (!SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (msg))((soup_message_get_status (msg)) >= 200 && (soup_message_get_status
(msg)) < 300)
) {
42 g_warning ("Failed to get radar map image: %d %s.\n",
43 soup_message_get_status (msg), soup_message_get_reason_phrase (msg));
44 g_object_unref (info->radar_loader);
45 request_done (info, FALSE(0));
46 return;
47 }
48
49 gdk_pixbuf_loader_close (info->radar_loader, NULL((void*)0));
50 animation = gdk_pixbuf_loader_get_animation (info->radar_loader);
51 if (animation != NULL((void*)0)) {
52 if (info->radar)
53 g_object_unref (info->radar);
54 info->radar = animation;
55 g_object_ref (info->radar)((__typeof__ (info->radar)) (g_object_ref) (info->radar
))
;
56 }
57 g_object_unref (info->radar_loader);
58
59 request_done (info, TRUE(!(0)));
60}
61
62static void
63wx_got_chunk /*(SoupMessage *msg, SoupBuffer *chunk, gpointer data)*/
64(SoupServerMessage *msg, GBytes *chunk, gpointer data)
65{
66 WeatherInfo *info = (WeatherInfo *)data;
67 const gchar *msgdata;
68 GError *error = NULL((void*)0);
69
70 msgdata = g_bytes_get_data(chunk, NULL((void*)0)/*&length*/);
71
72 g_return_if_fail (info != NULL)do { if ((info != ((void*)0))) { } else { g_return_if_fail_warning
("CafeWeather", ((const char*) (__func__)), "info != NULL");
return; } } while (0)
;
73
74 gdk_pixbuf_loader_write (info->radar_loader, (guchar *)msgdata,
75 (gsize) chunk, &error);
76 if (error) {
77 g_print ("%s \n", error->message);
78 g_error_free (error);
79 }
80}
81
82/* Get radar map and into newly allocated pixmap */
83void
84wx_start_open (WeatherInfo *info)
85{
86 gchar *url;
87 SoupMessage *msg;
88 WeatherLocation *loc;
89
90 g_return_if_fail (info != NULL)do { if ((info != ((void*)0))) { } else { g_return_if_fail_warning
("CafeWeather", ((const char*) (__func__)), "info != NULL");
return; } } while (0)
;
91 info->radar = NULL((void*)0);
92 info->radar_loader = gdk_pixbuf_loader_new ();
93 loc = info->location;
94 g_return_if_fail (loc != NULL)do { if ((loc != ((void*)0))) { } else { g_return_if_fail_warning
("CafeWeather", ((const char*) (__func__)), "loc != NULL"); return
; } } while (0)
;
95
96 if (info->radar_url)
97 url = g_strdup (info->radar_url)g_strdup_inline (info->radar_url);
98 else {
99 if (loc->radar[0] == '-')
100 return;
101 url = g_strdup_printf ("http://image.weather.com/web/radar/us_%s_closeradar_medium_usen.jpg", loc->radar);
102 }
103
104 msg = soup_message_new ("GET", url);
105 if (!msg) {
106 g_warning ("Invalid radar URL: %s\n", url);
107 g_free (url);
108 return;
109 }
110
111 g_signal_connect (msg, "got-chunk", G_CALLBACK (wx_got_chunk), info)g_signal_connect_data ((msg), ("got-chunk"), (((GCallback) (wx_got_chunk
))), (info), ((void*)0), (GConnectFlags) 0)
;
112// soup_message_body_set_accumulate (msg->response_body, FALSE);
113 soup_session_send_and_read_async (info->session, msg, G_PRIORITY_DEFAULT0, NULL((void*)0), wx_finish, info);
114 g_free (url);
115
116 info->requests_pending++;
117}