Skip to content

Commit 8943ddc

Browse files
committed
update
1 parent a18f5b7 commit 8943ddc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/portable.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ std::wstring GetCrCommandLine()
121121
if (IsCustomIniExist())
122122
{
123123
std::wstring IniPath = GetAppDir() + L"\\config.ini";
124-
std::vector<TCHAR> CommandLineBuffer(64); // 初始大小為 1024
124+
std::vector<TCHAR> CommandLineBuffer(64); // 初始大小為 64
125125
DWORD bytesRead = ::GetPrivateProfileStringW(L"General", L"CommandLine", L"", CommandLineBuffer.data(), CommandLineBuffer.size(), IniPath.c_str());
126126

127127
// 如果讀取的字符數接近緩衝區的大小,可能需要更大的緩衝區
128128
while (bytesRead >= CommandLineBuffer.size() - 1)
129129
{
130-
CommandLineBuffer.resize(CommandLineBuffer.size() * 2);
130+
CommandLineBuffer.resize(CommandLineBuffer.size() + 64);
131131
bytesRead = ::GetPrivateProfileStringW(L"General", L"CommandLine", L"", CommandLineBuffer.data(), CommandLineBuffer.size(), IniPath.c_str());
132132
}
133133

0 commit comments

Comments
 (0)