Fix compilation on Windows with /DUNICODE

pull/397/head
RaptorFactor 2017-03-25 23:08:10 -07:00
parent 59a45c52dc
commit 9b1d4c4c7d
4 changed files with 13 additions and 13 deletions

View File

@ -129,7 +129,7 @@ static void SetNewAndDeleteFunctionPointers()
return;
}
OutputDebugString("Crypto++ DLL was not able to obtain new and delete function pointers.\n");
OutputDebugStringA("Crypto++ DLL was not able to obtain new and delete function pointers.\n");
throw 0;
}

View File

@ -328,21 +328,21 @@ bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModule
{
std::ostringstream oss;
oss << "Crypto++ DLL loaded at base address 0x" << std::hex << h << ".\n";
OutputDebugString(oss.str().c_str());
OutputDebugStringA(oss.str().c_str());
}
else
{
std::ostringstream oss;
oss << "Crypto++ DLL integrity check may fail. Expected module base address is 0x";
oss << std::hex << g_BaseAddressOfMAC << ", but module loaded at 0x" << h << ".\n";
OutputDebugString(oss.str().c_str());
OutputDebugStringA(oss.str().c_str());
}
#endif
if (!moduleStream)
{
#ifdef CRYPTOPP_WIN32_AVAILABLE
OutputDebugString("Crypto++ DLL integrity check failed. Cannot open file for reading.");
OutputDebugStringA("Crypto++ DLL integrity check failed. Cannot open file for reading.");
#endif
return false;
}
@ -436,7 +436,7 @@ bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModule
// hash from disk instead
if (!VerifyBufsEqual(expectedModuleMac, actualMac, macSize))
{
OutputDebugString("Crypto++ DLL in-memory integrity check failed. This may be caused by debug breakpoints or DLL relocation.\n");
OutputDebugStringA("Crypto++ DLL in-memory integrity check failed. This may be caused by debug breakpoints or DLL relocation.\n");
moduleStream.clear();
moduleStream.seekg(0);
verifier.Initialize(MakeParameters(Name::OutputBuffer(), ByteArrayParameter(actualMac, (unsigned int)actualMac.size())));
@ -455,7 +455,7 @@ bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModule
#ifdef CRYPTOPP_WIN32_AVAILABLE
std::string hexMac;
HexEncoder(new StringSink(hexMac)).PutMessageEnd(actualMac, actualMac.size());
OutputDebugString((("Crypto++ DLL integrity check failed. Actual MAC is: " + hexMac) + ".\n").c_str());
OutputDebugStringA((("Crypto++ DLL integrity check failed. Actual MAC is: " + hexMac) + ".\n").c_str());
#endif
return false;
}

View File

@ -287,7 +287,7 @@ size_t NetworkSource::DoPump(lword &byteCount, bool blockingOutput, unsigned lon
unsigned int recvResult = receiver.GetReceiveResult();
#if CRYPTOPP_TRACE_NETWORK
OutputDebugString((IntToString((unsigned int)this) + ": Received " + IntToString(recvResult) + " bytes\n").c_str());
OutputDebugStringA((IntToString((unsigned int)this) + ": Received " + IntToString(recvResult) + " bytes\n").c_str());
#endif
m_dataEnd += recvResult;
m_waitingForResult = false;
@ -315,13 +315,13 @@ ReceiveNoWait:
// call Receive repeatedly as long as data is immediately available,
// because some receivers tend to return data in small pieces
#if CRYPTOPP_TRACE_NETWORK
OutputDebugString((IntToString((unsigned int)this) + ": Receiving " + IntToString(m_buf.size()-m_dataEnd) + " bytes\n").c_str());
OutputDebugStringA((IntToString((unsigned int)this) + ": Receiving " + IntToString(m_buf.size()-m_dataEnd) + " bytes\n").c_str());
#endif
while (receiver.Receive(m_buf+m_dataEnd, m_buf.size()-m_dataEnd))
{
unsigned int recvResult = receiver.GetReceiveResult();
#if CRYPTOPP_TRACE_NETWORK
OutputDebugString((IntToString((unsigned int)this) + ": Received " + IntToString(recvResult) + " bytes\n").c_str());
OutputDebugStringA((IntToString((unsigned int)this) + ": Received " + IntToString(recvResult) + " bytes\n").c_str());
#endif
m_dataEnd += recvResult;
if (receiver.EofReceived() || m_dataEnd > m_buf.size() /2)
@ -391,7 +391,7 @@ float NetworkSink::ComputeCurrentSpeed()
m_maxObservedSpeed = STDMAX(m_currentSpeed, m_maxObservedSpeed * 0.98f);
m_byteCountSinceLastTimerReset = 0;
m_speedTimer.StartTimer();
// OutputDebugString(("max speed: " + IntToString((int)m_maxObservedSpeed) + " current speed: " + IntToString((int)m_currentSpeed) + "\n").c_str());
// OutputDebugStringA(("max speed: " + IntToString((int)m_maxObservedSpeed) + " current speed: " + IntToString((int)m_currentSpeed) + "\n").c_str());
}
return m_currentSpeed;
}
@ -497,7 +497,7 @@ lword NetworkSink::DoFlush(unsigned long maxTime, size_t targetSize)
unsigned int sendResult = sender.GetSendResult();
#if CRYPTOPP_TRACE_NETWORK
OutputDebugString((IntToString((unsigned int)this) + ": Sent " + IntToString(sendResult) + " bytes\n").c_str());
OutputDebugStringA((IntToString((unsigned int)this) + ": Sent " + IntToString(sendResult) + " bytes\n").c_str());
#endif
m_buffer.Skip(sendResult);
totalFlushSize += sendResult;
@ -515,7 +515,7 @@ lword NetworkSink::DoFlush(unsigned long maxTime, size_t targetSize)
const byte *block = m_buffer.Spy(contiguousSize);
#if CRYPTOPP_TRACE_NETWORK
OutputDebugString((IntToString((unsigned int)this) + ": Sending " + IntToString(contiguousSize) + " bytes\n").c_str());
OutputDebugStringA((IntToString((unsigned int)this) + ": Sending " + IntToString(contiguousSize) + " bytes\n").c_str());
#endif
sender.Send(block, contiguousSize);
m_needSendResult = true;

View File

@ -373,7 +373,7 @@ bool WaitObjectContainer::Wait(unsigned long milliseconds)
if (milliseconds > 0)
{
unsigned long timeAfterWait = t.ElapsedTime();
OutputDebugString(("Handles " + IntToString(m_handles.size()) + ", Woke up by " + IntToString(result-WAIT_OBJECT_0) + ", Busied for " + IntToString(timeBeforeWait-lastTime) + " us, Waited for " + IntToString(timeAfterWait-timeBeforeWait) + " us, max " + IntToString(milliseconds) + "ms\n").c_str());
OutputDebugStringA(("Handles " + IntToString(m_handles.size()) + ", Woke up by " + IntToString(result-WAIT_OBJECT_0) + ", Busied for " + IntToString(timeBeforeWait-lastTime) + " us, Waited for " + IntToString(timeAfterWait-timeBeforeWait) + " us, max " + IntToString(milliseconds) + "ms\n").c_str());
lastTime = timeAfterWait;
}
#endif