From 6ebeb727b1c3972fa16d5a7f9040e55162340722 Mon Sep 17 00:00:00 2001 From: lixianjing Date: Wed, 6 Dec 2023 09:59:15 +0800 Subject: [PATCH] improve csv --- docs/changes.md | 2 ++ src/csv/csv_file_object.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/changes.md b/docs/changes.md index 2f29d0f17f..ed65ef53c5 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -2,6 +2,8 @@ 2023/12/06 * fscript 增加 date\_time\_format + * 完善 fscript,先找全局函数,再找用户自定义的函数。 + * 完善 csv 路径解析。 2023/12/05 * 完善fscript部分数学函数。 diff --git a/src/csv/csv_file_object.c b/src/csv/csv_file_object.c index 02f6d4d991..c4aaa33460 100644 --- a/src/csv/csv_file_object.c +++ b/src/csv/csv_file_object.c @@ -68,10 +68,12 @@ static ret_t csv_path_parse(csv_path_t* path, csv_file_t* csv, const char* name) } if (*p == '[') { + return_value_if_fail(tk_isdigit(p[1]), RET_BAD_PARAMS); path->col = tk_atoi(p + 1); } else { path->col = csv_file_get_col_of_name(csv, p); if (path->col < 0) { + return_value_if_fail(tk_isdigit(p[0]), RET_BAD_PARAMS); path->col = tk_atoi(p); } }