Location | Tool | Test ID | Function | Issue |
---|---|---|---|---|
e-filter-code.c:49:6 | clang-analyzer | Access to field 'values' results in a dereference of a null pointer (loaded from variable 'fi') | ||
e-filter-code.c:49:6 | clang-analyzer | Access to field 'values' results in a dereference of a null pointer (loaded from variable 'fi') |
1 /*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2 of the License, or (at your option) version 3.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with the program; if not, see <http://www.gnu.org/licenses/>
14 *
15 *
16 * Authors:
17 * Not Zed <notzed@lostzed.mmc.com.au>
18 * Jeffrey Stedfast <fejj@ximian.com>
19 *
20 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
21 *
22 */
23
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27
28 #include "e-filter-code.h"
29 #include "e-filter-part.h"
30
31 G_DEFINE_TYPE (
32 EFilterCode,
33 e_filter_code,
34 E_TYPE_FILTER_INPUT)
35
36 /* here, the string IS the code */
37 static void
38 filter_code_build_code (EFilterElement *element,
39 GString *out,
40 EFilterPart *part)
41 {
42 GList *l;
43 EFilterInput *fi = (EFilterInput *) element;
44 gboolean is_rawcode = fi && fi->type && g_str_equal (fi->type, "rawcode");
45
46 if (!is_rawcode)
47 g_string_append (out, "(match-all ");
48
49 l = fi->values;
(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)
50 while (l) {
51 g_string_append (out, (gchar *) l->data);
52 l = g_list_next (l);
53 }
54
55 if (!is_rawcode)
56 g_string_append (out, ")");
57 }
58
59 /* and we have no value */
60 static void
61 filter_code_format_sexp (EFilterElement *element,
62 GString *out)
63 {
64 }
65
66 static void
67 e_filter_code_class_init (EFilterCodeClass *class)
68 {
69 EFilterElementClass *filter_element_class;
70
71 filter_element_class = E_FILTER_ELEMENT_CLASS (class);
72 filter_element_class->build_code = filter_code_build_code;
73 filter_element_class->format_sexp = filter_code_format_sexp;
74 }
75
76 static void
77 e_filter_code_init (EFilterCode *code)
78 {
79 EFilterInput *input = E_FILTER_INPUT (code);
80
81 input->type = (gchar *) xmlStrdup ((xmlChar *) "code");
82 }
83
84 /**
85 * filter_code_new:
86 *
87 * Create a new EFilterCode object.
88 *
89 * Return value: A new #EFilterCode object.
90 **/
91 EFilterCode *
92 e_filter_code_new (gboolean raw_code)
93 {
94 EFilterCode *fc = g_object_new (E_TYPE_FILTER_CODE, NULL, NULL);
95
96 if (fc && raw_code) {
97 xmlFree (((EFilterInput *) fc)->type);
98 ((EFilterInput *) fc)->type = (gchar *) xmlStrdup ((xmlChar *)"rawcode");
99 }
100
101 return fc;
102 }