diff --git a/extensions/bingtranslate.cpp b/extensions/bingtranslate.cpp index ed3318a..f21f73c 100644 --- a/extensions/bingtranslate.cpp +++ b/extensions/bingtranslate.cpp @@ -85,7 +85,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved // This function detects language and puts it in translateFrom if it's empty std::wstring Translate(std::wstring text, std::wstring& translateFrom, std::wstring translateTo) { - static HINTERNET internet = NULL; + static std::atomic internet = NULL; if (!internet) internet = WinHttpOpen(L"Mozilla/5.0 Textractor", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, NULL, NULL, 0); char utf8[10000] = {}; @@ -156,6 +156,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) translation[i] = 0x200b; if (translation[i + 1] == L'r') translation[i + 1] = L'\r'; if (translation[i + 1] == L'n') translation[i + 1] = L'\n'; + if (translation[i + 1] == L't') translation[i + 1] = L'\t'; } } diff --git a/extensions/googletranslate.cpp b/extensions/googletranslate.cpp index 0fc1030..851c541 100644 --- a/extensions/googletranslate.cpp +++ b/extensions/googletranslate.cpp @@ -149,9 +149,9 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) } } - static HINTERNET internet = NULL; + static std::atomic internet = NULL; if (!internet) internet = WinHttpOpen(L"Mozilla/5.0 Textractor", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, NULL, NULL, 0); - static unsigned TKK = 0; + static std::atomic TKK = 0; std::wstring translation; if (internet) { @@ -202,6 +202,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) translation[i] = 0x200b; if (translation[i + 1] == L'r') translation[i + 1] = L'\r'; if (translation[i + 1] == L'n') translation[i + 1] = L'\n'; + if (translation[i + 1] == L't') translation[i + 1] = L'\t'; } } }