diff --git a/src/core/Database.cpp b/src/core/Database.cpp index e4fdae75b1..47c3b14493 100644 --- a/src/core/Database.cpp +++ b/src/core/Database.cpp @@ -37,7 +37,7 @@ #include #ifdef Q_OS_WIN -#include +#include #endif QHash> Database::s_uuidMap; @@ -338,7 +338,7 @@ bool Database::saveAs(const QString& filePath, SaveAction action, const QString& #ifdef Q_OS_WIN if (isHidden) { - SetFileAttributes(realFilePath.toStdString().c_str(), FILE_ATTRIBUTE_HIDDEN); + SetFileAttributes(static_cast(realFilePath.toStdString().c_str()), FILE_ATTRIBUTE_HIDDEN); } #endif m_ignoreFileChangesUntilSaved = false; diff --git a/src/keys/drivers/YubiKeyInterfacePCSC.cpp b/src/keys/drivers/YubiKeyInterfacePCSC.cpp index 10e4217e9a..792b635933 100644 --- a/src/keys/drivers/YubiKeyInterfacePCSC.cpp +++ b/src/keys/drivers/YubiKeyInterfacePCSC.cpp @@ -41,6 +41,11 @@ typedef unsigned long SCUINT; typedef long RETVAL; #endif +// LPWSTR is needs to be defined when compiling outside of Windows +#ifndef Q_OS_WIN +#define LPWSTR char * +#endif + // This namescape contains static wrappers for the smart card API // Which enable the communication with a Yubikey via PCSC ADPUs namespace @@ -107,7 +112,7 @@ namespace } char* mszReaders = new char[dwReaders + 2]; - rv = SCardListReaders(context, nullptr, mszReaders, &dwReaders); + rv = SCardListReaders(context, nullptr, static_cast(mszReaders), &dwReaders); if (rv == SCARD_S_SUCCESS) { char* readhead = mszReaders; // Names are separated by a null byte @@ -143,7 +148,7 @@ namespace uint8_t pbAtr[MAX_ATR_SIZE] = {0}; // ATR record SCUINT dwAtrLen = sizeof(pbAtr); // ATR record size - auto rv = SCardStatus(handle, pbReader, &dwReaderLen, &dwState, &dwProt, pbAtr, &dwAtrLen); + auto rv = SCardStatus(handle, static_cast(pbReader), &dwReaderLen, &dwState, &dwProt, pbAtr, &dwAtrLen); if (rv == SCARD_S_SUCCESS) { switch (dwProt) { case SCARD_PROTOCOL_T0: @@ -431,7 +436,7 @@ namespace SCARDHANDLE hCard; SCUINT dwActiveProtocol = SCARD_PROTOCOL_UNDEFINED; rv = SCardConnect(context, - reader_name.toStdString().c_str(), + static_cast(reader_name.toStdString().c_str()), SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, &hCard, @@ -446,7 +451,7 @@ namespace uint8_t pbAtr[MAX_ATR_SIZE] = {0}; SCUINT dwAtrLen = sizeof(pbAtr); - rv = SCardStatus(hCard, pbReader, &dwReaderLen, &dwState, &dwProt, pbAtr, &dwAtrLen); + rv = SCardStatus(hCard, static_cast(pbReader), &dwReaderLen, &dwState, &dwProt, pbAtr, &dwAtrLen); if (rv == SCARD_S_SUCCESS && (dwProt == SCARD_PROTOCOL_T0 || dwProt == SCARD_PROTOCOL_T1)) { // Find which AID to use SCardAID satr; @@ -568,7 +573,7 @@ YubiKey::KeyMap YubiKeyInterfacePCSC::findValidKeys(int& connectedKeys) SCARDHANDLE hCard; SCUINT dwActiveProtocol = SCARD_PROTOCOL_UNDEFINED; auto rv = SCardConnect(m_sc_context, - reader_name.toStdString().c_str(), + static_cast(reader_name.toStdString().c_str()), SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, &hCard, @@ -589,7 +594,7 @@ YubiKey::KeyMap YubiKeyInterfacePCSC::findValidKeys(int& connectedKeys) uint8_t pbAtr[MAX_ATR_SIZE] = {0}; SCUINT dwAtrLen = sizeof(pbAtr); - rv = SCardStatus(hCard, pbReader, &dwReaderLen, &dwState, &dwProt, pbAtr, &dwAtrLen); + rv = SCardStatus(hCard, static_cast(pbReader), &dwReaderLen, &dwState, &dwProt, pbAtr, &dwAtrLen); if (rv != SCARD_S_SUCCESS || (dwProt != SCARD_PROTOCOL_T0 && dwProt != SCARD_PROTOCOL_T1)) { // Could not read the ATR record or the protocol is not supported continue;