improve data_reader_factory_create_reader

This commit is contained in:
lixianjing 2022-08-22 21:52:10 +08:00
parent a5d9453474
commit 1b4b953f2e
2 changed files with 6 additions and 0 deletions

View File

@ -1,4 +1,6 @@
# 最新动态 # 最新动态
2022/08/22
* 完善 data\_reader\_factory\_create\_reader处理Windows的盘符(感谢ufbycd提供补丁)。
2022/08/20 2022/08/20
* 支持gauge_pointer的默认指针的宽度跟随控件宽度改变而改变(感谢智明提供补丁) * 支持gauge_pointer的默认指针的宽度跟随控件宽度改变而改变(感谢智明提供补丁)

View File

@ -90,6 +90,10 @@ data_reader_t* data_reader_factory_create_reader(data_reader_factory_t* factory,
if (p != NULL) { if (p != NULL) {
return_value_if_fail((p - url) < TK_NAME_LEN, NULL); return_value_if_fail((p - url) < TK_NAME_LEN, NULL);
tk_strncpy(protocol, url, p - url); tk_strncpy(protocol, url, p - url);
if (tk_strlen(protocol) <= 1) {
/*是Windows下的盘符(如 D:/a/b/c.txt)*/
tk_strncpy(protocol, "file", 4);
}
} else { } else {
tk_strncpy(protocol, "file", 4); tk_strncpy(protocol, "file", 4);
} }