diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index 63d8521c..e7cd1f3d 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit 63d8521c31bdae6656d9ff0f5d55883618f5eaf1 +Subproject commit e7cd1f3d1ec81014f92ab844915db60bb7e34bd5 diff --git a/server/FFmpegSource.cpp b/server/FFmpegSource.cpp index 8363950c..aa5ebcb3 100644 --- a/server/FFmpegSource.cpp +++ b/server/FFmpegSource.cpp @@ -343,7 +343,7 @@ void FFmpegSnap::makeSnap(const string &play_url, const string &save_path, float // FFmpeg进程退出了可以取消定时器了 delayTask->cancel(); // 执行回调函数 - bool success = process->exit_code() == 0 && File::fileSize(save_path.data()); - cb(success, (!success && !log_file.empty()) ? File::loadFile(log_file.data()) : ""); + bool success = process->exit_code() == 0 && File::fileSize(save_path); + cb(success, (!success && !log_file.empty()) ? File::loadFile(log_file) : ""); }); } diff --git a/server/Process.cpp b/server/Process.cpp index 140282d9..0f7bc14d 100644 --- a/server/Process.cpp +++ b/server/Process.cpp @@ -65,7 +65,7 @@ static int runChildProcess(string cmd, string log_file) { } //重定向shell日志至文件 - auto fp = File::create_file(log_file.data(), "ab"); + auto fp = File::create_file(log_file, "ab"); if (!fp) { fprintf(stderr, "open log file %s failed:%d(%s)\r\n", log_file.data(), get_uv_error(), get_uv_errmsg()); } else { @@ -121,7 +121,7 @@ void Process::run(const string &cmd, string log_file) { } //重定向shell日志至文件 - auto fp = File::create_file(log_file.data(), "ab"); + auto fp = File::create_file(log_file, "ab"); if (!fp) { fprintf(stderr, "open log file %s failed:%d(%s)\r\n", log_file.data(), get_uv_error(), get_uv_errmsg()); } else { diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 97f3bf00..6b069a8c 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -1547,7 +1547,7 @@ void installWebApi() { } val["path"] = record_path; if (!recording) { - val["code"] = File::delete_file(record_path.data()); + val["code"] = File::delete_file(record_path); return; } File::scanDir(record_path, [](const string &path, bool is_dir) { @@ -1555,7 +1555,7 @@ void installWebApi() { return true; } if (path.find("./") != std::string::npos) { - File::delete_file(path.data()); + File::delete_file(path); } else { TraceL << "Ignore tmp mp4 file: " << path; } @@ -1608,7 +1608,7 @@ void installWebApi() { static bool s_snap_success_once = false; StrCaseMap headerOut; GET_CONFIG(string, defaultSnap, API::kDefaultSnap); - if (!File::fileSize(snap_path.data())) { + if (!File::fileSize(snap_path)) { if (!err_msg.empty() && (!s_snap_success_once || defaultSnap.empty())) { //重来没截图成功过或者默认截图图片为空,那么直接返回FFmpeg错误日志 headerOut["Content-Type"] = HttpFileManager::getContentType(".txt"); @@ -1670,7 +1670,7 @@ void installWebApi() { if (!have_old_snap) { //无过期截图,生成一个空文件,目的是顺便创建文件夹路径 //同时防止在FFmpeg生成截图途中不停的尝试调用该api多次启动FFmpeg进程 - auto file = File::create_file(new_snap.data(), "wb"); + auto file = File::create_file(new_snap, "wb"); if (file) { fclose(file); } @@ -1681,10 +1681,10 @@ void installWebApi() { FFmpegSnap::makeSnap(allArgs["url"], new_snap_tmp, allArgs["timeout_sec"], [invoker, allArgs, new_snap, new_snap_tmp](bool success, const string &err_msg) { if (!success) { //生成截图失败,可能残留空文件 - File::delete_file(new_snap_tmp.data()); + File::delete_file(new_snap_tmp); } else { //临时文件改成正式文件 - File::delete_file(new_snap.data()); + File::delete_file(new_snap); rename(new_snap_tmp.data(), new_snap.data()); } responseSnap(new_snap, allArgs.getParser().getHeader(), invoker, err_msg); diff --git a/server/main.cpp b/server/main.cpp index 70b6348f..d79c78e5 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -263,7 +263,7 @@ int start_main(int argc,char *argv[]) { //加载配置文件,如果配置文件不存在就创建一个 loadIniConfig(g_ini_file.data()); - if (!File::is_dir(ssl_file.data())) { + if (!File::is_dir(ssl_file)) { //不是文件夹,加载证书,证书包含公钥和私钥 SSL_Initor::Instance().loadCertificate(ssl_file.data()); } else { diff --git a/src/Http/HttpDownloader.cpp b/src/Http/HttpDownloader.cpp index dcb67ff7..802a816a 100644 --- a/src/Http/HttpDownloader.cpp +++ b/src/Http/HttpDownloader.cpp @@ -25,7 +25,7 @@ void HttpDownloader::startDownload(const string &url, const string &file_path, b if (_file_path.empty()) { _file_path = exeDir() + "HttpDownloader/" + MD5(url).hexdigest(); } - _save_file = File::create_file(_file_path.data(), append ? "ab" : "wb"); + _save_file = File::create_file(_file_path, append ? "ab" : "wb"); if (!_save_file) { auto strErr = StrPrinter << "打开文件失败:" << file_path << endl; throw std::runtime_error(strErr); diff --git a/src/Http/HttpFileManager.cpp b/src/Http/HttpFileManager.cpp index 428abf85..697e554f 100644 --- a/src/Http/HttpFileManager.cpp +++ b/src/Http/HttpFileManager.cpp @@ -192,7 +192,7 @@ static bool makeFolderMenu(const string &httpPath, const string &strFullPath, st last_dir_name = split(strPathPrefix, "/").back(); } - if (!File::is_dir(strPathPrefix.data())) { + if (!File::is_dir(strPathPrefix)) { return false; } stringstream ss; @@ -250,7 +250,7 @@ static bool makeFolderMenu(const string &httpPath, const string &strFullPath, st int i = 0; for (auto &pr :file_map) { auto &strAbsolutePath = pr.second.second; - bool isDir = File::is_dir(strAbsolutePath.data()); + bool isDir = File::is_dir(strAbsolutePath); ss << "
  • " << i++ << "\t"; ss << "