fix issues reported by compiling windows code with clang-tidy

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2023-02-21 22:14:22 +01:00
parent c895359e6b
commit c0549c5c03
No known key found for this signature in database
GPG Key ID: 7D0F74F05C22F553
23 changed files with 73 additions and 71 deletions

View File

@ -43,7 +43,7 @@ IFACEMETHODIMP NCContextMenu::QueryInterface(REFIID riid, void **ppv)
{
QITABENT(NCContextMenu, IContextMenu),
QITABENT(NCContextMenu, IShellExtInit),
{ 0 },
{ nullptr },
};
return QISearch(this, qit, riid, ppv);
}
@ -85,7 +85,7 @@ IFACEMETHODIMP NCContextMenu::Initialize(
if (SUCCEEDED(pDataObj->GetData(&fe, &stm))) {
// Get an HDROP handle.
HDROP hDrop = static_cast<HDROP>(GlobalLock(stm.hGlobal));
const auto hDrop = static_cast<HDROP>(GlobalLock(stm.hGlobal));
if (hDrop) {
UINT nFiles = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0);
for (UINT i = 0; i < nFiles; ++i) {

View File

@ -37,7 +37,7 @@ NCContextMenuFactory::~NCContextMenuFactory()
IFACEMETHODIMP NCContextMenuFactory::QueryInterface(REFIID riid, void **ppv)
{
static const QITAB qit[] = { QITABENT(NCContextMenuFactory, IClassFactory), { 0 }, };
static const QITAB qit[] = { QITABENT(NCContextMenuFactory, IClassFactory), { nullptr }, };
return QISearch(this, qit, riid, ppv);
}
@ -67,7 +67,7 @@ IFACEMETHODIMP NCContextMenuFactory::CreateInstance(IUnknown *pUnkOuter, REFIID
hr = E_OUTOFMEMORY;
// Create the COM component.
NCContextMenu *pExt = new (std::nothrow) NCContextMenu();
auto pExt = new (std::nothrow) NCContextMenu();
if (pExt) {
// Query the specified interface.
hr = pExt->QueryInterface(riid, ppv);

View File

@ -21,7 +21,7 @@ namespace {
HRESULT SetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PCWSTR pszData)
{
HRESULT hr;
HRESULT hr = 0;
HKEY hKey = nullptr;
// Creates the specified registry key. If the key already exists, the
@ -31,8 +31,8 @@ HRESULT SetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PCWSTR
if (SUCCEEDED(hr))
{
DWORD cbData;
const BYTE * lpData;
DWORD cbData = 0;
const BYTE * lpData = nullptr;
if (pszData)
{
@ -43,7 +43,7 @@ HRESULT SetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PCWSTR
else
{
cbData = 0;
lpData = NULL;
lpData = nullptr;
}
hr = HRESULT_FROM_WIN32(RegSetValueEx(hKey, pszValueName, 0,
@ -57,7 +57,7 @@ HRESULT SetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PCWSTR
HRESULT GetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PWSTR pszData, DWORD cbData)
{
HRESULT hr;
HRESULT hr = 0;
HKEY hKey = nullptr;
// Try to open the specified registry key.
@ -85,7 +85,7 @@ HRESULT NCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CL
return E_INVALIDARG;
}
HRESULT hr;
HRESULT hr = 0;
wchar_t szCLSID[MAX_PATH];
StringFromGUID2(clsid, szCLSID, ARRAYSIZE(szCLSID));
@ -100,7 +100,7 @@ HRESULT NCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CL
// Create the HKCR\CLSID\{<CLSID>}\ContextMenuOptIn subkey.
if (SUCCEEDED(hr)) {
hr = SetHKCRRegistryKeyAndValue(szSubkey, L"ContextMenuOptIn", NULL);
hr = SetHKCRRegistryKeyAndValue(szSubkey, L"ContextMenuOptIn", nullptr);
}
// Create the HKCR\CLSID\{<CLSID>}\InprocServer32 key.
@ -154,7 +154,7 @@ HRESULT NCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
return E_INVALIDARG;
}
HRESULT hr;
HRESULT hr = 0;
wchar_t szCLSID[MAX_PATH];
StringFromGUID2(clsid, szCLSID, ARRAYSIZE(szCLSID));
@ -198,7 +198,7 @@ HRESULT NCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(
return E_INVALIDARG;
}
HRESULT hr;
HRESULT hr = 0;
wchar_t szSubkey[MAX_PATH];

View File

@ -41,7 +41,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
{
HRESULT hr;
HRESULT hr = 0;
GUID guid;
hr = CLSIDFromString(CONTEXT_MENU_GUID, (LPCLSID)&guid);
@ -54,7 +54,7 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
if (IsEqualCLSID(guid, rclsid)) {
hr = E_OUTOFMEMORY;
NCContextMenuFactory *pClassFactory = new NCContextMenuFactory();
auto pClassFactory = new NCContextMenuFactory();
if (pClassFactory) {
hr = pClassFactory->QueryInterface(riid, ppv);
pClassFactory->Release();
@ -71,7 +71,7 @@ STDAPI DllCanUnloadNow(void)
STDAPI DllRegisterServer(void)
{
HRESULT hr;
HRESULT hr = 0;
GUID guid;
hr = CLSIDFromString(CONTEXT_MENU_GUID, (LPCLSID)&guid);

View File

@ -41,7 +41,7 @@ HRESULT CreateFactory(REFIID riid, void **ppv, int state)
{
HRESULT hResult = E_OUTOFMEMORY;
NCOverlayFactory* ncOverlayFactory = new NCOverlayFactory(state);
auto ncOverlayFactory = new NCOverlayFactory(state);
if (ncOverlayFactory) {
hResult = ncOverlayFactory->QueryInterface(riid, ppv);

View File

@ -74,7 +74,7 @@ IFACEMETHODIMP NCOverlayFactory::CreateInstance(
if (pUnkOuter) { return hResult; }
hResult = E_OUTOFMEMORY;
NCOverlay *lrOverlay = new (std::nothrow) NCOverlay(_state);
auto lrOverlay = new (std::nothrow) NCOverlay(_state);
if (!lrOverlay) { return hResult; }
hResult = lrOverlay->QueryInterface(riid, ppv);

View File

@ -31,7 +31,7 @@ using namespace std;
HRESULT NCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PCWSTR friendlyName)
{
HRESULT hResult;
HRESULT hResult = 0;
HKEY shellOverlayKey = nullptr;
// the key may not exist yet
hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(HKEY_LOCAL_MACHINE, REGISTRY_OVERLAY_KEY, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &shellOverlayKey, nullptr));
@ -62,7 +62,7 @@ HRESULT NCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PC
HRESULT NCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName)
{
HRESULT hResult;
HRESULT hResult = 0;
HKEY shellOverlayKey = nullptr;
hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGISTRY_OVERLAY_KEY, 0, KEY_WRITE, &shellOverlayKey));
@ -87,7 +87,7 @@ HRESULT NCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWST
wchar_t stringCLSID[MAX_PATH];
StringFromGUID2(clsid, stringCLSID, ARRAYSIZE(stringCLSID));
HRESULT hResult;
HRESULT hResult = 0;
HKEY hKey = nullptr;
hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CLASSES_ROOT, REGISTRY_CLSID, 0, KEY_WRITE, &hKey));
@ -139,7 +139,7 @@ HRESULT NCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid)
wchar_t stringCLSID[MAX_PATH];
StringFromGUID2(clsid, stringCLSID, ARRAYSIZE(stringCLSID));
HRESULT hResult;
HRESULT hResult = 0;
HKEY hKey = nullptr;
hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CLASSES_ROOT, REGISTRY_CLSID, 0, DELETE, &hKey));
if (!SUCCEEDED(hResult)) {

View File

@ -118,11 +118,11 @@ bool CommunicationSocket::ReadLine(wstring* response)
return true;
}
std::array<char, 128> resp_utf8;
std::array<char, 128> resp_utf8 = {};
DWORD numBytesRead = 0;
DWORD totalBytesAvailable = 0;
if (!PeekNamedPipe(_pipe, nullptr, 0, 0, &totalBytesAvailable, 0)) {
if (!PeekNamedPipe(_pipe, nullptr, 0, nullptr, &totalBytesAvailable, nullptr)) {
Close();
return false;
}

View File

@ -42,7 +42,7 @@ public:
private:
HANDLE _pipe;
std::vector<char> _buffer;
bool _connected;
bool _connected = false;
};
#endif

View File

@ -74,8 +74,8 @@ QtLockedFile::QtLockedFile()
: QFile()
{
#ifdef Q_OS_WIN
m_semaphore_hnd = 0;
m_mutex_hnd = 0;
m_semaphore_hnd = nullptr;
m_mutex_hnd = nullptr;
#endif
m_lock_mode = NoLock;
}
@ -90,8 +90,8 @@ QtLockedFile::QtLockedFile(const QString &name)
: QFile(name)
{
#ifdef Q_OS_WIN
m_semaphore_hnd = 0;
m_mutex_hnd = 0;
m_semaphore_hnd = nullptr;
m_mutex_hnd = nullptr;
#endif
m_lock_mode = NoLock;
}

View File

@ -41,12 +41,12 @@ namespace SharedTools {
static QString errorCodeToString(DWORD errorCode)
{
QString result;
char *data = 0;
char *data = nullptr;
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
0, errorCode, 0,
(char*)&data, 0, 0);
nullptr, errorCode, 0,
(char*)&data, 0, nullptr);
result = QString::fromLocal8Bit(data);
if (data != 0)
if (data != nullptr)
LocalFree(data);
if (result.endsWith(QLatin1Char('\n')))
@ -68,15 +68,15 @@ bool QtLockedFile::lock(LockMode mode, bool block)
if (m_lock_mode != 0)
unlock();
if (m_semaphore_hnd == 0) {
if (m_semaphore_hnd == nullptr) {
QFileInfo fi(*this);
QString sem_name = QString::fromLatin1(SEMAPHORE_PREFIX)
+ fi.absoluteFilePath().toLower();
m_semaphore_hnd = CreateSemaphoreW(0, SEMAPHORE_MAX, SEMAPHORE_MAX,
m_semaphore_hnd = CreateSemaphoreW(nullptr, SEMAPHORE_MAX, SEMAPHORE_MAX,
(TCHAR*)sem_name.utf16());
if (m_semaphore_hnd == 0) {
if (m_semaphore_hnd == nullptr) {
qWarning("QtLockedFile::lock(): CreateSemaphore: %s",
errorCodeToString(GetLastError()).toLatin1().constData());
return false;
@ -84,19 +84,19 @@ bool QtLockedFile::lock(LockMode mode, bool block)
}
bool gotMutex = false;
int decrement;
int decrement = 0;
if (mode == ReadLock) {
decrement = 1;
} else {
decrement = SEMAPHORE_MAX;
if (m_mutex_hnd == 0) {
if (m_mutex_hnd == nullptr) {
QFileInfo fi(*this);
QString mut_name = QString::fromLatin1(MUTEX_PREFIX)
+ fi.absoluteFilePath().toLower();
m_mutex_hnd = CreateMutexW(nullptr, FALSE, (TCHAR*)mut_name.utf16());
if (m_mutex_hnd == 0) {
if (m_mutex_hnd == nullptr) {
qWarning("QtLockedFile::lock(): CreateMutex: %s",
errorCodeToString(GetLastError()).toLatin1().constData());
return false;
@ -153,13 +153,13 @@ bool QtLockedFile::unlock()
if (!isLocked())
return true;
int increment;
int increment = 0;
if (m_lock_mode == ReadLock)
increment = 1;
else
increment = SEMAPHORE_MAX;
DWORD ret = ReleaseSemaphore(m_semaphore_hnd, increment, 0);
DWORD ret = ReleaseSemaphore(m_semaphore_hnd, increment, nullptr);
if (ret == 0) {
qWarning("QtLockedFile::unlock(): ReleaseSemaphore: %s",
errorCodeToString(GetLastError()).toLatin1().constData());
@ -175,21 +175,21 @@ QtLockedFile::~QtLockedFile()
{
if (isOpen())
unlock();
if (m_mutex_hnd != 0) {
if (m_mutex_hnd != nullptr) {
DWORD ret = CloseHandle(m_mutex_hnd);
if (ret == 0) {
qWarning("QtLockedFile::~QtLockedFile(): CloseHandle (mutex): %s",
errorCodeToString(GetLastError()).toLatin1().constData());
}
m_mutex_hnd = 0;
m_mutex_hnd = nullptr;
}
if (m_semaphore_hnd != 0) {
if (m_semaphore_hnd != nullptr) {
DWORD ret = CloseHandle(m_semaphore_hnd);
if (ret == 0) {
qWarning("QtLockedFile::~QtLockedFile(): CloseHandle (semaphore): %s",
errorCodeToString(GetLastError()).toLatin1().constData());
}
m_semaphore_hnd = 0;
m_semaphore_hnd = nullptr;
}
}

View File

@ -37,7 +37,7 @@
#include <QLibrary>
#include <qt_windows.h>
using PProcessIdToSessionId = BOOL (WINAPI*)(DWORD, DWORD*);
static PProcessIdToSessionId pProcessIdToSessionId = 0;
static PProcessIdToSessionId pProcessIdToSessionId = nullptr;
#endif
#if defined(Q_OS_UNIX)

View File

@ -54,7 +54,7 @@ void FileSystem::setFileHidden(const QString &filename, bool hidden)
{
#ifdef _WIN32
QString fName = longWinPath(filename);
DWORD dwAttrs;
DWORD dwAttrs = 0;
dwAttrs = GetFileAttributesW((wchar_t *)fName.utf16());
@ -197,7 +197,7 @@ bool FileSystem::uncheckedRenameReplace(const QString &originFileName,
setFileReadOnly(destinationFileName, false);
}
BOOL ok;
BOOL ok = 0;
QString orig = longWinPath(originFileName);
QString dest = longWinPath(destinationFileName);
@ -267,7 +267,7 @@ bool FileSystem::openAndSeekFileSharedRead(QFile *file, QString *errorOrNull, qi
}
// Seek to the right spot
LARGE_INTEGER *li = reinterpret_cast<LARGE_INTEGER *>(&seek);
auto li = reinterpret_cast<LARGE_INTEGER *>(&seek);
DWORD newFilePointer = SetFilePointer(fileHandle, li->LowPart, &li->HighPart, FILE_BEGIN);
if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
error = qt_error_string();
@ -292,7 +292,7 @@ bool FileSystem::openAndSeekFileSharedRead(QFile *file, QString *errorOrNull, qi
static bool fileExistsWin(const QString &filename)
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
HANDLE hFind = nullptr;
QString fName = FileSystem::longWinPath(filename);
hFind = FindFirstFileW((wchar_t *)fName.utf16(), &FindFileData);

View File

@ -41,7 +41,7 @@ int c_utimes(const QString &uri, const struct timeval *times) {
//after Microsoft KB167296
static void UnixTimevalToFileTime(struct timeval t, LPFILETIME pft)
{
LONGLONG ll;
LONGLONG ll = 0;
ll = Int32x32To64(t.tv_sec, CSYNC_USEC_IN_SEC*10) + t.tv_usec*10 + CSYNC_SECONDS_SINCE_1601*CSYNC_USEC_IN_SEC*10;
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = ll >> 32;
@ -50,7 +50,7 @@ static void UnixTimevalToFileTime(struct timeval t, LPFILETIME pft)
int c_utimes(const QString &uri, const struct timeval *times) {
FILETIME LastAccessTime;
FILETIME LastModificationTime;
HANDLE hFile;
HANDLE hFile = nullptr;
auto wuri = uri.toStdWString();
@ -64,7 +64,7 @@ int c_utimes(const QString &uri, const struct timeval *times) {
}
hFile=CreateFileW(wuri.data(), FILE_WRITE_ATTRIBUTES, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL+FILE_FLAG_BACKUP_SEMANTICS, NULL);
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL+FILE_FLAG_BACKUP_SEMANTICS, nullptr);
if(hFile==INVALID_HANDLE_VALUE) {
switch(GetLastError()) {
case ERROR_FILE_NOT_FOUND:
@ -87,7 +87,7 @@ int c_utimes(const QString &uri, const struct timeval *times) {
return -1;
}
if(!SetFileTime(hFile, NULL, &LastAccessTime, &LastModificationTime)) {
if(!SetFileTime(hFile, nullptr, &LastAccessTime, &LastModificationTime)) {
//can this happen?
errno=ENOENT;
CloseHandle(hFile);

View File

@ -116,7 +116,7 @@ static time_t FileTimeToUnixTime(FILETIME *filetime, DWORD *remainder)
std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(csync_vio_handle_t *handle, OCC::Vfs *vfs) {
std::unique_ptr<csync_file_stat_t> file_stat;
DWORD rem;
DWORD rem = 0;
errno = 0;
@ -190,14 +190,14 @@ int csync_vio_local_stat(const QString &uri, csync_file_stat_t *buf)
Possible optimisation: only fetch the file id when we need it (for new files)
*/
HANDLE h;
HANDLE h = nullptr;
BY_HANDLE_FILE_INFORMATION fileInfo;
ULARGE_INTEGER FileIndex;
h = CreateFileW(reinterpret_cast<const wchar_t *>(OCC::FileSystem::longWinPath(uri).utf16()), 0, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
NULL, OPEN_EXISTING,
nullptr, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
NULL);
nullptr);
if( h == INVALID_HANDLE_VALUE ) {
errno = GetLastError();
qCCritical(lcCSyncVIOLocal) << "CreateFileW failed on" << uri << OCC::Utility::formatWinError(errno);
@ -219,7 +219,7 @@ int csync_vio_local_stat(const QString &uri, csync_file_stat_t *buf)
buf->inode = FileIndex.QuadPart;
buf->size = (fileInfo.nFileSizeHigh * ((int64_t)(MAXDWORD)+1)) + fileInfo.nFileSizeLow;
DWORD rem;
DWORD rem = 0;
buf->modtime = FileTimeToUnixTime(&fileInfo.ftLastWriteTime, &rem);
CloseHandle(h);

View File

@ -120,7 +120,7 @@ namespace {
#ifdef Q_OS_WIN
class WindowsNativeEventFilter : public QAbstractNativeEventFilter {
public:
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) {
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override {
const auto msg = static_cast<MSG *>(message);
if(msg->message == WM_SYSCOLORCHANGE || msg->message == WM_SETTINGCHANGE) {
if (const auto ptr = qobject_cast<QGuiApplication *>(QGuiApplication::instance())) {
@ -765,7 +765,7 @@ static inline void toHtml(QString &t)
static void displayHelpText(QString t) // No console on Windows.
{
toHtml(t);
QMessageBox::information(0, Theme::instance()->appNameGUI(), t);
QMessageBox::information(nullptr, Theme::instance()->appNameGUI(), t);
}
#else

View File

@ -47,7 +47,7 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize,
if (_directory == INVALID_HANDLE_VALUE) {
const auto error = GetLastError();
qCWarning(lcFolderWatcher) << "Failed to create handle for" << _path << ", error:" << Utility::formatWinError(error);
_directory = 0;
_directory = nullptr;
return;
}
@ -65,7 +65,7 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize,
while (!_done) {
ResetEvent(_resultEvent);
FILE_NOTIFY_INFORMATION *pFileNotifyBuffer =
auto pFileNotifyBuffer =
reinterpret_cast<FILE_NOTIFY_INFORMATION *>(fileNotifyBuffer.data());
DWORD dwBytesReturned = 0;
if (!ReadDirectoryChangesW(_directory, pFileNotifyBuffer,

View File

@ -1556,7 +1556,7 @@ void SocketApi::command_ASYNC_WAIT_FOR_WIDGET_SIGNAL(const QSharedPointer<Socket
return;
}
ListenerClosure *closure = new ListenerClosure([job]() { job->resolve("signal emitted"); });
auto closure = new ListenerClosure([job]() { job->resolve("signal emitted"); });
auto signalSignature = arguments["signalSignature"].toString();
signalSignature.prepend("2");

View File

@ -703,7 +703,7 @@ bool OwncloudPropagator::localFileNameClash(const QString &relFile)
}
#elif defined(Q_OS_WIN)
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
HANDLE hFind = nullptr;
hFind = FindFirstFileW(reinterpret_cast<const wchar_t *>(FileSystem::longWinPath(file).utf16()), &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) {
@ -738,7 +738,7 @@ bool OwncloudPropagator::hasCaseClashAccessibilityProblem(const QString &relfile
bool result = false;
const QString file(_localDir + relfile);
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
HANDLE hFind = nullptr;
hFind = FindFirstFileW(reinterpret_cast<const wchar_t *>(FileSystem::longWinPath(file).utf16()), &FindFileData);
if (hFind != INVALID_HANDLE_VALUE) {

View File

@ -1,5 +1,7 @@
include(GenerateIconsUtils)
unset(CMAKE_CXX_CLANG_TIDY)
# generate custom states icons
set(theme_dir ${CMAKE_SOURCE_DIR}/theme)
set(custom_state_icons_path "${theme_dir}/cfapishellext_custom_states")

View File

@ -20,7 +20,7 @@
long dllReferenceCount = 0;
long dllObjectsCount = 0;
HINSTANCE instanceHandle = NULL;
HINSTANCE instanceHandle = nullptr;
HRESULT CustomStateProvider_CreateInstance(REFIID riid, void **ppv);
HRESULT ThumbnailProvider_CreateInstance(REFIID riid, void **ppv);

View File

@ -46,7 +46,7 @@ class TestCfApiShellExtensionsIPC : public QObject
QScopedPointer<FakeQNAM> fakeQnam;
OCC::AccountPtr account;
OCC::AccountState* accountState;
OCC::AccountState* accountState = nullptr;
QScopedPointer<ShellExtensionsServer> _shellExtensionsServer;

View File

@ -18,14 +18,14 @@ using namespace OCC;
HANDLE makeHandle(const QString &file, int shareMode)
{
const auto fName = FileSystem::longWinPath(file);
const wchar_t *wuri = reinterpret_cast<const wchar_t *>(fName.utf16());
const auto wuri = reinterpret_cast<const wchar_t *>(fName.utf16());
auto handle = CreateFileW(
wuri,
GENERIC_READ | GENERIC_WRITE,
shareMode,
NULL, OPEN_EXISTING,
nullptr, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
nullptr);
if (handle == INVALID_HANDLE_VALUE) {
qWarning() << GetLastError();
}