From e44d626b32c534cace3a54d54778dfa9cf3599c9 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sat, 28 Feb 2015 11:12:19 +0000 Subject: Variables: -Minor fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@12285 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/src/parse_external.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'plugins/Variables/src/parse_external.cpp') diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp index 07fc3643b6..47aefa0410 100644 --- a/plugins/Variables/src/parse_external.cpp +++ b/plugins/Variables/src/parse_external.cpp @@ -60,8 +60,8 @@ static TCHAR *parseWinampSong(ARGUMENTSINFO *ai) return NULL; TCHAR *scur = _tcschr(szTitle, '.'); - TCHAR *cur = _tcsstr(scur, _T(" - Winamp")); - if ((scur == NULL) || (cur == NULL) || (scur >= cur) || (scur > (szTitle + _tcslen(szTitle) - 2)) || (cur > (szTitle + _tcslen(szTitle)))) { + TCHAR *cur; + if ((scur == NULL) || ((cur = _tcsstr(scur, _T(" - Winamp"))) == NULL) || (scur >= cur) || (scur > (szTitle + _tcslen(szTitle) - 2)) || (cur > (szTitle + _tcslen(szTitle)))) { mir_free(szTitle); return NULL; } @@ -86,21 +86,17 @@ static TCHAR *parseWinampState(ARGUMENTSINFO *ai) return NULL; TCHAR *scur = _tcschr(szTitle, '.'); - TCHAR *cur = _tcsstr(scur, _T(" - Winamp")); - if (scur == NULL || cur == NULL) { - mir_free(szTitle); - return mir_tstrdup(TranslateT("Stopped")); - } - if ((!_tcsncmp(cur + 10, _T("[Stopped]"), 9))) { - mir_free(szTitle); - return mir_tstrdup(TranslateT("Stopped")); - } - if ((!_tcsncmp(cur + 10, _T("[Paused]"), 8))) { - mir_free(szTitle); - return mir_tstrdup(TranslateT("Paused")); - } + TCHAR *cur; + if (scur == NULL || (cur = _tcsstr(scur, _T(" - Winamp"))) == NULL) + res = mir_tstrdup(TranslateT("Stopped")); + else if ((!_tcsncmp(cur + 10, _T("[Stopped]"), 9))) + res = mir_tstrdup(TranslateT("Stopped")); + else if ((!_tcsncmp(cur + 10, _T("[Paused]"), 8))) + res = mir_tstrdup(TranslateT("Paused")); + else + res = mir_tstrdup(_T("Playing")); mir_free(szTitle); - return mir_tstrdup(_T("Playing")); + return res; } void registerExternalTokens() -- cgit v1.2.3