Bug Summary

File:builds/wireshark/wireshark/ui/help_url.c
Warning:line 312, column 9
Value stored to 'url' 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 help_url.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 -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -ffloat16-excess-precision=fast -fbfloat16-excess-precision=fast -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/builds/wireshark/wireshark/build -fcoverage-compilation-dir=/builds/wireshark/wireshark/build -resource-dir /usr/lib/llvm-18/lib/clang/18 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -D G_DISABLE_DEPRECATED -D G_DISABLE_SINGLE_INCLUDES -D WS_DEBUG -D WS_DEBUG_UTF_8 -I /builds/wireshark/wireshark/build -I /builds/wireshark/wireshark -I /builds/wireshark/wireshark/include -I /builds/wireshark/wireshark/ui -I /builds/wireshark/wireshark/build/ui -I /builds/wireshark/wireshark/wiretap -D _GLIBCXX_ASSERTIONS -internal-isystem /usr/lib/llvm-18/lib/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/builds/wireshark/wireshark/= -fmacro-prefix-map=/builds/wireshark/wireshark/build/= -fmacro-prefix-map=../= -Wno-format-truncation -Wno-format-nonliteral -Wno-pointer-sign -std=gnu11 -ferror-limit 19 -fvisibility=hidden -fwrapv -fstrict-flex-arrays=3 -stack-protector 2 -fstack-clash-protection -fcf-protection=full -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fexceptions -fcolor-diagnostics -analyzer-output=html -dwarf-debug-flags /usr/lib/llvm-18/bin/clang -### --analyze -x c -D G_DISABLE_DEPRECATED -D G_DISABLE_SINGLE_INCLUDES -D WS_DEBUG -D WS_DEBUG_UTF_8 -I /builds/wireshark/wireshark/build -I /builds/wireshark/wireshark -I /builds/wireshark/wireshark/include -I /builds/wireshark/wireshark/ui -I /builds/wireshark/wireshark/build/ui -I /builds/wireshark/wireshark/wiretap -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -fvisibility=hidden -fexcess-precision=fast -fstrict-flex-arrays=3 -fstack-clash-protection -fcf-protection=full -D _GLIBCXX_ASSERTIONS -fstack-protector-strong -fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -fexceptions -Wno-format-truncation -Wno-format-nonliteral -fdiagnostics-color=always -Wno-pointer-sign -fmacro-prefix-map=/builds/wireshark/wireshark/= -fmacro-prefix-map=/builds/wireshark/wireshark/build/= -fmacro-prefix-map=../= -std=gnu11 -fPIC /builds/wireshark/wireshark/ui/help_url.c -o /builds/wireshark/wireshark/sbout/2024-11-21-100252-3913-1 -Xclang -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /builds/wireshark/wireshark/sbout/2024-11-21-100252-3913-1 -x c /builds/wireshark/wireshark/ui/help_url.c
1/* help_url.c
2 *
3 * Some content from gtk/help_dlg.c by Laurent Deniel <[email protected]>
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <[email protected]>
7 * Copyright 2000 Gerald Combs
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
12#include "config.h"
13
14#include <string.h>
15
16#include <glib.h>
17
18#include "help_url.h"
19#include "urls.h"
20#include "wsutil/filesystem.h"
21#include <wsutil/ws_assert.h>
22
23// To do:
24// - Automatically generate part or all of this, e.g. by parsing
25// the DocBook XML or the chunked HTML.
26
27/*
28 * Open the help dialog and show a specific HTML help page.
29 */
30char *
31user_guide_url(const char *page) {
32 GString *url = g_string_new("");
33
34#if defined(_WIN32)
35 /*
36 * The User's Guide is in a directory named "Wireshark User's Guide" in
37 * the program directory.
38 */
39
40 GString *ug_dir = g_string_new("");
41 g_string_printf(ug_dir, "%s\\Wireshark User's Guide", get_datafile_dir());
42 if (g_file_test(ug_dir->str, G_FILE_TEST_IS_DIR)) {
43 g_string_printf(url, "file:///%s/%s", ug_dir->str, page);
44 }
45 g_string_free(ug_dir, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) (
(ug_dir), ((!(0)))) : g_string_free_and_steal (ug_dir)) : (g_string_free
) ((ug_dir), ((!(0)))))
;
46#else
47 char *path = g_build_filename(get_doc_dir(), "wsug_html_chunked", page, NULL((void*)0));
48 if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) {
49 /* try to open the HTML page from the filesystem */
50 g_string_printf(url, "file://%s", path);
51 }
52 g_free(path);
53 path = NULL((void*)0);
54#endif /* _WIN32 */
55
56
57 /* Fall back to wireshark.org. */
58 if (url->len == 0) {
59 g_string_printf(url, WS_DOCS_URL"https://www.wireshark.org/docs/" "wsug_html_chunked/%s", page);
60 }
61 return g_string_free(url, FALSE)(__builtin_constant_p ((0)) ? (((0)) ? (g_string_free) ((url)
, ((0))) : g_string_free_and_steal (url)) : (g_string_free) (
(url), ((0))))
;
62}
63
64char *
65topic_action_url(topic_action_e action)
66{
67 char *url;
68
69 switch(action) {
70 /* pages online at www.wireshark.org */
71 case(ONLINEPAGE_HOME):
72 url = g_strdup(WS_HOME_PAGE_URL)g_strdup_inline ("https://www.wireshark.org");
73 break;
74 case(ONLINEPAGE_WIKI):
75 url = g_strdup(WS_WIKI_HOME_URL)g_strdup_inline ("https://wiki.wireshark.org");
76 break;
77 case(ONLINEPAGE_DOWNLOAD):
78 url = g_strdup(WS_DOWNLOAD_URL)g_strdup_inline ("https://www.wireshark.org/download.html");
79 break;
80 case(ONLINEPAGE_DOCS):
81 url = g_strdup(WS_DOCS_URL)g_strdup_inline ("https://www.wireshark.org/docs/");
82 break;
83 case(ONLINEPAGE_USERGUIDE):
84 url = g_strdup(WS_DOCS_URL "wsug_html_chunked/")g_strdup_inline ("https://www.wireshark.org/docs/" "wsug_html_chunked/"
)
;
85 break;
86 case(ONLINEPAGE_FAQ):
87 url = g_strdup(WS_FAQ_URL)g_strdup_inline ("https://www.wireshark.org/faq.html");
88 break;
89 case(ONLINEPAGE_ASK):
90 url = g_strdup(WS_Q_AND_A_URL)g_strdup_inline ("https://ask.wireshark.org");
91 break;
92 case(ONLINEPAGE_SAMPLE_FILES):
93 url = g_strdup(WS_WIKI_URL("SampleCaptures"))g_strdup_inline ("https://wiki.wireshark.org" "/" "SampleCaptures"
)
;
94 break;
95 case(ONLINEPAGE_CAPTURE_SETUP):
96 url = g_strdup(WS_WIKI_URL("CaptureSetup"))g_strdup_inline ("https://wiki.wireshark.org" "/" "CaptureSetup"
)
;
97 break;
98 case(ONLINEPAGE_NETWORK_MEDIA):
99 url = g_strdup(WS_WIKI_URL("CaptureSetup/NetworkMedia"))g_strdup_inline ("https://wiki.wireshark.org" "/" "CaptureSetup/NetworkMedia"
)
;
100 break;
101 case(ONLINEPAGE_SAMPLE_CAPTURES):
102 url = g_strdup(WS_WIKI_URL("SampleCaptures"))g_strdup_inline ("https://wiki.wireshark.org" "/" "SampleCaptures"
)
;
103 break;
104 case(ONLINEPAGE_SECURITY):
105 url = g_strdup(WS_WIKI_URL("Security"))g_strdup_inline ("https://wiki.wireshark.org" "/" "Security");
106 break;
107 case(ONLINEPAGE_DFILTER_REF):
108 url = g_strdup(WS_DOCS_URL "dfref/")g_strdup_inline ("https://www.wireshark.org/docs/" "dfref/");
109 break;
110
111 /* local manual pages */
112 case(LOCALPAGE_MAN_WIRESHARK):
113 url = doc_file_url("wireshark.html");
114 break;
115 case(LOCALPAGE_MAN_WIRESHARK_FILTER):
116 url = doc_file_url("wireshark-filter.html");
117 break;
118 case(LOCALPAGE_MAN_CAPINFOS):
119 url = doc_file_url("capinfos.html");
120 break;
121 case(LOCALPAGE_MAN_DUMPCAP):
122 url = doc_file_url("dumpcap.html");
123 break;
124 case(LOCALPAGE_MAN_EDITCAP):
125 url = doc_file_url("editcap.html");
126 break;
127 case(LOCALPAGE_MAN_MERGECAP):
128 url = doc_file_url("mergecap.html");
129 break;
130 case(LOCALPAGE_MAN_RAWSHARK):
131 url = doc_file_url("rawshark.html");
132 break;
133 case(LOCALPAGE_MAN_REORDERCAP):
134 url = doc_file_url("reordercap.html");
135 break;
136 case(LOCALPAGE_MAN_TEXT2PCAP):
137 url = doc_file_url("text2pcap.html");
138 break;
139 case(LOCALPAGE_MAN_TSHARK):
140 url = doc_file_url("tshark.html");
141 break;
142
143 /* Release Notes */
144 case(LOCALPAGE_RELEASE_NOTES):
145 url = doc_file_url("release-notes.html");
146 break;
147
148 /* local help pages (User's Guide) */
149 case(HELP_CONTENT):
150 url = user_guide_url( "index.html");
151 break;
152 case(HELP_CAPTURE_OPTIONS):
153 url = user_guide_url("ChCapCaptureOptions.html");
154 break;
155 case(HELP_CAPTURE_FILTERS_DIALOG):
156 url = user_guide_url("ChWorkDefineFilterSection.html");
157 break;
158 case(HELP_DISPLAY_FILTERS_DIALOG):
159 url = user_guide_url("ChWorkDefineFilterSection.html");
160 break;
161 case(HELP_DISPLAY_MACRO_DIALOG):
162 url = user_guide_url("ChWorkDefineFilterMacrosSection.html");
163 break;
164 case(HELP_FILTER_EXPRESSION_DIALOG):
165 url = user_guide_url("ChWorkFilterAddExpressionSection.html");
166 break;
167 case(HELP_COLORING_RULES_DIALOG):
168 url = user_guide_url("ChCustColorizationSection.html");
169 break;
170 case(HELP_CONFIG_PROFILES_DIALOG):
171 url = user_guide_url("ChCustConfigProfilesSection.html");
172 break;
173 case(HELP_PRINT_DIALOG):
174 url = user_guide_url("ChIOPrintSection.html");
175 break;
176 case(HELP_FIND_DIALOG):
177 url = user_guide_url("ChWorkFindPacketSection.html");
178 break;
179 case(HELP_FIREWALL_DIALOG):
180 url = user_guide_url("ChUseToolsMenuSection.html");
181 break;
182 case(HELP_GOTO_DIALOG):
183 url = user_guide_url("ChWorkGoToPacketSection.html");
184 break;
185 case(HELP_CAPTURE_OPTIONS_DIALOG):
186 url = user_guide_url("ChCapCaptureOptions.html");
187 break;
188 case(HELP_CAPTURE_INFO_DIALOG):
189 url = user_guide_url("ChCapRunningSection.html");
190 break;
191 case(HELP_CAPTURE_MANAGE_INTERFACES_DIALOG):
192 url = user_guide_url("ChCapManageInterfacesSection.html");
193 break;
194 case(HELP_ENABLED_PROTOCOLS_DIALOG):
195 url = user_guide_url("ChCustProtocolDissectionSection.html");
196 break;
197 case(HELP_ENABLED_HEURISTICS_DIALOG):
198 url = user_guide_url("ChCustProtocolDissectionSection.html");
199 break;
200 case(HELP_DECODE_AS_DIALOG):
201 url = user_guide_url("ChCustProtocolDissectionSection.html");
202 break;
203 case(HELP_DECODE_AS_SHOW_DIALOG):
204 url = user_guide_url("ChCustProtocolDissectionSection.html");
205 break;
206 case(HELP_FOLLOW_STREAM_DIALOG):
207 url = user_guide_url("ChAdvFollowStreamSection.html");
208 break;
209 case(HELP_SHOW_PACKET_BYTES_DIALOG):
210 url = user_guide_url("ChAdvShowPacketBytes.html");
211 break;
212 case(HELP_EXPERT_INFO_DIALOG):
213 url = user_guide_url("ChAdvExpert.html");
214 break;
215 case(HELP_EXTCAP_OPTIONS_DIALOG):
216 url = doc_file_url("extcap.html");
217 break;
218 case(HELP_STATS_SUMMARY_DIALOG):
219 url = user_guide_url("ChStatSummary.html");
220 break;
221 case(HELP_STATS_PROTO_HIERARCHY_DIALOG):
222 url = user_guide_url("ChStatHierarchy.html");
223 break;
224 case(HELP_STATS_ENDPOINTS_DIALOG):
225 url = user_guide_url("ChStatEndpoints.html");
226 break;
227 case(HELP_STATS_CONVERSATIONS_DIALOG):
228 url = user_guide_url("ChStatConversations.html");
229 break;
230 case(HELP_STATS_IO_GRAPH_DIALOG):
231 url = user_guide_url("ChStatIOGraphs.html");
232 break;
233 case(HELP_STATS_LTE_MAC_TRAFFIC_DIALOG):
234 url = user_guide_url("ChTelLTE.html#ChTelLTEMACTraffic");
235 break;
236 case(HELP_STATS_LTE_RLC_TRAFFIC_DIALOG):
237 url = user_guide_url("ChTelLTE.html#ChTelLTERLCTraffic");
238 break;
239 case(HELP_STATS_TCP_STREAM_GRAPHS_DIALOG):
240 url = user_guide_url("ChStatTCPStreamGraphs.html");
241 break;
242 case(HELP_STATS_WLAN_TRAFFIC_DIALOG):
243 url = user_guide_url("ChWirelessWLANTraffic.html");
244 break;
245 case(HELP_FILESET_DIALOG):
246 url = user_guide_url("ChIOFileSetSection.html");
247 break;
248 case(HELP_CAPTURE_INTERFACE_OPTIONS_DIALOG):
249 url = user_guide_url("ChCustPreferencesSection.html#ChCustInterfaceOptionsSection");
250 break;
251 case(HELP_PREFERENCES_DIALOG):
252 url = user_guide_url("ChCustPreferencesSection.html");
253 break;
254 case(HELP_EXPORT_FILE_DIALOG):
255 case(HELP_EXPORT_FILE_WIN32_DIALOG):
256 url = user_guide_url("ChIOExportSection.html");
257 break;
258 case(HELP_EXPORT_BYTES_DIALOG):
259 url = user_guide_url("ChIOExportSection.html#ChIOExportSelectedDialog");
260 break;
261 case(HELP_EXPORT_PDUS_DIALOG):
262 url = user_guide_url("ChIOExportSection.html#ChIOExportPDUSDialog");
263 break;
264 case(HELP_STRIP_HEADERS_DIALOG):
265 url = user_guide_url("ChIOExportSection.html#ChIOStripHeadersDialog");
266 break;
267 case(HELP_EXPORT_OBJECT_LIST):
268 url = user_guide_url("ChIOExportSection.html#ChIOExportObjectsDialog");
269 break;
270 case(HELP_OPEN_DIALOG):
271 case(HELP_OPEN_WIN32_DIALOG):
272 url = user_guide_url("ChIOOpenSection.html");
273 break;
274 case(HELP_MERGE_DIALOG):
275 case(HELP_MERGE_WIN32_DIALOG):
276 url = user_guide_url("ChIOMergeSection.html");
277 break;
278 case(HELP_IMPORT_DIALOG):
279 url = user_guide_url("ChIOImportSection.html");
280 break;
281 case(HELP_SAVE_DIALOG):
282 case(HELP_SAVE_WIN32_DIALOG):
283 url = user_guide_url("ChIOSaveSection.html");
284 break;
285 case(HELP_TIME_SHIFT_DIALOG):
286 url = user_guide_url("ChWorkShiftTimePacketSection.html");
287 break;
288 case(HELP_TELEPHONY_VOIP_CALLS_DIALOG):
289 url = user_guide_url("ChTelVoipCalls.html");
290 break;
291 case(HELP_TELEPHONY_RTP_ANALYSIS_DIALOG):
292 url = user_guide_url("ChTelRTP.html#ChTelRTPAnalysis");
293 break;
294 case(HELP_TELEPHONY_RTP_STREAMS_DIALOG):
295 url = user_guide_url("ChTelRTP.html#ChTelRTPStreams");
296 break;
297 case(HELP_NEW_PACKET_DIALOG):
298 url = user_guide_url("ChapterWork.html#ChWorkPacketSepView");
299 break;
300 case(HELP_IAX2_ANALYSIS_DIALOG):
301 url = user_guide_url("ChTelIAX2Analysis.html");
302 break;
303 case(HELP_TELEPHONY_RTP_PLAYER_DIALOG):
304 url = user_guide_url("ChTelRTP.html#ChTelRtpPlayer");
305 break;
306 case(HELP_STAT_FLOW_GRAPH):
307 url = user_guide_url("ChStatFlowGraph.html");
308 break;
309
310 case(TOPIC_ACTION_NONE):
311 default:
312 url = g_strdup(WS_HOME_PAGE_URL)g_strdup_inline ("https://www.wireshark.org");
Value stored to 'url' is never read
313 ws_assert_not_reached()ws_log_fatal_full("", LOG_LEVEL_ERROR, "ui/help_url.c", 313, __func__
, "assertion \"not reached\" failed")
;
314 }
315
316 return url;
317}