From f3bdfef9cfa366eb44d974ffe3db1ba522085c58 Mon Sep 17 00:00:00 2001 From: Luca Lorenzetto Date: Tue, 5 May 2015 16:42:34 +0200 Subject: [PATCH] Integrating feedbacks provided by jturcotte --- src/libsync/utility_win.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libsync/utility_win.cpp b/src/libsync/utility_win.cpp index f3971cfb8..7b624c178 100644 --- a/src/libsync/utility_win.cpp +++ b/src/libsync/utility_win.cpp @@ -38,17 +38,15 @@ static void setupFavLink_private(const QString &folder) { // Windows Explorer: Place under "Favorites" (Links) - SHGetKnownFolderPathFun SHGetKnownFolderPathPtr = NULL; - SHGetFolderPathFun SHGetFolderPathPtr = NULL; + static SHGetKnownFolderPathFun SHGetKnownFolderPathPtr = NULL; QString linkName; QDir folderDir(QDir::fromNativeSeparators(folder)); - if((!SHGetKnownFolderPathPtr) && (!SHGetFolderPathPtr)) + if (!SHGetKnownFolderPathPtr) { QLibrary kernel32Lib("shell32.dll"); if(kernel32Lib.load()) { SHGetKnownFolderPathPtr = (SHGetKnownFolderPathFun) kernel32Lib.resolve("SHGetKnownFolderPath"); - SHGetFolderPathPtr = (SHGetFolderPathFun) kernel32Lib.resolve("SHGetFolderPathW"); } } @@ -56,8 +54,8 @@ static void setupFavLink_private(const QString &folder) /* Use new WINAPI functions */ wchar_t *path = NULL; if(SHGetKnownFolderPathPtr(FOLDERID_Links, 0, NULL, &path) == S_OK) { - QString Links= QDir::fromNativeSeparators(QString::fromWCharArray(path)); - linkName = QDir(Links).filePath(folderDir.dirName() + QLatin1String(".lnk")); + QString links = QDir::fromNativeSeparators(QString::fromWCharArray(path)); + linkName = QDir(links).filePath(folderDir.dirName() + QLatin1String(".lnk")); } } else { /* Use legacy functions */