Skip to content

Commit

Permalink
gh-1293: LastError was erased on printf.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximus5 committed Oct 25, 2017
1 parent 9d9c6d5 commit 6ce5d09
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/ConEmuHk/Ansi.cpp
Expand Up @@ -3831,6 +3831,8 @@ void CEAnsi::StorePromptBegin()
//static
CEAnsi* CEAnsi::Object(bool bForceCreate /*= false*/)
{
CLastErrorGuard errGuard;

if (!AnsiTlsIndex)
{
AnsiTlsIndex = TlsAlloc();
Expand Down
3 changes: 3 additions & 0 deletions src/common/HandleKeeper.cpp
Expand Up @@ -30,6 +30,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <windows.h>
#include "HandleKeeper.h"
#include "WErrGuard.h"

#ifdef _DEBUG
#include "MStrDup.h"
Expand Down Expand Up @@ -280,6 +281,8 @@ bool HandleKeeper::AllocHandleInfo(HANDLE h, HandleSource source, DWORD access,

bool HandleKeeper::QueryHandleInfo(HANDLE h, HandleInformation& Info, bool AnsiOutExpected)
{
CLastErrorGuard errGuard;

if (!h || (h == INVALID_HANDLE_VALUE))
return false;
bool bFound = false;
Expand Down
5 changes: 4 additions & 1 deletion src/common/WCodePage.cpp
Expand Up @@ -30,6 +30,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define HIDE_USE_EXCEPTION_INFO
#include "Common.h"
#include "WCodePage.h"
#include "WErrGuard.h"

void CpCvt::ResetBuffer()
{
Expand All @@ -38,6 +39,8 @@ void CpCvt::ResetBuffer()

CpCvtResult CpCvt::SetCP(UINT anCP)
{
CLastErrorGuard errGuard;

if (bInitialized && (nCP == anCP))
return ccr_OK;

Expand Down Expand Up @@ -93,7 +96,7 @@ CpCvtResult CpCvt::Convert(char c, wchar_t& wc)
}
goto wrap;
}

// Continuation byte (10xxxxxx)?
if (blen && ((bt & 0xC0/*11xxxxxx*/) != 0x80/*10xxxxxx*/))
{
Expand Down

0 comments on commit 6ce5d09

Please sign in to comment.