summaryrefslogtreecommitdiff
path: root/plugins/HTTPServer/src/GuiElements.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-07-24 11:11:26 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-07-24 11:11:26 +0300
commitd296f9f99daf102b9af5d56690e2bd00d61c1267 (patch)
tree39311caaf80abf0b47ecb78cf94dc8157b193575 /plugins/HTTPServer/src/GuiElements.cpp
parentffc521e5d5e9bd66feb65afe0046b3fc7e073356 (diff)
database:
- senseless fiels ptszVal removed from DBVARIANT, pwszVal is used instead; - if you want db_get to return a string, you need to use db_get_s.
Diffstat (limited to 'plugins/HTTPServer/src/GuiElements.cpp')
-rw-r--r--plugins/HTTPServer/src/GuiElements.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp
index 44c430dd8b..726f5947da 100644
--- a/plugins/HTTPServer/src/GuiElements.cpp
+++ b/plugins/HTTPServer/src/GuiElements.cpp
@@ -97,16 +97,12 @@ string DBGetString(MCONTACT hContact, const char *szModule, const char *szSettin
{
string ret;
DBVARIANT dbv = { 0 };
- if (!db_get(hContact, szModule, szSetting, &dbv)) {
- if (dbv.type != DBVT_ASCIIZ) {
- MessageBox(nullptr, "DB: Attempt to get wrong type of value, string", MSG_BOX_TITEL, MB_OK);
- ret = pszError;
- }
- else ret = dbv.pszVal;
+ if (!db_get_s(hContact, szModule, szSetting, &dbv)) {
+ ret = dbv.pszVal;
+ db_free(&dbv);
}
else ret = pszError;
- db_free(&dbv);
return ret;
}
@@ -1033,14 +1029,12 @@ static INT_PTR nShareNewFile(WPARAM hContact, LPARAM lParam)
if (hContact) {
// Try to locate an IP address.
DBVARIANT dbv = { 0 };
- if (!db_get(hContact, "Protocol", "p", &dbv)) {
- if (dbv.type == DBVT_ASCIIZ) {
- stNewShare.dwAllowedIP = db_get_dw(hContact, dbv.pszVal, "IP", 0);
- if (!stNewShare.dwAllowedIP)
- stNewShare.dwAllowedIP = db_get_dw(hContact, dbv.pszVal, "RealIP", 0);
- if (!stNewShare.dwAllowedIP)
- stNewShare.dwAllowedIP = db_get_dw(hContact, MODULENAME, "LastUsedIP", 0);
- }
+ if (!db_get_s(hContact, "Protocol", "p", &dbv)) {
+ stNewShare.dwAllowedIP = db_get_dw(hContact, dbv.pszVal, "IP", 0);
+ if (!stNewShare.dwAllowedIP)
+ stNewShare.dwAllowedIP = db_get_dw(hContact, dbv.pszVal, "RealIP", 0);
+ if (!stNewShare.dwAllowedIP)
+ stNewShare.dwAllowedIP = db_get_dw(hContact, MODULENAME, "LastUsedIP", 0);
}
db_free(&dbv);