Skip to content

Commit

Permalink
Rename members [skip-ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
lpugin committed Sep 10, 2024
1 parent 6b7f3ed commit f586435
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions include/vrv/toolkit.h
Original file line number Diff line number Diff line change
Expand Up @@ -825,13 +825,13 @@ class Toolkit {
* Temporary capture buffer for redirecting std::cerr to vrv::LogWarning.
* Used to coordinate between LogRedirectStart()/LogRedirectStop().
*/
std::stringstream m_captured_cerr;
std::stringstream m_cerrCaptured;

/**
* Temporary storage of the std::cerr read buffer during LogCapture. NULL when not in use.
* Used to coordinate between LogRedirectStart()/LogRedirectStop().
*/
std::streambuf *m_original_cerr_buf;
std::streambuf *m_cerrOriginalBuf;

EditorToolkit *m_editorToolkit;

Expand Down
26 changes: 13 additions & 13 deletions src/toolkit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Toolkit::Toolkit(bool initFont)
m_humdrumBuffer = NULL;
m_cString = NULL;

m_original_cerr_buf = NULL;
m_cerrOriginalBuf = NULL;

if (initFont) {
Resources &resources = m_doc.GetResourcesForModification();
Expand Down Expand Up @@ -1486,30 +1486,30 @@ void Toolkit::ResetLogBuffer()

void Toolkit::LogRedirectStart()
{
if (m_original_cerr_buf) {
if (m_cerrOriginalBuf) {
vrv::LogError("In Toolkit::LogRedirectStart: Only one log redirect can be active at a time.");
return;
}
if (!m_captured_cerr.str().empty()) {
if (!m_cerrCaptured.str().empty()) {
vrv::LogWarning("In Toolkit::LogRedirectStart: Log capture buffer not empty, sending current contents to "
"LogWarning and resetting.");
vrv::LogWarning(m_captured_cerr.str().c_str());
m_captured_cerr.str("");
vrv::LogWarning(m_cerrCaptured.str().c_str());
m_cerrCaptured.str("");
}
m_original_cerr_buf = std::cerr.rdbuf();
std::cerr.rdbuf(m_captured_cerr.rdbuf());
m_cerrOriginalBuf = std::cerr.rdbuf();
std::cerr.rdbuf(m_cerrCaptured.rdbuf());
}

void Toolkit::LogRedirectStop()
{
if (!m_captured_cerr.str().empty()) {
vrv::LogWarning(m_captured_cerr.str().c_str());
m_captured_cerr.str("");
if (!m_cerrCaptured.str().empty()) {
vrv::LogWarning(m_cerrCaptured.str().c_str());
m_cerrCaptured.str("");
}

if (m_original_cerr_buf) {
std::cerr.rdbuf(m_original_cerr_buf);
m_original_cerr_buf = NULL;
if (m_cerrOriginalBuf) {
std::cerr.rdbuf(m_cerrOriginalBuf);
m_cerrOriginalBuf = NULL;
}
}

Expand Down

0 comments on commit f586435

Please sign in to comment.