diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-07 19:47:13 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-07 19:47:13 +0000 |
commit | 097c52ad9a2928422084bf76cebee58958341574 (patch) | |
tree | 26d6b11e9738fc4e854f68c0ff04eaadf7d849e8 /plugins/YahooGroups/src/utils.cpp | |
parent | f096b29abb03618ec609ba4acaedaed43eec1fea (diff) |
end of the old database macroses
git-svn-id: http://svn.miranda-ng.org/main/trunk@4373 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YahooGroups/src/utils.cpp')
-rw-r--r-- | plugins/YahooGroups/src/utils.cpp | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp index 0a77deb1e4..4c1022fd76 100644 --- a/plugins/YahooGroups/src/utils.cpp +++ b/plugins/YahooGroups/src/utils.cpp @@ -169,34 +169,28 @@ int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, int res = 1;
int len;
dbv.type = DBVT_WCHAR;
- if (DBGetContactSettingWString(hContact, szModule, szSettingName, &dbv) == 0)
- {
- res = 0;
- if (dbv.type != DBVT_WCHAR)
- {
- MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, count);
- }
- else{
- int tmp = wcslen(dbv.pwszVal);
- len = (tmp < count - 1) ? tmp : count - 1;
- wcsncpy(szResult, dbv.pwszVal, len);
- szResult[len] = L'\0';
- }
- mir_free(dbv.pwszVal);
+ if ( db_get_s(hContact, szModule, szSettingName, &dbv, 0) == 0) {
+ res = 0;
+ if (dbv.type != DBVT_WCHAR)
+ MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, count);
+ else {
+ int tmp = wcslen(dbv.pwszVal);
+ len = (tmp < count - 1) ? tmp : count - 1;
+ wcsncpy(szResult, dbv.pwszVal, len);
+ szResult[len] = L'\0';
}
- else{
- res = 1;
- if (szError)
- {
- int tmp = wcslen(szError);
- len = (tmp < count - 1) ? tmp : count - 1;
- wcsncpy(szResult, szError, len);
- szResult[len] = L'\0';
- }
- else{
- szResult[0] = L'\0';
- }
+ mir_free(dbv.pwszVal);
+ }
+ else {
+ res = 1;
+ if (szError) {
+ int tmp = wcslen(szError);
+ len = (tmp < count - 1) ? tmp : count - 1;
+ wcsncpy(szResult, szError, len);
+ szResult[len] = L'\0';
}
+ else szResult[0] = L'\0';
+ }
return res;
}
|