diff options
author | JP Rosevear <jpr@ximian.com> | 2001-07-24 07:30:11 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-07-24 07:30:11 +0800 |
commit | dc4f47979dcb1ad8256c3077dcc574451dfde78f (patch) | |
tree | c31995148d37bb294ac38aa0276af2f42ff428ff | |
parent | 80f0e611999c79fdf9a60df9b3990bf0e0c8365d (diff) | |
download | gsoc2013-evolution-dc4f47979dcb1ad8256c3077dcc574451dfde78f.tar gsoc2013-evolution-dc4f47979dcb1ad8256c3077dcc574451dfde78f.tar.gz gsoc2013-evolution-dc4f47979dcb1ad8256c3077dcc574451dfde78f.tar.bz2 gsoc2013-evolution-dc4f47979dcb1ad8256c3077dcc574451dfde78f.tar.lz gsoc2013-evolution-dc4f47979dcb1ad8256c3077dcc574451dfde78f.tar.xz gsoc2013-evolution-dc4f47979dcb1ad8256c3077dcc574451dfde78f.tar.zst gsoc2013-evolution-dc4f47979dcb1ad8256c3077dcc574451dfde78f.zip |
pass extra param to icalparser_get_next_char (icalparser_get_next_char):
2001-07-23 JP Rosevear <jpr@ximian.com>
* src/libical/icalparser.c: pass extra param to
icalparser_get_next_char
(icalparser_get_next_char): only use quote mode if the flag is set
svn path=/trunk/; revision=11326
-rw-r--r-- | libical/ChangeLog | 6 | ||||
-rw-r--r-- | libical/src/libical/icalparser.c | 63 |
2 files changed, 43 insertions, 26 deletions
diff --git a/libical/ChangeLog b/libical/ChangeLog index 9516737cfb..f26bdb1448 100644 --- a/libical/ChangeLog +++ b/libical/ChangeLog @@ -1,3 +1,9 @@ +2001-07-23 JP Rosevear <jpr@ximian.com> + + * src/libical/icalparser.c: pass extra param to + icalparser_get_next_char + (icalparser_get_next_char): only use quote mode if the flag is set + 2001-07-23 Damon Chaplin <damon@ximian.com> * src/libical/icaltime.c (icaltime_day_of_year): changed so it doesn't diff --git a/libical/src/libical/icalparser.c b/libical/src/libical/icalparser.c index 7cd2929788..4a389540f0 100644 --- a/libical/src/libical/icalparser.c +++ b/libical/src/libical/icalparser.c @@ -1,4 +1,4 @@ -/* -*- Mode: C -*- +/* -*- Mode: C; tab-width: 4; c-basic-offset: 8; -*- ====================================================================== FILE: icalparser.c CREATOR: eric 04 August 1999 @@ -57,7 +57,7 @@ extern icalvalue* icalparser_yy_value; void set_parser_value_state(icalvalue_kind kind); int ical_yyparse(void); -char* icalparser_get_next_char(char c, char *str); +char* icalparser_get_next_char(char c, char *str, int qm); char* icalparser_get_next_parameter(char* line,char** end); char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind); char* icalparser_get_prop_name(char* line, char** end); @@ -141,28 +141,28 @@ icalvalue* icalvalue_new_From_string_with_error(icalvalue_kind kind, -char* icalparser_get_next_char(char c, char *str) +char* icalparser_get_next_char(char c, char *str, int qm) { int quote_mode = 0; char* p; for(p=str; *p!=0; p++){ - - if ( quote_mode == 0 && *p=='"' && *(p-1) != '\\' ){ - quote_mode =1; - continue; - } - - if ( quote_mode == 1 && *p=='"' && *(p-1) != '\\' ){ - quote_mode =0; - continue; - } - - if (quote_mode == 0 && *p== c && *(p-1) != '\\' ){ - return p; - } - + if (qm == 1) { + if ( quote_mode == 0 && *p=='"' && *(p-1) != '\\' ){ + quote_mode =1; + continue; + } + + if ( quote_mode == 1 && *p=='"' && *(p-1) != '\\' ){ + quote_mode =0; + continue; + } + } + + if (quote_mode == 0 && *p== c && *(p-1) != '\\' ){ + return p; + } } return 0; @@ -243,8 +243,8 @@ char* icalparser_get_prop_name(char* line, char** end) char* v; char *str; - p = icalparser_get_next_char(';',line); - v = icalparser_get_next_char(':',line); + p = icalparser_get_next_char(';',line,1); + v = icalparser_get_next_char(':',line,1); if (p== 0 && v == 0) { return 0; } @@ -266,9 +266,10 @@ char* icalparser_get_param_name(char* line, char **end) { char* next; + char* quote; char *str; - next = icalparser_get_next_char('=',line); + next = icalparser_get_next_char('=',line,1); if (next == 0) { return 0; @@ -276,6 +277,16 @@ char* icalparser_get_param_name(char* line, char **end) str = make_segment(line,next); *end = next+1; + if (**end == '"') { + *end = *end+1; + next = icalparser_get_next_char('"',*end,0); + if (next == 0) { + return 0; + } + + *end = make_segment(*end,next); + } + return str; } @@ -286,7 +297,7 @@ char* icalparser_get_next_paramvalue(char* line, char **end) char* next; char *str; - next = icalparser_get_next_char(',',line); + next = icalparser_get_next_char(',',line,1); if (next == 0){ next = (char*)(size_t)line+(size_t)strlen(line);\ @@ -318,7 +329,7 @@ char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind) p = line; while(1){ - next = icalparser_get_next_char(',',p); + next = icalparser_get_next_char(',',p,1); /* Unforunately, RFC2445 says that for the RECUR value, COMMA can both seperate digits in a list, and it can seperate @@ -379,14 +390,14 @@ char* icalparser_get_next_parameter(char* line,char** end) char *v; char *str; - v = icalparser_get_next_char(':',line); - next = icalparser_get_next_char(';', line); + v = icalparser_get_next_char(':',line,1); + next = icalparser_get_next_char(';', line,1); /* There is no ';' or, it is after the ':' that marks the beginning of the value */ if (next == 0 || next > v) { - next = icalparser_get_next_char(':', line); + next = icalparser_get_next_char(':', line,1); } if (next != 0) { |