- Timestamp:
- 02/01/15 01:10:22 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/param.cpp
r316 r320 982 982 int fields_loaded = 0; 983 983 const char *t, *lin, *end; 984 const char *equals_sign, * comma_sign;984 const char *equals_sign, *field_end, *next_field; 985 985 char remember; 986 986 const char *quote, *quote2; … … 997 997 { 998 998 // processing a single field 999 // "p:name=field_value, field_name=field_value , name=value..." 1000 // ^ ^-t (after) ^ ^_next_field 1001 // \_t (before) \_field_end 999 1002 while (strchr(" \n\r\t", *t)) if (t < end) t++; else return fields_loaded; 1000 1003 1001 comma_sign = strchrlimit(t, ',', end); if (!comma_sign) comma_sign = end; 1002 quote = strchrlimit(t, '\"', comma_sign); 1004 field_end = strchrlimit(t, ',', end); if (!field_end) field_end = end; 1005 next_field=field_end; 1006 while ((field_end>t) && strchr(" \t",field_end[-1])) field_end--; 1007 quote = strchrlimit(t, '\"', field_end); 1003 1008 if (quote) 1004 1009 { 1005 1010 quote2 = skipQuoteString(quote + 1, end); 1006 if (quote2 > comma_sign)1011 if (quote2 > field_end) 1007 1012 { 1008 comma_sign= strchrlimit(quote2 + 1, ',', end);1009 if (! comma_sign) comma_sign= end;1013 field_end = strchrlimit(quote2 + 1, ',', end); 1014 if (!field_end) next_field = field_end = end; 1010 1015 } 1011 1016 equals_sign = strchrlimit(t, '=', quote); … … 1013 1018 else 1014 1019 { 1015 equals_sign = strchrlimit(t, '=', comma_sign);1020 equals_sign = strchrlimit(t, '=', field_end); 1016 1021 quote2 = 0; 1017 1022 } 1018 1023 if (equals_sign == t) { t++; equals_sign = 0; } 1019 if ( comma_sign== t) // skip empty value1024 if (field_end == t) // skip empty value 1020 1025 { 1021 1026 t++; i++; … … 1054 1059 } 1055 1060 else 1056 if ( comma_sign < end) valstop = comma_sign; else valstop = end;1061 if (field_end < end) valstop = field_end; else valstop = end; 1057 1062 1058 1063 remember = *valstop; … … 1068 1073 if (i >= 0) i++; 1069 1074 #ifdef __CODEGUARD__ 1070 if ( comma_sign<end-1) t=comma_sign+1; else return fields_loaded;1075 if (next_field<end-1) t=next_field+1; else return fields_loaded; 1071 1076 #else 1072 t = comma_sign+ 1;1077 t = next_field + 1; 1073 1078 #endif 1074 1079 }
Note: See TracChangeset
for help on using the changeset viewer.