mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 22:15:57 +03:00
Add more raw string literals missed previously
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
parent
ed1c2eaab4
commit
c50a968a1e
9 changed files with 26 additions and 25 deletions
|
@ -1,6 +1,7 @@
|
|||
Checks: '-*,
|
||||
cppcoreguidelines-init-variables,
|
||||
modernize-make-*,
|
||||
modernize-raw-string-literal,
|
||||
modernize-redundant-void-arg,
|
||||
modernize-replace-*,
|
||||
modernize-return-braced-init-list,
|
||||
|
|
|
@ -85,7 +85,7 @@ HRESULT OCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CL
|
|||
wchar_t szSubkey[MAX_PATH];
|
||||
|
||||
// Create the HKCR\CLSID\{<CLSID>} key.
|
||||
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey), L"CLSID\\%s", szCLSID);
|
||||
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey), LR"(CLSID\%s)", szCLSID);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = SetHKCRRegistryKeyAndValue(szSubkey, nullptr, pszFriendlyName);
|
||||
|
@ -94,7 +94,7 @@ HRESULT OCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CL
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey),
|
||||
L"CLSID\\%s\\InprocServer32", szCLSID);
|
||||
LR"(CLSID\%s\InprocServer32)", szCLSID);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// Set the default value of the InprocServer32 key to the
|
||||
|
@ -123,7 +123,7 @@ HRESULT OCContextMenuRegHandler::UnregisterInprocServer(const CLSID& clsid)
|
|||
wchar_t szSubkey[MAX_PATH];
|
||||
|
||||
// Delete the HKCR\CLSID\{<CLSID>} key.
|
||||
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey), L"CLSID\\%s", szCLSID);
|
||||
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey), LR"(CLSID\%s)", szCLSID);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(RegDelnode(HKEY_CLASSES_ROOT, szSubkey));
|
||||
|
@ -167,7 +167,7 @@ HRESULT OCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
|
|||
|
||||
// Create the key HKCR\<File Type>\shellex\ContextMenuHandlers\{friendlyName>}
|
||||
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey),
|
||||
L"%s\\shellex\\ContextMenuHandlers\\%s", pszFileType, pszFriendlyName);
|
||||
LR"(%s\shellex\ContextMenuHandlers\%s)", pszFileType, pszFriendlyName);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// Set the default value of the key.
|
||||
|
@ -208,7 +208,7 @@ HRESULT OCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(
|
|||
|
||||
// Remove the HKCR\<File Type>\shellex\ContextMenuHandlers\{friendlyName} key.
|
||||
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey),
|
||||
L"%s\\shellex\\ContextMenuHandlers\\%s", pszFileType, pszFriendlyName);
|
||||
LR"(%s\shellex\ContextMenuHandlers\%s)", pszFileType, pszFriendlyName);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(RegDelnode(HKEY_CLASSES_ROOT, szSubkey));
|
||||
|
|
|
@ -44,7 +44,7 @@ std::wstring getUserName() {
|
|||
|
||||
std::wstring CommunicationSocket::DefaultPipePath()
|
||||
{
|
||||
auto pipename = std::wstring(L"\\\\.\\pipe\\");
|
||||
auto pipename = std::wstring(LR"(\\.\pipe\)");
|
||||
pipename += L"ownCloud-";
|
||||
pipename += getUserName();
|
||||
return pipename;
|
||||
|
|
|
@ -175,10 +175,10 @@ namespace FileSystem {
|
|||
if( str[0] == '/' || str[0] == '\\' ) {
|
||||
// Don't prepend if already UNC
|
||||
if( !(len > 1 && (str[1] == '/' || str[1] == '\\')) ) {
|
||||
longStr.append("\\\\?");
|
||||
longStr.append(R"(\\?)");
|
||||
}
|
||||
} else {
|
||||
longStr.append("\\\\?\\"); // prepend string by this four magic chars.
|
||||
longStr.append(R"(\\?\)"); // prepend string by this four magic chars.
|
||||
}
|
||||
longStr += str;
|
||||
|
||||
|
|
|
@ -666,7 +666,7 @@ QByteArray Utility::conflictFileBaseName(const QByteArray &conflictName)
|
|||
|
||||
QString Utility::sanitizeForFileName(const QString &name)
|
||||
{
|
||||
const auto invalid = QStringLiteral("/?<>\\:*|\"");
|
||||
const auto invalid = QStringLiteral(R"(/?<>\:*|")");
|
||||
QString result;
|
||||
result.reserve(name.size());
|
||||
for (const auto c : name) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <string>
|
||||
#include <QLibrary>
|
||||
|
||||
static const char runPathC[] = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
|
||||
static const char runPathC[] = R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)";
|
||||
|
||||
namespace OCC {
|
||||
|
||||
|
@ -91,7 +91,7 @@ void setLaunchOnStartup_private(const QString &appName, const QString &guiName,
|
|||
static inline bool hasDarkSystray_private()
|
||||
{
|
||||
if(Utility::registryGetKeyValue( HKEY_CURRENT_USER,
|
||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
|
||||
R"(Software\Microsoft\Windows\CurrentVersion\Themes\Personalize)",
|
||||
"SystemUsesLightTheme" ) == 1) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ void NavigationPaneHelper::updateCloudStorageRegistry()
|
|||
#ifdef Q_OS_WIN
|
||||
Utility::registryWalkSubKeys(
|
||||
HKEY_CURRENT_USER,
|
||||
QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\NameSpace"),
|
||||
QStringLiteral(R"(Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace)"),
|
||||
[&entriesToRemove](HKEY key, const QString &subKey) {
|
||||
QVariant appName = Utility::registryGetKeyValue(key, subKey, QStringLiteral("ApplicationName"));
|
||||
if (appName.toString() == QLatin1String(APPLICATION_NAME)) {
|
||||
|
@ -138,7 +138,7 @@ void NavigationPaneHelper::updateCloudStorageRegistry()
|
|||
// Step 11: Register your extension in the namespace root
|
||||
Utility::registrySetKeyValue(HKEY_CURRENT_USER, namespacePath, QString(), REG_SZ, title);
|
||||
// Step 12: Hide your extension from the Desktop
|
||||
Utility::registrySetKeyValue(HKEY_CURRENT_USER, QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\HideDesktopIcons\\NewStartPanel"), clsidStr, REG_DWORD, 0x1);
|
||||
Utility::registrySetKeyValue(HKEY_CURRENT_USER, QStringLiteral(R"(Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel)"), clsidStr, REG_DWORD, 0x1);
|
||||
|
||||
// For us, to later be able to iterate and find our own namespace entries and associated CLSID.
|
||||
// Use the macro instead of the theme to make sure it matches with the uninstaller.
|
||||
|
|
|
@ -681,7 +681,7 @@ static void check_csync_exclude_expand_escapes(void **state)
|
|||
{
|
||||
(void)state;
|
||||
|
||||
QByteArray line = "keep \\' \\\" \\? \\\\ \\a \\b \\f \\n \\r \\t \\v \\z \\#";
|
||||
QByteArray line = R"(keep \' \" \? \\ \a \b \f \n \r \t \v \z \#)";
|
||||
csync_exclude_expand_escapes(line);
|
||||
assert_true(0 == strcmp(line.constData(), "keep ' \" ? \\\\ \a \b \f \n \r \t \v \\z #"));
|
||||
|
||||
|
|
|
@ -116,35 +116,35 @@ static void check_long_win_path(void **state)
|
|||
|
||||
{
|
||||
const char *path = "C://DATA/FILES/MUSIC/MY_MUSIC.mp3"; // check a short path
|
||||
const char *exp_path = "\\\\?\\C:\\\\DATA\\FILES\\MUSIC\\MY_MUSIC.mp3";
|
||||
const char *exp_path = R"(\\?\C:\\DATA\FILES\MUSIC\MY_MUSIC.mp3)";
|
||||
QByteArray new_short = OCC::FileSystem::pathtoUNC(QByteArray::fromRawData(path, strlen(path)));
|
||||
assert_string_equal(new_short, exp_path);
|
||||
}
|
||||
|
||||
{
|
||||
const char *path = "\\\\foo\\bar/MY_MUSIC.mp3";
|
||||
const char *exp_path = "\\\\foo\\bar\\MY_MUSIC.mp3";
|
||||
const char *path = R"(\\foo\bar/MY_MUSIC.mp3)";
|
||||
const char *exp_path = R"(\\foo\bar\MY_MUSIC.mp3)";
|
||||
QByteArray new_short = OCC::FileSystem::pathtoUNC(QByteArray::fromRawData(path, strlen(path)));
|
||||
assert_string_equal(new_short, exp_path);
|
||||
}
|
||||
|
||||
{
|
||||
const char *path = "//foo\\bar/MY_MUSIC.mp3";
|
||||
const char *exp_path = "\\\\foo\\bar\\MY_MUSIC.mp3";
|
||||
const char *path = R"(//foo\bar/MY_MUSIC.mp3)";
|
||||
const char *exp_path = R"(\\foo\bar\MY_MUSIC.mp3)";
|
||||
QByteArray new_short = OCC::FileSystem::pathtoUNC(QByteArray::fromRawData(path, strlen(path)));
|
||||
assert_string_equal(new_short, exp_path);
|
||||
}
|
||||
|
||||
{
|
||||
const char *path = "\\foo\\bar";
|
||||
const char *exp_path = "\\\\?\\foo\\bar";
|
||||
const char *exp_path = R"(\\?\foo\bar)";
|
||||
QByteArray new_short = OCC::FileSystem::pathtoUNC(QByteArray::fromRawData(path, strlen(path)));
|
||||
assert_string_equal(new_short, exp_path);
|
||||
}
|
||||
|
||||
{
|
||||
const char *path = "/foo/bar";
|
||||
const char *exp_path = "\\\\?\\foo\\bar";
|
||||
const char *exp_path = R"(\\?\foo\bar)";
|
||||
QByteArray new_short = OCC::FileSystem::pathtoUNC(QByteArray::fromRawData(path, strlen(path)));
|
||||
assert_string_equal(new_short, exp_path);
|
||||
}
|
||||
|
@ -153,10 +153,10 @@ static void check_long_win_path(void **state)
|
|||
"elonglonglonglong/flonglonglonglong/glonglonglonglong/hlonglonglonglong/ilonglonglonglong/"
|
||||
"jlonglonglonglong/klonglonglonglong/llonglonglonglong/mlonglonglonglong/nlonglonglonglong/"
|
||||
"olonglonglonglong/file.txt";
|
||||
const char *longPathConv = "\\\\?\\D:\\\\alonglonglonglong\\blonglonglonglong\\clonglonglonglong\\dlonglonglonglong\\"
|
||||
"elonglonglonglong\\flonglonglonglong\\glonglonglonglong\\hlonglonglonglong\\ilonglonglonglong\\"
|
||||
"jlonglonglonglong\\klonglonglonglong\\llonglonglonglong\\mlonglonglonglong\\nlonglonglonglong\\"
|
||||
"olonglonglonglong\\file.txt";
|
||||
const char *longPathConv = R"(\\?\D:\\alonglonglonglong\blonglonglonglong\clonglonglonglong\dlonglonglonglong\)"
|
||||
R"(elonglonglonglong\flonglonglonglong\glonglonglonglong\hlonglonglonglong\ilonglonglonglong\)"
|
||||
R"(jlonglonglonglong\klonglonglonglong\llonglonglonglong\mlonglonglonglong\nlonglonglonglong\)"
|
||||
R"(olonglonglonglong\file.txt)";
|
||||
|
||||
QByteArray new_long = OCC::FileSystem::pathtoUNC(QByteArray::fromRawData(longPath, strlen(longPath)));
|
||||
// printf("XXXXXXXXXXXX %s %d\n", new_long, mem_reserved);
|
||||
|
|
Loading…
Reference in a new issue