From 61038ead217a3342a3e98500d30976b301acfee1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 7 Sep 2013 15:38:32 +0000 Subject: replacing DBVARIANT with ptrT for strings git-svn-id: http://svn.miranda-ng.org/main/trunk@6001 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/groups.cpp | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'src/modules') diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp index d99ed04a09..297d4b0b8f 100644 --- a/src/modules/clist/groups.cpp +++ b/src/modules/clist/groups.cpp @@ -31,36 +31,29 @@ static INT_PTR MoveGroupBefore(WPARAM wParam, LPARAM lParam); static int CountGroups(void) { - DBVARIANT dbv; - int i; - char str[33]; - - for (i=0;; i++) { + for (int i=0;; i++) { + char str[33]; _itoa(i, str, 10); - if (db_get(NULL, "CListGroups", str, &dbv)) - break; - db_free(&dbv); + ptrT grpName( db_get_tsa(NULL, "CListGroups", str)); + if (grpName == NULL) + return i; } - return i; } static int GroupNameExists(const TCHAR *name, int skipGroup) { - char idstr[33]; - DBVARIANT dbv; - int i; - - for (i=0;; i++) { + for (int i=0;; i++) { if (i == skipGroup) continue; + + char idstr[33]; _itoa(i, idstr, 10); - if (db_get_ts(NULL, "CListGroups", idstr, &dbv)) + ptrT grpName( db_get_tsa(NULL, "CListGroups", idstr)); + if (grpName == NULL) break; - if ( !_tcscmp(dbv.ptszVal + 1, name)) { - db_free(&dbv); + + if ( !_tcscmp((TCHAR*)grpName+1, name)) return i+1; - } - db_free(&dbv); } return 0; } -- cgit v1.2.3