diff options
| author | Tannin <devnull@localhost> | 2015-01-03 12:34:26 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-01-03 12:34:26 +0100 |
| commit | e7b6a7cbddec32d300a1f758281c717402525053 (patch) | |
| tree | 1f6415a5c53b05319e7035917e654f09bfee5e7a /src | |
| parent | ab925e1e7ca7c2b82c69c9db30848a025d94f75a (diff) | |
- bugfix: no exec info returned for .exe
- bugfix: wide string conversion functions seem to have failed for empty string
Diffstat (limited to 'src')
| -rw-r--r-- | src/executableslist.cpp | 2 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 4 | ||||
| -rw-r--r-- | src/organizer.pro | 2 | ||||
| -rw-r--r-- | src/shared/util.cpp | 34 |
4 files changed, 23 insertions, 19 deletions
diff --git a/src/executableslist.cpp b/src/executableslist.cpp index cc942012..a526a9b7 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -196,7 +196,7 @@ void ExecutablesList::addExecutable(const QString &title, const QString &executa newExe.m_SteamAppID = steamAppID;
newExe.m_Custom = true;
newExe.m_Toolbar = toolbar;
- if ((pos < 0) || (pos >= m_Executables.size())) {
+ if ((pos < 0) || (pos >= static_cast<int>(m_Executables.size()))) {
m_Executables.push_back(newExe);
} else {
m_Executables.insert(m_Executables.begin() + pos, newExe);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7cc18f6b..bf2d6139 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4498,8 +4498,7 @@ void MainWindow::writeDataToFile() } -int MainWindow::getBinaryExecuteInfo(const QFileInfo &targetInfo, - QFileInfo &binaryInfo, QString &arguments) +int MainWindow::getBinaryExecuteInfo(const QFileInfo &targetInfo, QFileInfo &binaryInfo, QString &arguments) { QString extension = targetInfo.completeSuffix(); if ((extension.compare("cmd", Qt::CaseInsensitive)) || @@ -4510,6 +4509,7 @@ int MainWindow::getBinaryExecuteInfo(const QFileInfo &targetInfo, return 1; } else if (extension.compare("exe", Qt::CaseInsensitive) == 0) { binaryInfo = targetInfo; + return 1; } else if (extension.compare("jar", Qt::CaseInsensitive) == 0) { // types that need to be injected into std::wstring targetPathW = ToWString(targetInfo.absoluteFilePath()); diff --git a/src/organizer.pro b/src/organizer.pro index efc89839..e0cf7f70 100644 --- a/src/organizer.pro +++ b/src/organizer.pro @@ -92,7 +92,6 @@ SOURCES += \ json.cpp \
safewritefile.cpp \
modflagicondelegate.cpp \
- pluginflagicondelegate.cpp \
genericicondelegate.cpp \
organizerproxy.cpp
@@ -172,7 +171,6 @@ HEADERS += \ safewritefile.h\
pdll.h \
modflagicondelegate.h \
- pluginflagicondelegate.h \
genericicondelegate.h \
organizerproxy.h
diff --git a/src/shared/util.cpp b/src/shared/util.cpp index d4a77929..d284b517 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -66,28 +66,34 @@ bool FileExists(const std::wstring &searchPath, const std::wstring &filename) std::string ToString(const std::wstring &source, bool utf8)
{
std::string result;
- UINT codepage = utf8 ? CP_UTF8 : GetACP();
- int sizeRequired = ::WideCharToMultiByte(codepage, 0, &source[0], -1, NULL, 0, NULL, NULL);
- if (sizeRequired == 0) {
- throw windows_error("failed to convert string to multibyte");
+ if (source.length() > 0) {
+ UINT codepage = utf8 ? CP_UTF8 : GetACP();
+ int sizeRequired = ::WideCharToMultiByte(codepage, 0, &source[0], -1, NULL, 0, NULL, NULL);
+ if (sizeRequired == 0) {
+ throw windows_error("failed to convert string to multibyte");
+ }
+ // the size returned by WideCharToMultiByte contains zero termination IF -1 is specified for the length.
+ // we don't want that \0 in the string because then the length field would be wrong. Because madness
+ result.resize(sizeRequired - 1, '\0');
+ ::WideCharToMultiByte(codepage, 0, &source[0], (int)source.size(), &result[0], sizeRequired, NULL, NULL);
}
- // the size returned by WideCharToMultiByte contains zero termination IF -1 is specified for the length.
- // we don't want that \0 in the string because then the length field would be wrong. Because madness
- result.resize(sizeRequired - 1, '\0');
- ::WideCharToMultiByte(codepage, 0, &source[0], (int)source.size(), &result[0], sizeRequired, NULL, NULL);
+
return result;
}
std::wstring ToWString(const std::string &source, bool utf8)
{
std::wstring result;
- UINT codepage = utf8 ? CP_UTF8 : GetACP();
- int sizeRequired = ::MultiByteToWideChar(codepage, 0, &source[0], (int)source.size(), NULL, 0);
- if (sizeRequired == 0) {
- throw windows_error("failed to convert string to wide character");
+ if (source.length() > 0) {
+ UINT codepage = utf8 ? CP_UTF8 : GetACP();
+ int sizeRequired = ::MultiByteToWideChar(codepage, 0, source.c_str(), source.length(), NULL, 0);
+ if (sizeRequired == 0) {
+ throw windows_error("failed to convert string to wide character");
+ }
+ result.resize(sizeRequired, L'\0');
+ ::MultiByteToWideChar(codepage, 0, source.c_str(), source.length(), &result[0], sizeRequired);
}
- result.resize(sizeRequired, L'\0');
- ::MultiByteToWideChar(codepage, 0, &source[0], (int)source.size(), &result[0], sizeRequired);
+
return result;
}
|
