summaryrefslogtreecommitdiff
path: root/src/modules/clist/groups.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-07 15:38:32 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-07 15:38:32 +0000
commit61038ead217a3342a3e98500d30976b301acfee1 (patch)
tree2e7551a09c353735f0149c93da23f263e6f66ac9 /src/modules/clist/groups.cpp
parent453f94dc5ae1a9efb1ee85aff1aaf20a7ef51723 (diff)
replacing DBVARIANT with ptrT for strings
git-svn-id: http://svn.miranda-ng.org/main/trunk@6001 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/clist/groups.cpp')
-rw-r--r--src/modules/clist/groups.cpp31
1 files changed, 12 insertions, 19 deletions
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;
}