diff --git a/extensions/bingtranslate.cpp b/extensions/bingtranslate.cpp index 04691fb..a073fa5 100644 --- a/extensions/bingtranslate.cpp +++ b/extensions/bingtranslate.cpp @@ -130,7 +130,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) TEST( { std::wstring test = L"こんにちは"; - ProcessSentence(test, SentenceInfo{ SentenceInfo::DUMMY }); + ProcessSentence(test, { SentenceInfo::DUMMY }); assert(test.find(L"Hello") != std::wstring::npos); } ); diff --git a/extensions/googletranslate.cpp b/extensions/googletranslate.cpp index 384a3bd..90d1368 100644 --- a/extensions/googletranslate.cpp +++ b/extensions/googletranslate.cpp @@ -166,7 +166,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) TEST( { std::wstring test = L"こんにちは"; - ProcessSentence(test, SentenceInfo{ SentenceInfo::DUMMY }); + ProcessSentence(test, { SentenceInfo::DUMMY }); assert(test.find(L"Hello") != std::wstring::npos); } ); diff --git a/extensions/network.h b/extensions/network.h index 3131e91..d47b53f 100644 --- a/extensions/network.h +++ b/extensions/network.h @@ -5,7 +5,7 @@ using InternetHandle = AutoHandle>; -std::optional ReceiveHttpRequest(HINTERNET request) +inline std::optional ReceiveHttpRequest(HINTERNET request) { WinHttpReceiveResponse(request, NULL); std::string data; @@ -17,14 +17,14 @@ std::optional ReceiveHttpRequest(HINTERNET request) if (!dwSize) break; std::vector buffer(dwSize); WinHttpReadData(request, buffer.data(), dwSize, &dwDownloaded); - data += std::string(buffer.data(), dwDownloaded); + data.append(buffer.data(), dwDownloaded); } while (dwSize > 0); if (data.empty()) return {}; return StringToWideString(data); } -void Escape(std::wstring& text) +inline void Escape(std::wstring& text) { for (int i = 0; i < text.size(); ++i) { diff --git a/extensions/removerepeat.cpp b/extensions/removerepeat.cpp index 3a66393..691bcc9 100644 --- a/extensions/removerepeat.cpp +++ b/extensions/removerepeat.cpp @@ -61,11 +61,10 @@ TEST( RemoveCyclicRepeats(cyclicRepeats); assert(cyclicRepeats == L"abcdefg"); - InfoForExtension tester{ "hook address", 0 }; std::wstring empty = L"", one = L" ", normal = L"This is a normal sentence. はい"; - ProcessSentence(empty, { &tester }); - ProcessSentence(one, { &tester }); - ProcessSentence(normal, { &tester }); + ProcessSentence(empty, { SentenceInfo::DUMMY }); + ProcessSentence(one, { SentenceInfo::DUMMY }); + ProcessSentence(normal, { SentenceInfo::DUMMY }); assert(empty == L"" && one == L" " && normal == L"This is a normal sentence. はい"); } );