diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-02-28 11:12:19 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-02-28 11:12:19 +0000 |
commit | e44d626b32c534cace3a54d54778dfa9cf3599c9 (patch) | |
tree | a95c360ecc005240041a31fc1c13554cd72dfefb | |
parent | b1530a48bd67d19f6a18355e04a884b36c696e8b (diff) |
Variables:
-Minor fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@12285 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Variables/src/help.cpp | 3 | ||||
-rw-r--r-- | plugins/Variables/src/parse_external.cpp | 28 | ||||
-rw-r--r-- | plugins/Variables/src/parse_metacontacts.cpp | 6 | ||||
-rw-r--r-- | plugins/Variables/src/parse_miranda.cpp | 6 | ||||
-rw-r--r-- | plugins/Variables/src/parse_system.cpp | 5 |
5 files changed, 18 insertions, 30 deletions
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index ee22d223ac..e19b39e297 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -485,9 +485,6 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM wPar break; size_t len = _tcslen(tr->tszTokenString) + 2; - if (len < 0) - break; - TCHAR *tokenString = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR)); if (tokenString == NULL) break; 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()
diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index 9ba853fb70..281cac0556 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -148,10 +148,12 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
+ if (szProto == NULL)
+ return NULL;
szUniqueID = (TCHAR *)mir_alloc(32);
- mir_sntprintf(szUniqueID, 32, _T("%p"), hContact);
- if (szProto == NULL || szUniqueID == NULL)
+ if (szUniqueID == NULL)
return NULL;
+ mir_sntprintf(szUniqueID, 32, _T("%p"), hContact);
}
size_t size = strlen(szProto) + _tcslen(szUniqueID) + 4;
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 23f7c42d79..f6dec5c4d0 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -527,11 +527,9 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags) hDbEvent = db_event_prev(hContact, hDbEvent);
}
else {
- MEVENT hMatchEvent, hSearchEvent;
- DWORD matchTimestamp, priorTimestamp;
+ MEVENT hMatchEvent = NULL, hSearchEvent = NULL;
+ DWORD matchTimestamp = 0, priorTimestamp = 0;
- hMatchEvent = hSearchEvent = NULL;
- matchTimestamp = priorTimestamp = 0;
if (flags & DBE_FIRST) {
for (MCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
hSearchEvent = findDbEvent(hSearchContact, NULL, flags);
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp index b17266b807..ab94f0dca0 100644 --- a/plugins/Variables/src/parse_system.cpp +++ b/plugins/Variables/src/parse_system.cpp @@ -725,11 +725,6 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) }
while ((totalReadSz < fileSz) && (readSz > 0));
- if (linePos < 0) {
- CloseHandle(hFile);
- mir_free(pBuf);
- return NULL;
- }
if (SetFilePointer(hFile, linePos, NULL, FILE_BEGIN) != linePos) {
CloseHandle(hFile);
mir_free(pBuf);
|