Refactor: replace C-style code with modern C++ idioms
This commit is contained in:
parent
554d62efcf
commit
15267632a1
@ -8,13 +8,13 @@
|
||||
#include "exec_sql.h"
|
||||
#include "funcs.h"
|
||||
#include "log.hpp"
|
||||
#include "receive_msg.h"
|
||||
#include "spy_types.h"
|
||||
#include "util.h"
|
||||
|
||||
using namespace std;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
extern bool gIsListeningPyq;
|
||||
extern QWORD g_WeChatWinDllAddr;
|
||||
|
||||
#define HEADER_PNG1 0x89
|
||||
@ -111,7 +111,6 @@ string DecryptImage(string src, string dir)
|
||||
|
||||
string dst = "";
|
||||
|
||||
try {
|
||||
if (dir.empty()) {
|
||||
dst = fs::path(src).replace_extension(ext).string();
|
||||
} else {
|
||||
@ -130,12 +129,6 @@ string DecryptImage(string src, string dir)
|
||||
}
|
||||
|
||||
replace(dst.begin(), dst.end(), '\\', '/');
|
||||
} catch (const std::exception &e) {
|
||||
LOG_ERROR(GB2312ToUtf8(e.what()));
|
||||
} catch (...) {
|
||||
LOG_ERROR("Unknow exception.");
|
||||
return "";
|
||||
}
|
||||
|
||||
ofstream out(dst.c_str(), ios::binary);
|
||||
if (!out.is_open()) {
|
||||
@ -178,7 +171,8 @@ static int GetNextPage(QWORD id)
|
||||
|
||||
int RefreshPyq(QWORD id)
|
||||
{
|
||||
if (!gIsListeningPyq) {
|
||||
auto &msgHandler = MessageHandler::getInstance();
|
||||
if (!msgHandler.isPyqListening()) {
|
||||
LOG_ERROR("没有启动朋友圈消息接收,参考:enable_receiving_msg");
|
||||
return -1;
|
||||
}
|
||||
@ -332,7 +326,6 @@ string GetPCMAudio(uint64_t id, string dir, int32_t sr)
|
||||
return pcmpath;
|
||||
}
|
||||
|
||||
|
||||
OcrResult_t GetOcrResult(string path)
|
||||
{
|
||||
OcrResult_t ret = { -1, "" };
|
||||
|
Loading…
Reference in New Issue
Block a user