From 415d385f86d8e41309936d0bd7a1f30432787dc5 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sat, 17 Oct 2015 14:01:42 +0200 Subject: [PATCH] Fixed MUtils::OS::arguments() function. Regression in 44add70b7ca0c549f442981501b71439d4372aaf. --- src/OSSupport_Win32.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/OSSupport_Win32.cpp b/src/OSSupport_Win32.cpp index 1f1ddcd..7822808 100644 --- a/src/OSSupport_Win32.cpp +++ b/src/OSSupport_Win32.cpp @@ -119,20 +119,24 @@ const MUtils::OS::ArgumentMap &MUtils::OS::arguments(void) } g_arguments_list.reset(new ArgumentMap()); - int nArgs = 0; const QStringList argList = crack_command_line(); - if(argList.count() > 1) + if(!argList.isEmpty()) { const QString argPrefix = QLatin1String("--"); - const QChar separator = QLatin1Char('='); + const QChar separator = QLatin1Char('='); - for(int i = 1; i < nArgs; i++) + bool firstToken = true; + for(QStringList::ConstIterator iter = argList.constBegin(); iter != argList.constEnd(); iter++) { - const QString &argStr = argList[i]; - if(argStr.startsWith(argPrefix)) + if(firstToken) { - const QString argData = argStr.mid(2).trimmed(); + firstToken = false; + continue; /*skip executable file name*/ + } + if(iter->startsWith(argPrefix)) + { + const QString argData = iter->mid(2).trimmed(); if(argData.length() > 0) { const int separatorIndex = argData.indexOf(separator);