fix: 修复JSON导入、备份目录创建和内存安全等问题

修复JSON导入时转义字符处理不完整的问题,添加对\b、\f等控制字符的转义
改进备份目录创建逻辑,使用SHCreateDirectoryExW递归创建目录
修复内存分配失败处理,避免空指针解引用
修正选项卡标题设置位置,从Dialog改为Tabs控件
增强导入功能,支持TXT文件导入时选择目标变量类型
优化清理无效路径算法,使用标记数组减少内存移动
修复宽字符环境变量设置,使用_wputenv_s替代putenv
添加导入数据初始化,防止未初始化内存访问
改进文件属性检查,使用宽字符API支持Unicode路径
This commit is contained in:
2026-04-28 22:21:06 +08:00
parent 7908bad1f4
commit e777b26879
11 changed files with 257 additions and 157 deletions
+4 -1
View File
@@ -3,6 +3,7 @@
#include "core/app_context.h"
#include "core/lua_config.h"
#include "utils/string_ext.h"
#include "utils/safe_string.h"
#include "utils/ui_constants.h"
#include "ui/ui_utils.h"
#include <string.h>
@@ -55,7 +56,9 @@ int list_dropfiles_cb(Ihandle *self, const char *filename, int num, int x, int y
else
return IUP_DEFAULT;
DWORD attr = GetFileAttributesA(filename);
wchar_t *wfilename = utf8_to_wide(filename);
DWORD attr = wfilename ? GetFileAttributesW(wfilename) : INVALID_FILE_ATTRIBUTES;
free(wfilename);
if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
{
Ihandle *txt_search = IupGetDialogChild(dlg, CTRL_TXT_SEARCH);