Location | Tool | Test ID | Function | Issue |
---|---|---|---|---|
e-attachment-handler.c:58:2 | clang-analyzer | Function call argument is an uninitialized value | ||
e-attachment-handler.c:58:2 | clang-analyzer | Function call argument is an uninitialized value |
1 /*
2 * e-attachment-handler.c
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) version 3.
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 GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with the program; if not, see <http://www.gnu.org/licenses/>
16 *
17 *
18 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
19 *
20 */
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include "e-attachment-handler.h"
27
28 #define E_ATTACHMENT_HANDLER_GET_PRIVATE(obj) \
29 (G_TYPE_INSTANCE_GET_PRIVATE \
30 ((obj), E_TYPE_ATTACHMENT_HANDLER, EAttachmentHandlerPrivate))
31
32 struct _EAttachmentHandlerPrivate {
33 gpointer placeholder;
34 };
35
36 G_DEFINE_TYPE (
37 EAttachmentHandler,
38 e_attachment_handler,
39 E_TYPE_EXTENSION)
40
41 static void
42 attachment_handler_constructed (GObject *object)
43 {
44 EAttachmentView *view;
45 EAttachmentHandler *handler;
46 GdkDragAction drag_actions;
47 GtkTargetList *target_list;
48 const GtkTargetEntry *targets;
49 guint n_targets;
50
51 handler = E_ATTACHMENT_HANDLER (object);
52 drag_actions = e_attachment_handler_get_drag_actions (handler);
53 targets = e_attachment_handler_get_target_table (handler, &n_targets);
54
55 view = e_attachment_handler_get_view (handler);
56
57 target_list = e_attachment_view_get_target_list (view);
58 gtk_target_list_add_table (target_list, targets, n_targets);
(emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
(emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
59
60 e_attachment_view_add_drag_actions (view, drag_actions);
61
62 /* Chain up to parent's constructed() method. */
63 G_OBJECT_CLASS (e_attachment_handler_parent_class)->constructed (object);
64 }
65
66 static void
67 e_attachment_handler_class_init (EAttachmentHandlerClass *class)
68 {
69 GObjectClass *object_class;
70 EExtensionClass *extension_class;
71
72 g_type_class_add_private (class, sizeof (EAttachmentHandlerPrivate));
73
74 object_class = G_OBJECT_CLASS (class);
75 object_class->constructed = attachment_handler_constructed;
76
77 extension_class = E_EXTENSION_CLASS (class);
78 extension_class->extensible_type = E_TYPE_ATTACHMENT_VIEW;
79 }
80
81 static void
82 e_attachment_handler_init (EAttachmentHandler *handler)
83 {
84 handler->priv = E_ATTACHMENT_HANDLER_GET_PRIVATE (handler);
85 }
86
87 EAttachmentView *
88 e_attachment_handler_get_view (EAttachmentHandler *handler)
89 {
90 EExtensible *extensible;
91
92 /* This is purely a convenience function. */
93
94 g_return_val_if_fail (E_IS_ATTACHMENT_HANDLER (handler), NULL);
95
96 extensible = e_extension_get_extensible (E_EXTENSION (handler));
97
98 return E_ATTACHMENT_VIEW (extensible);
99 }
100
101 GdkDragAction
102 e_attachment_handler_get_drag_actions (EAttachmentHandler *handler)
103 {
104 EAttachmentHandlerClass *class;
105
106 g_return_val_if_fail (E_IS_ATTACHMENT_HANDLER (handler), 0);
107
108 class = E_ATTACHMENT_HANDLER_GET_CLASS (handler);
109
110 if (class->get_drag_actions != NULL)
111 return class->get_drag_actions (handler);
112
113 return 0;
114 }
115
116 const GtkTargetEntry *
117 e_attachment_handler_get_target_table (EAttachmentHandler *handler,
118 guint *n_targets)
119 {
120 EAttachmentHandlerClass *class;
121
122 g_return_val_if_fail (E_IS_ATTACHMENT_HANDLER (handler), NULL);
123
124 class = E_ATTACHMENT_HANDLER_GET_CLASS (handler);
125
126 if (class->get_target_table != NULL)
127 return class->get_target_table (handler, n_targets);
128
129 if (n_targets != NULL)
130 *n_targets = 0;
131
132 return NULL;
133 }