Increased warning level to #4 and fixed a number of warnings.
This commit is contained in:
parent
b9ce1421dd
commit
c027d08c84
@ -162,7 +162,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;MUTILS_DLL_EXPORT;_DEBUG;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;MUTILS_DLL_EXPORT;_DEBUG;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
@ -172,6 +172,7 @@
|
|||||||
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<DisableSpecificWarnings>4714;4324;4127</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@ -182,7 +183,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
@ -202,6 +203,7 @@
|
|||||||
<MinimalRebuild>false</MinimalRebuild>
|
<MinimalRebuild>false</MinimalRebuild>
|
||||||
<ControlFlowGuard>false</ControlFlowGuard>
|
<ControlFlowGuard>false</ControlFlowGuard>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<DisableSpecificWarnings>4714;4324;4127</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@ -215,7 +217,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
@ -235,6 +237,7 @@
|
|||||||
<MinimalRebuild>false</MinimalRebuild>
|
<MinimalRebuild>false</MinimalRebuild>
|
||||||
<ControlFlowGuard>false</ControlFlowGuard>
|
<ControlFlowGuard>false</ControlFlowGuard>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<DisableSpecificWarnings>4714;4324;4127</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -159,7 +159,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;MUTILS_DLL_EXPORT;_DEBUG;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;MUTILS_DLL_EXPORT;_DEBUG;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
@ -179,7 +179,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
@ -212,7 +212,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
@ -232,6 +232,7 @@
|
|||||||
<MinimalRebuild>false</MinimalRebuild>
|
<MinimalRebuild>false</MinimalRebuild>
|
||||||
<ControlFlowGuard>false</ControlFlowGuard>
|
<ControlFlowGuard>false</ControlFlowGuard>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<DisableSpecificWarnings>4714;4324;4127</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -159,7 +159,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;MUTILS_DLL_EXPORT;_DEBUG;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;MUTILS_DLL_EXPORT;_DEBUG;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
@ -179,7 +179,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
@ -212,7 +212,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
@ -232,6 +232,7 @@
|
|||||||
<MinimalRebuild>false</MinimalRebuild>
|
<MinimalRebuild>false</MinimalRebuild>
|
||||||
<ControlFlowGuard>false</ControlFlowGuard>
|
<ControlFlowGuard>false</ControlFlowGuard>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<DisableSpecificWarnings>4714;4324;4127</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -106,7 +106,7 @@ namespace MUtils
|
|||||||
QByteArray digest(const bool bAsHex = true) { return bAsHex ? finalize().toHex() : finalize(); }
|
QByteArray digest(const bool bAsHex = true) { return bAsHex ? finalize().toHex() : finalize(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Hash(const char* key = NULL) {/*nothing to do*/};
|
Hash(const char* /*key*/ = NULL) {/*nothing to do*/};
|
||||||
virtual bool process(const quint8 *const data, const quint32 len) = 0;
|
virtual bool process(const quint8 *const data, const quint32 len) = 0;
|
||||||
virtual QByteArray finalize(void) = 0;
|
virtual QByteArray finalize(void) = 0;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ namespace MUtils
|
|||||||
bool read(quint32 &command, quint32 &flags, QStringList ¶ms);
|
bool read(quint32 &command, quint32 &flags, QStringList ¶ms);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IPCChannel(const IPCChannel&) : p(NULL), m_appVersionNo(-1) { throw "Constructor is disabled!"; }
|
IPCChannel(const IPCChannel&) : p(NULL), m_appVersionNo((unsigned int)(-1)) { throw "Constructor is disabled!"; }
|
||||||
IPCChannel &operator=(const IPCChannel&) { throw "Assignment operator is disabled!"; return *this; }
|
IPCChannel &operator=(const IPCChannel&) { throw "Assignment operator is disabled!"; return *this; }
|
||||||
|
|
||||||
const QString m_applicationId;
|
const QString m_applicationId;
|
||||||
|
6
src/3rd_party/strnatcmp/src/strnatcmp.cpp
vendored
6
src/3rd_party/strnatcmp/src/strnatcmp.cpp
vendored
@ -97,10 +97,10 @@ static int compare_right(nat_char const *a, nat_char const *b)
|
|||||||
return bias;
|
return bias;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compare_left(nat_char const *a,nat_char const *b)
|
static int compare_left(nat_char const *a, nat_char const *b)
|
||||||
{
|
{
|
||||||
/* Compare two left-aligned numbers: the first to have a
|
/* Compare two left-aligned numbers: the first to have a
|
||||||
different value wins. */
|
different value wins. */
|
||||||
@ -118,7 +118,7 @@ static int compare_left(nat_char const *a,nat_char const *b)
|
|||||||
return +1;
|
return +1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int strnatcmp0(nat_char const *a, nat_char const *b, const bool fold_case)
|
static int strnatcmp0(nat_char const *a, nat_char const *b, const bool fold_case)
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Invalid parameters handler
|
// Invalid parameters handler
|
||||||
static void my_invalid_param_handler(const wchar_t* exp, const wchar_t* fun, const wchar_t* fil, unsigned int, uintptr_t)
|
static void my_invalid_param_handler(const wchar_t* /*exp*/, const wchar_t* /*fun*/, const wchar_t* /*fil*/, unsigned int, uintptr_t)
|
||||||
{
|
{
|
||||||
MUtils::OS::fatal_exit(L"Invalid parameter handler invoked, application will exit!");
|
MUtils::OS::fatal_exit(L"Invalid parameter handler invoked, application will exit!");
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ static void my_signal_handler(int signal_num)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Global exception handler
|
// Global exception handler
|
||||||
static LONG WINAPI my_exception_handler(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
static LONG WINAPI my_exception_handler(struct _EXCEPTION_POINTERS* /*ExceptionInfo*/)
|
||||||
{
|
{
|
||||||
MUtils::OS::fatal_exit(L"Unhandeled exception handler invoked, application will exit!");
|
MUtils::OS::fatal_exit(L"Unhandeled exception handler invoked, application will exit!");
|
||||||
return LONG_MAX;
|
return LONG_MAX;
|
||||||
|
@ -247,7 +247,7 @@ QString MUtils::make_temp_file(const QDir &basePath, const QString &extension, c
|
|||||||
|
|
||||||
QString MUtils::make_unique_file(const QString &basePath, const QString &baseName, const QString &extension, const bool fancy, const bool placeholder)
|
QString MUtils::make_unique_file(const QString &basePath, const QString &baseName, const QString &extension, const bool fancy, const bool placeholder)
|
||||||
{
|
{
|
||||||
return make_unique_file(QDir(basePath), baseName, extension, fancy);
|
return make_unique_file(QDir(basePath), baseName, extension, fancy, placeholder);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MUtils::make_unique_file(const QDir &basePath, const QString &baseName, const QString &extension, const bool fancy, const bool placeholder)
|
QString MUtils::make_unique_file(const QDir &basePath, const QString &baseName, const QString &extension, const bool fancy, const bool placeholder)
|
||||||
@ -282,10 +282,10 @@ QString MUtils::make_unique_file(const QDir &basePath, const QString &baseName,
|
|||||||
|
|
||||||
if (placeholder && (!fileName.isEmpty()))
|
if (placeholder && (!fileName.isEmpty()))
|
||||||
{
|
{
|
||||||
QFile placeholder(fileName);
|
QFile placeholderFile(fileName);
|
||||||
if (placeholder.open(QIODevice::WriteOnly))
|
if (placeholderFile.open(QIODevice::WriteOnly))
|
||||||
{
|
{
|
||||||
placeholder.close();
|
placeholderFile.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ typedef struct _progress_callback_data_t
|
|||||||
}
|
}
|
||||||
progress_callback_data_t;
|
progress_callback_data_t;
|
||||||
|
|
||||||
static DWORD __stdcall copy_file_progress(LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER StreamSize, LARGE_INTEGER StreamBytesTransferred, DWORD dwStreamNumber, DWORD dwCallbackReason, HANDLE hSourceFile, HANDLE hDestinationFile, LPVOID lpData)
|
static DWORD __stdcall copy_file_progress(LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER /*StreamSize*/, LARGE_INTEGER /*StreamBytesTransferred*/, DWORD /*dwStreamNumber*/, DWORD /*dwCallbackReason*/, HANDLE /*hSourceFile*/, HANDLE /*hDestinationFile*/, LPVOID lpData)
|
||||||
{
|
{
|
||||||
if(const progress_callback_data_t *data = (progress_callback_data_t*) lpData)
|
if(const progress_callback_data_t *data = (progress_callback_data_t*) lpData)
|
||||||
{
|
{
|
||||||
@ -1439,7 +1439,7 @@ bool MUtils::OS::free_diskspace(const QString &path, quint64 &freeSpace)
|
|||||||
return true;;
|
return true;;
|
||||||
}
|
}
|
||||||
|
|
||||||
freeSpace = -1;
|
freeSpace = static_cast<quint64>(-1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2012,7 +2012,7 @@ static volatile bool g_debug_check = check_debugger_helper();
|
|||||||
static MUtils::Internal::CriticalSection g_fatal_exit_lock;
|
static MUtils::Internal::CriticalSection g_fatal_exit_lock;
|
||||||
static QAtomicInt g_fatal_exit_flag;
|
static QAtomicInt g_fatal_exit_flag;
|
||||||
|
|
||||||
static BOOL CALLBACK fatal_exit_enum_helper(const HWND hwnd, const LPARAM lParam)
|
static BOOL CALLBACK fatal_exit_enum_helper(const HWND hwnd, const LPARAM /*lParam*/)
|
||||||
{
|
{
|
||||||
SetWindowPos(hwnd, HWND_NOTOPMOST, NULL, NULL, NULL, NULL, SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE);
|
SetWindowPos(hwnd, HWND_NOTOPMOST, NULL, NULL, NULL, NULL, SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -191,7 +191,7 @@ bool MUtils::Registry::RegistryKey::value_write(const QString &valueName, const
|
|||||||
bool MUtils::Registry::RegistryKey::value_read(const QString &valueName, quint32 &value) const
|
bool MUtils::Registry::RegistryKey::value_read(const QString &valueName, quint32 &value) const
|
||||||
{
|
{
|
||||||
value = 0;
|
value = 0;
|
||||||
DWORD size = sizeof(quint32), type = -1;
|
DWORD size = sizeof(quint32), type = static_cast<DWORD>(-1);
|
||||||
CHECK_STATUS(KEY_READ);
|
CHECK_STATUS(KEY_READ);
|
||||||
return (RegQueryValueEx(p->m_hKey, valueName.isEmpty() ? NULL : MUTILS_WCHR(valueName), 0, &type, reinterpret_cast<BYTE*>(&value), &size) == ERROR_SUCCESS) && (type == REG_DWORD);
|
return (RegQueryValueEx(p->m_hKey, valueName.isEmpty() ? NULL : MUTILS_WCHR(valueName), 0, &type, reinterpret_cast<BYTE*>(&value), &size) == ERROR_SUCCESS) && (type == REG_DWORD);
|
||||||
}
|
}
|
||||||
@ -199,7 +199,7 @@ bool MUtils::Registry::RegistryKey::value_read(const QString &valueName, quint32
|
|||||||
bool MUtils::Registry::RegistryKey::value_read(const QString &valueName, QString &value) const
|
bool MUtils::Registry::RegistryKey::value_read(const QString &valueName, QString &value) const
|
||||||
{
|
{
|
||||||
value = QString();
|
value = QString();
|
||||||
wchar_t buffer[2048]; DWORD size = sizeof(wchar_t) * 2048, type = -1;
|
wchar_t buffer[2048]; DWORD size = sizeof(wchar_t) * 2048, type = static_cast<DWORD>(-1);
|
||||||
CHECK_STATUS(KEY_READ);
|
CHECK_STATUS(KEY_READ);
|
||||||
if((RegQueryValueEx(p->m_hKey, valueName.isEmpty() ? NULL : MUTILS_WCHR(valueName), 0, &type, reinterpret_cast<BYTE*>(&(buffer[0])), &size) == ERROR_SUCCESS) && ((type == REG_SZ) || (type == REG_EXPAND_SZ)))
|
if((RegQueryValueEx(p->m_hKey, valueName.isEmpty() ? NULL : MUTILS_WCHR(valueName), 0, &type, reinterpret_cast<BYTE*>(&(buffer[0])), &size) == ERROR_SUCCESS) && ((type == REG_SZ) || (type == REG_EXPAND_SZ)))
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ bool MUtils::Sound::play_sound(const QString &name, const bool &bAsync)
|
|||||||
{
|
{
|
||||||
if(const unsigned char *data = get_sound_from_cache(name))
|
if(const unsigned char *data = get_sound_from_cache(name))
|
||||||
{
|
{
|
||||||
return PlaySound(LPCWSTR(data), NULL, (SND_MEMORY | (bAsync ? SND_ASYNC : SND_SYNC))) != FALSE;
|
return PlaySoundW(LPCWSTR(data), NULL, (SND_MEMORY | (bAsync ? SND_ASYNC : SND_SYNC)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +112,12 @@ bool MUtils::Sound::play_sound(const QString &name, const bool &bAsync)
|
|||||||
|
|
||||||
bool MUtils::Sound::play_system_sound(const QString &alias, const bool &bAsync)
|
bool MUtils::Sound::play_system_sound(const QString &alias, const bool &bAsync)
|
||||||
{
|
{
|
||||||
return PlaySound(MUTILS_WCHR(alias), GetModuleHandle(NULL), (SND_ALIAS | (bAsync ? SND_ASYNC : SND_SYNC))) != FALSE;
|
if (!alias.isEmpty())
|
||||||
|
{
|
||||||
|
return PlaySoundW(MUTILS_WCHR(alias), NULL, (SND_ALIAS | (bAsync ? SND_ASYNC : SND_SYNC)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MUtils::Sound::play_sound_file(const QString &library, const unsigned short uiSoundIdx, const bool &bAsync)
|
bool MUtils::Sound::play_sound_file(const QString &library, const unsigned short uiSoundIdx, const bool &bAsync)
|
||||||
@ -131,15 +136,15 @@ bool MUtils::Sound::play_sound_file(const QString &library, const unsigned short
|
|||||||
|
|
||||||
if(libraryFile.exists() && libraryFile.isFile())
|
if(libraryFile.exists() && libraryFile.isFile())
|
||||||
{
|
{
|
||||||
if(const HMODULE module = GetModuleHandleW(MUTILS_WCHR(QDir::toNativeSeparators(libraryFile.canonicalFilePath()))))
|
if(const HMODULE module = LoadLibraryW(MUTILS_WCHR(QDir::toNativeSeparators(libraryFile.canonicalFilePath()))))
|
||||||
{
|
{
|
||||||
result = (PlaySound(MAKEINTRESOURCE(uiSoundIdx), module, (SND_RESOURCE | (bAsync ? SND_ASYNC : SND_SYNC))) != FALSE);
|
result = PlaySoundW(MAKEINTRESOURCE(uiSoundIdx), module, (SND_RESOURCE | (bAsync ? SND_ASYNC : SND_SYNC)));
|
||||||
}
|
|
||||||
else if(const HMODULE module = LoadLibraryW(MUTILS_WCHR(QDir::toNativeSeparators(libraryFile.canonicalFilePath()))))
|
|
||||||
{
|
|
||||||
result = (PlaySound(MAKEINTRESOURCE(uiSoundIdx), module, (SND_RESOURCE | (bAsync ? SND_ASYNC : SND_SYNC))) != FALSE);
|
|
||||||
FreeLibrary(module);
|
FreeLibrary(module);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning("PlaySound: File \"%s\" failed to load!", MUTILS_UTF8(libraryFile.absoluteFilePath()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -203,7 +203,7 @@ void MUtils::Terminal::setup(int &argc, char **argv, const char* const appName,
|
|||||||
g_terminal_log_file.reset(new QFile(MUTILS_QSTR(logfile)));
|
g_terminal_log_file.reset(new QFile(MUTILS_QSTR(logfile)));
|
||||||
if(g_terminal_log_file->open(QIODevice::WriteOnly))
|
if(g_terminal_log_file->open(QIODevice::WriteOnly))
|
||||||
{
|
{
|
||||||
static const char MARKER[3] = { char(0xEF), char(0xBB), char(0xBF) };
|
static const char MARKER[3] = { '\xEF', '\xBB', '\xBF' };
|
||||||
g_terminal_log_file->write(MARKER, 3);
|
g_terminal_log_file->write(MARKER, 3);
|
||||||
}
|
}
|
||||||
free(logfile);
|
free(logfile);
|
||||||
|
@ -106,7 +106,7 @@ int MUtils::Translation::enumerate(QStringList &list)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
list.swap(g_translation_data->keys());
|
list = g_translation_data->keys();
|
||||||
return list.count();
|
return list.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user