diff options
author | George Hazan <ghazan@miranda.im> | 2019-02-17 16:11:48 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-02-19 19:24:16 +0300 |
commit | c1b2166e6abf0d89217c684358b9d5b815e0df19 (patch) | |
tree | 080dc707ccb34518f7940a3d1a5738573089f2a8 | |
parent | 851d9b82b6cd6f16821897e10c2c577cd2998d14 (diff) |
db_get_utfa -> new function to allocate utf strings dynamically
-rw-r--r-- | include/m_database.h | 25 | ||||
-rw-r--r-- | libs/win32/mir_core.lib | bin | 450814 -> 451020 bytes | |||
-rw-r--r-- | libs/win64/mir_core.lib | bin | 455676 -> 455858 bytes | |||
-rw-r--r-- | src/mir_core/src/db.cpp | 11 | ||||
-rw-r--r-- | src/mir_core/src/mir_core.def | 1 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 1 |
6 files changed, 22 insertions, 16 deletions
diff --git a/include/m_database.h b/include/m_database.h index 58b7845b6e..38761c1a03 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -379,26 +379,22 @@ EXTERN_C MIR_CORE_DLL(MEVENT) db_event_setId(const char *szModule, MEVENT hDbEve // Database settings
EXTERN_C MIR_CORE_DLL(INT_PTR) db_get(MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
+
EXTERN_C MIR_CORE_DLL(int) db_get_b(MCONTACT hContact, const char *szModule, const char *szSetting, int errorValue = 0);
EXTERN_C MIR_CORE_DLL(int) db_get_w(MCONTACT hContact, const char *szModule, const char *szSetting, int errorValue = 0);
EXTERN_C MIR_CORE_DLL(DWORD) db_get_dw(MCONTACT hContact, const char *szModule, const char *szSetting, DWORD errorValue = 0);
EXTERN_C MIR_CORE_DLL(char*) db_get_sa(MCONTACT hContact, const char *szModule, const char *szSetting, const char *szValue = nullptr);
+EXTERN_C MIR_CORE_DLL(char*) db_get_utfa(MCONTACT hContact, const char *szModule, const char *szSetting, const char *szValue = nullptr);
EXTERN_C MIR_CORE_DLL(wchar_t*) db_get_wsa(MCONTACT hContact, const char *szModule, const char *szSetting, const wchar_t *szValue = nullptr);
-MIR_CORE_DLL(CMStringA) db_get_sm(MCONTACT hContact, const char *szModule, const char *szSetting);
-MIR_CORE_DLL(CMStringW) db_get_wsm(MCONTACT hContact, const char *szModule, const char *szSetting);
+MIR_CORE_DLL(CMStringA) db_get_sm(MCONTACT hContact, const char *szModule, const char *szSetting);
+MIR_CORE_DLL(CMStringW) db_get_wsm(MCONTACT hContact, const char *szModule, const char *szSetting);
EXTERN_C MIR_CORE_DLL(int) db_get_static(MCONTACT hContact, const char *szModule, const char *szSetting, char *pDest, int cbDest);
EXTERN_C MIR_CORE_DLL(int) db_get_static_utf(MCONTACT hContact, const char *szModule, const char *szSetting, char *pDest, int cbDest);
EXTERN_C MIR_CORE_DLL(int) db_get_wstatic(MCONTACT hContact, const char *szModule, const char *szSetting, wchar_t *pDest, int cbDest);
-#if defined(__cplusplus)
-EXTERN_C MIR_CORE_DLL(INT_PTR) db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType = DBVT_ASCIIZ);
-#else
-EXTERN_C MIR_CORE_DLL(INT_PTR) db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType);
-#endif
-
EXTERN_C MIR_CORE_DLL(INT_PTR) db_set(MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
EXTERN_C MIR_CORE_DLL(INT_PTR) db_set_b(MCONTACT hContact, const char *szModule, const char *szSetting, BYTE val);
EXTERN_C MIR_CORE_DLL(INT_PTR) db_set_w(MCONTACT hContact, const char *szModule, const char *szSetting, WORD val);
@@ -408,16 +404,13 @@ EXTERN_C MIR_CORE_DLL(INT_PTR) db_set_ws(MCONTACT hContact, const char *szModul EXTERN_C MIR_CORE_DLL(INT_PTR) db_set_utf(MCONTACT hContact, const char *szModule, const char *szSetting, const char *val);
EXTERN_C MIR_CORE_DLL(INT_PTR) db_set_blob(MCONTACT hContact, const char *szModule, const char *szSetting, void *val, unsigned len);
-EXTERN_C MIR_CORE_DLL(INT_PTR) db_unset(MCONTACT hContact, const char *szModule, const char *szSetting);
+EXTERN_C MIR_CORE_DLL(INT_PTR) db_unset(MCONTACT hContact, const char *szModule, const char *szSetting);
-#if defined(__cplusplus)
-EXTERN_C MIR_CORE_DLL(BOOL) db_set_resident(const char *szModule, const char *szService, BOOL bEnable = TRUE);
-#else
-EXTERN_C MIR_CORE_DLL(BOOL) db_set_resident(const char *szModule, const char *szService, BOOL bEnable);
-#endif
+EXTERN_C MIR_CORE_DLL(BOOL) db_set_resident(const char *szModule, const char *szService, BOOL bEnable = true);
-#define db_get_ws(a,b,c,d) db_get_s(a,b,c,d,DBVT_WCHAR)
-#define db_get_utf(a,b,c,d) db_get_s(a,b,c,d,DBVT_UTF8)
+EXTERN_C MIR_CORE_DLL(INT_PTR) db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType = DBVT_ASCIIZ);
+#define db_get_ws(a,b,c,d) db_get_s(a,b,c,d,DBVT_WCHAR)
+#define db_get_utf(a,b,c,d) db_get_s(a,b,c,d,DBVT_UTF8)
/////////////////////////////////////////////////////////////////////////////////////////
// Profile services
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib Binary files differindex 2ca60efda1..5e2d769ab2 100644 --- a/libs/win32/mir_core.lib +++ b/libs/win32/mir_core.lib diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib Binary files differindex cafde673c6..8c0be36c5d 100644 --- a/libs/win64/mir_core.lib +++ b/libs/win64/mir_core.lib diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp index 56500eaff2..aee2097ade 100644 --- a/src/mir_core/src/db.cpp +++ b/src/mir_core/src/db.cpp @@ -174,6 +174,17 @@ MIR_CORE_DLL(char*) db_get_sa(MCONTACT hContact, const char *szModule, const cha return (szValue == nullptr) ? nullptr : mir_strdup(szValue);
}
+MIR_CORE_DLL(char*) db_get_utfa(MCONTACT hContact, const char *szModule, const char *szSetting, const char *szValue)
+{
+ if (currDb) {
+ DBVARIANT dbv = { DBVT_UTF8 };
+ if (!currDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv))
+ return dbv.pszVal;
+ }
+
+ return (szValue == nullptr) ? nullptr : mir_strdup(szValue);
+}
+
MIR_CORE_DLL(wchar_t*) db_get_wsa(MCONTACT hContact, const char *szModule, const char *szSetting, const wchar_t *szValue)
{
if (currDb) {
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 112500b679..a70c6493e0 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1415,3 +1415,4 @@ db_event_edit @1268 ?SetAttribute@XMLElement@tinyxml2@@QAEXPBDPB_W@Z @1628 NONAME
??AXMLConstHandle@tinyxml2@@QBE?BV01@PBD@Z @1629 NONAME
??AXMLHandle@tinyxml2@@QAE?AV01@PBD@Z @1630 NONAME
+db_get_utfa @1631
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index eac6cc4c13..d4dced17cf 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1415,3 +1415,4 @@ db_event_edit @1268 ?SetAttribute@XMLElement@tinyxml2@@QEAAXPEBDPEB_W@Z @1628 NONAME
??AXMLConstHandle@tinyxml2@@QEBA?BV01@PEBD@Z @1629 NONAME
??AXMLHandle@tinyxml2@@QEAA?AV01@PEBD@Z @1630 NONAME
+db_get_utfa @1631
|