diff --git a/GUI/extenwindow.cpp b/GUI/extenwindow.cpp index 156a9a8..07e8d40 100644 --- a/GUI/extenwindow.cpp +++ b/GUI/extenwindow.cpp @@ -54,28 +54,27 @@ namespace } } -bool DispatchSentenceToExtensions(std::wstring& sentence, std::unordered_map miscInfo) +bool DispatchSentenceToExtensions(std::wstring& sentence, std::unordered_map miscInfo) { - bool success = true; wchar_t* sentenceBuffer = (wchar_t*)HeapAlloc(GetProcessHeap(), 0, (sentence.size() + 1) * sizeof(wchar_t)); wcscpy_s(sentenceBuffer, sentence.size() + 1, sentence.c_str()); InfoForExtension miscInfoLinkedList{ "", 0, nullptr }; InfoForExtension* miscInfoTraverser = &miscInfoLinkedList; - for (auto& i : miscInfo) miscInfoTraverser = miscInfoTraverser->next = new InfoForExtension{ i.first.c_str(), i.second, nullptr }; + for (auto[name, value] : miscInfo) miscInfoTraverser = miscInfoTraverser->next = new InfoForExtension{ name, value, nullptr }; std::shared_lock sharedLock(extenMutex); for (auto extenName : extenNames) { wchar_t* nextBuffer = extensions[extenName](sentenceBuffer, &miscInfoLinkedList); - if (nextBuffer == nullptr) { success = false; break; } if (nextBuffer != sentenceBuffer) HeapFree(GetProcessHeap(), 0, sentenceBuffer); + if (nextBuffer == nullptr) return false; sentenceBuffer = nextBuffer; } sentence = sentenceBuffer; HeapFree(GetProcessHeap(), 0, sentenceBuffer); - return success; + return true; } ExtenWindow::ExtenWindow(QWidget* parent) : diff --git a/GUI/extenwindow.h b/GUI/extenwindow.h index bc06ca6..f6fa898 100644 --- a/GUI/extenwindow.h +++ b/GUI/extenwindow.h @@ -7,7 +7,7 @@ namespace Ui class ExtenWindow; } -bool DispatchSentenceToExtensions(std::wstring& sentence, std::unordered_map miscInfo); +bool DispatchSentenceToExtensions(std::wstring& sentence, std::unordered_map miscInfo); class ExtenWindow : public QMainWindow { diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index c08ec2d..ff8f59e 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -169,7 +169,7 @@ DWORD MainWindow::GetSelectedProcessId() return ui->processCombo->currentText().split(":")[0].toULong(nullptr, 16); } -std::unordered_map MainWindow::GetMiscInfo(TextThread* thread) +std::unordered_map MainWindow::GetMiscInfo(TextThread* thread) { return { diff --git a/GUI/mainwindow.h b/GUI/mainwindow.h index 00f42f4..87a3017 100644 --- a/GUI/mainwindow.h +++ b/GUI/mainwindow.h @@ -24,7 +24,7 @@ private: QString TextThreadString(TextThread* thread); ThreadParam ParseTextThreadString(QString ttString); DWORD GetSelectedProcessId(); - std::unordered_map GetMiscInfo(TextThread* thread); + std::unordered_map GetMiscInfo(TextThread* thread); void AttachProcess(); void DetachProcess(); void AddHook();