Fix CID 1491093: attrib leaked if attvalue is null
[claws.git] / src / html.h
blob31f6208fdb457f37fe1acaf8f6d062c6d7f40c2c
1 /*
2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2017 Hiroyuki Yamamoto and the Claws Mail team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef __HTML_H__
20 #define __HTML_H__
22 #include <glib.h>
23 #include <stdio.h>
25 #include "codeconv.h"
27 typedef enum
29 SC_HTML_NORMAL,
30 SC_HTML_PAR,
31 SC_HTML_BR,
32 SC_HTML_HR,
33 SC_HTML_HREF,
34 SC_HTML_IMG,
35 SC_HTML_FONT,
36 SC_HTML_PRE,
37 SC_HTML_UNKNOWN,
38 SC_HTML_CONV_FAILED,
39 SC_HTML_ERR,
40 SC_HTML_EOF,
41 SC_HTML_HREF_BEG
42 } SC_HTMLState;
44 typedef struct _SC_HTMLParser SC_HTMLParser;
45 typedef struct _SC_HTMLAttr SC_HTMLAttr;
46 typedef struct _SC_HTMLTag SC_HTMLTag;
48 struct _SC_HTMLParser
50 FILE *fp;
51 CodeConverter *conv;
53 GString *str;
54 GString *buf;
56 gchar *bufp;
58 SC_HTMLState state;
60 gchar *href;
62 gboolean newline;
63 gboolean empty_line;
64 gboolean space;
65 gboolean pre;
67 gint indent;
70 struct _SC_HTMLAttr
72 gchar *name;
73 gchar *value;
76 struct _SC_HTMLTag
78 gchar *name;
79 GList *attr;
82 SC_HTMLParser *sc_html_parser_new (FILE *fp,
83 CodeConverter *conv);
84 void sc_html_parser_destroy (SC_HTMLParser *parser);
85 gchar *sc_html_parse (SC_HTMLParser *parser);
87 #endif /* __HTML_H__ */