From 109877a3c75cb290c55755dcfc88794d2453669d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 30 Mar 2013 17:32:39 +0000 Subject: MS_DB_EVENT_* services remained, but their calls removed git-svn-id: http://svn.miranda-ng.org/main/trunk@4255 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/src/parse_miranda.cpp | 30 +++++++++++++++--------------- plugins/Variables/src/parse_str.cpp | 15 +++++++-------- plugins/Variables/src/parse_xml.cpp | 4 ++-- 3 files changed, 24 insertions(+), 25 deletions(-) (limited to 'plugins/Variables/src') diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 7216811be9..3a28fcde05 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -532,18 +532,18 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) dbe.pBlob = NULL; if (hContact != NULL) { if ((flags & DBE_FIRST) && (flags & DBE_UNREAD)) { - hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0); + hDbEvent = db_event_firstUnread(hContact); if (hDbEvent == NULL && (flags & DBE_READ)) - hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRST, (WPARAM)hContact, 0); + hDbEvent = db_event_first(hContact); } else if (flags & DBE_FIRST) - hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRST, (WPARAM)hContact, 0); + hDbEvent = db_event_first(hContact); else if (flags & DBE_LAST) - hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0); + hDbEvent = db_event_last(hContact); else if (flags & DBE_NEXT) - hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0); + hDbEvent = db_event_next(hDbEvent); else if (flags & DBE_PREV) - hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hDbEvent, 0); + hDbEvent = db_event_prev(hDbEvent); } else { HANDLE hMatchEvent, hSearchEvent, hSearchContact; @@ -556,7 +556,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) do { hSearchEvent = findDbEvent(hSearchContact, NULL, flags); dbe.cbBlob = 0; - if (!CallService(MS_DB_EVENT_GET, (WPARAM)hSearchEvent, (LPARAM)&dbe)) { + if (!db_event_get(hSearchEvent, &dbe)) { if ((dbe.timestamp < matchTimestamp) || (matchTimestamp == 0)) { hMatchEvent = hSearchEvent; matchTimestamp = dbe.timestamp; @@ -571,7 +571,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) do { hSearchEvent = findDbEvent(hSearchContact, NULL, flags); dbe.cbBlob = 0; - if (!CallService(MS_DB_EVENT_GET, (WPARAM)hSearchEvent, (LPARAM)&dbe)) { + if (!db_event_get(hSearchEvent, &dbe)) { if ((dbe.timestamp > matchTimestamp) || (matchTimestamp == 0)) { hMatchEvent = hSearchEvent; matchTimestamp = dbe.timestamp; @@ -583,13 +583,13 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) } else if (flags&DBE_NEXT) { dbe.cbBlob = 0; - if (!CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbe)) { + if (!db_event_get(hDbEvent, &dbe)) { priorTimestamp = dbe.timestamp; hSearchContact = db_find_first(); do { hSearchEvent = findDbEvent(hSearchContact, hDbEvent, flags); dbe.cbBlob = 0; - if (!CallService(MS_DB_EVENT_GET, (WPARAM)hSearchEvent, (LPARAM)&dbe)) { + if (!db_event_get(hSearchEvent, &dbe)) { if (((dbe.timestamp < matchTimestamp) || (matchTimestamp == 0)) && (dbe.timestamp > priorTimestamp)) { hMatchEvent = hSearchEvent; matchTimestamp = dbe.timestamp; @@ -601,13 +601,13 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) } } else if (flags&DBE_PREV) { - if (!CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbe)) { + if (!db_event_get(hDbEvent, &dbe)) { priorTimestamp = dbe.timestamp; hSearchContact = db_find_first(); do { hSearchEvent = findDbEvent(hSearchContact, hDbEvent, flags); dbe.cbBlob = 0; - if (!CallService(MS_DB_EVENT_GET, (WPARAM)hSearchEvent, (LPARAM)&dbe)) { + if (!db_event_get(hSearchEvent, &dbe)) { if (((dbe.timestamp > matchTimestamp) || (matchTimestamp == 0)) && (dbe.timestamp < priorTimestamp)) { hMatchEvent = hSearchEvent; matchTimestamp = dbe.timestamp; @@ -620,7 +620,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) } } dbe.cbBlob = 0; - if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbe)) + if (db_event_get(hDbEvent, &dbe)) bEventOk = FALSE; else bEventOk = isValidDbEvent(&dbe, flags); @@ -698,9 +698,9 @@ static TCHAR *parseDbEvent(ARGUMENTSINFO *ai) DBEVENTINFO dbe = { 0 }; dbe.cbSize = sizeof(DBEVENTINFO); - dbe.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0); + dbe.cbBlob = db_event_getBlobSize(hDbEvent); dbe.pBlob = (PBYTE)mir_calloc(dbe.cbBlob); - if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbe)) { + if (db_event_get(hDbEvent, &dbe)) { mir_free(dbe.pBlob); return NULL; } diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index 37b8c4af4b..3061ae7bf6 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -633,15 +633,14 @@ static TCHAR *parseSubstr(ARGUMENTSINFO *ai) { return NULL; } from = max(ttoi(ai->targv[2])-1, 0); - if (ai->argc > 3) { - to = min(ttoi(ai->targv[3]), (signed int)_tcslen(ai->targv[1])); - } - else { - to = _tcslen(ai->targv[1]); - } - if (to < from) { + if (ai->argc > 3) + to = min(ttoi(ai->targv[3]), (int)_tcslen(ai->targv[1])); + else + to = (int)_tcslen(ai->targv[1]); + + if (to < from) return NULL; - } + res = (TCHAR*)mir_alloc((to-from+1)*sizeof(TCHAR)); ZeroMemory(res, (to-from+1)*sizeof(TCHAR)); _tcsncpy(res, ai->targv[1]+from, to-from); diff --git a/plugins/Variables/src/parse_xml.cpp b/plugins/Variables/src/parse_xml.cpp index 98c622622b..9407aa7ee9 100644 --- a/plugins/Variables/src/parse_xml.cpp +++ b/plugins/Variables/src/parse_xml.cpp @@ -52,7 +52,7 @@ static TCHAR *parseXslts(ARGUMENTSINFO *ai) { log_debugA("calling xsltParseMemory"); - xmlDocPtr sdoc = pXmlParseMemory(szStyleSheet, strlen(szStyleSheet)); + xmlDocPtr sdoc = pXmlParseMemory(szStyleSheet, (int)strlen(szStyleSheet)); if (sdoc == NULL) { return NULL; } @@ -67,7 +67,7 @@ static TCHAR *parseXslts(ARGUMENTSINFO *ai) { } log_debugA("calling xsltParseMemory"); - xmlDocPtr doc = pXmlParseMemory(szDoc, strlen(szDoc)); + xmlDocPtr doc = pXmlParseMemory(szDoc, (int)strlen(szDoc)); if (doc == NULL) { log_debugA("calling xsltFreeDoc"); pXmlFreeDoc(sdoc); -- cgit v1.2.3