Coverity fixes
[claws.git] / src / matcher_parser_lex.l
index 53a3412fde683a83c0e7a60c1223472769bd1921..209e50373a714358821ffb5738bdb2ac0fe524b6 100644 (file)
@@ -1,11 +1,13 @@
+%option nounput never-interactive
+
 %{
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (c) 2001-2002 by Hiroyuki Yamamoto & The Sylpheed Claws Team.
+ * Copyright (c) 2001-2007 by Hiroyuki Yamamoto & The Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -14,8 +16,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 #include <string.h>
 #include "codeconv.h"
 #include "matcher.h"
 #include "matcher_parser_lex.h"
+
+#ifndef YYSTYPE
 #include "matcher_parser_parse.h"
+#endif
 
-#define MAX_STR_CONST 512
-#define YY_NO_UNPUT 1
+#define MAX_STR_CONST 8192
 
 static char string_buf[MAX_STR_CONST];
 static char *string_buf_ptr;
@@ -56,6 +60,8 @@ void matcher_parser_init(void)
 
 %%
                        
+"in"   return MATCHER_IN; 
+
                        /*
                         * a keyword consists of alpha and underscore 
                         * characters, possibly preceded by a tilde (~)
@@ -82,9 +88,9 @@ void matcher_parser_init(void)
                BEGIN(0);
                *string_buf_ptr = '\0';
                if (!g_utf8_validate(string_buf, -1, NULL)) {
-                       gchar *tmp = conv_codeset_strdup(string_buf, conv_get_current_charset_str(), CS_UTF_8);
+                       gchar *tmp = conv_codeset_strdup(string_buf, conv_get_locale_charset_str(), CS_INTERNAL);
                        if (tmp) {
-                               strcpy(string_buf, tmp);
+                               g_strlcpy(string_buf, tmp, sizeof(string_buf));
                                g_free(tmp);
                        }
                }
@@ -98,7 +104,7 @@ void matcher_parser_init(void)
 <string>.      {
                add_char(yytext[0]);
                }
-\[[^\[\]]*\]   {
+^\[.*\]$       {
                 /* for section name in configuration file */
                BEGIN(0);
                yylval.str = yytext + 1;
@@ -109,5 +115,17 @@ void matcher_parser_init(void)
                yylval.str = yytext;
                return MATCHER_INTEGER;
                }
+rulename       {
+               return MATCHER_RULENAME;
+               }
+disabled       {
+               return MATCHER_DISABLED;
+               }
+account        {
+               return MATCHER_ACCOUNT;
+               }
+enabled        {
+               return MATCHER_ENABLED;
+               }
 
 %%