diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-01 10:21:56 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-01 10:21:56 +0000 |
commit | a41c9020b7fcbc4d05fcb37097177cc0efc7cdce (patch) | |
tree | 5bda74986883a9152123474152c6546547211b9d /plugins/Variables | |
parent | 0ae8779546586eba91408d03949d45ec9ced5133 (diff) |
db_helpers.cpp deleted
git-svn-id: http://svn.miranda-ng.org/main/trunk@708 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Variables')
-rw-r--r-- | plugins/Variables/Variables_10.vcxproj | 3 | ||||
-rw-r--r-- | plugins/Variables/Variables_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/Variables/action_variables.cpp | 7 | ||||
-rw-r--r-- | plugins/Variables/help.cpp | 11 | ||||
-rw-r--r-- | plugins/Variables/main.cpp | 3 | ||||
-rw-r--r-- | plugins/Variables/options.cpp | 18 | ||||
-rw-r--r-- | plugins/Variables/parse_str.cpp | 316 | ||||
-rw-r--r-- | plugins/Variables/variables.cpp | 10 | ||||
-rw-r--r-- | plugins/Variables/variables.h | 6 |
9 files changed, 158 insertions, 219 deletions
diff --git a/plugins/Variables/Variables_10.vcxproj b/plugins/Variables/Variables_10.vcxproj index 209eb885f5..1350edd98b 100644 --- a/plugins/Variables/Variables_10.vcxproj +++ b/plugins/Variables/Variables_10.vcxproj @@ -208,9 +208,6 @@ <ClCompile Include="action_variables.cpp" />
<ClCompile Include="condition_variables.cpp" />
<ClCompile Include="trigger_variables.cpp" />
- <ClCompile Include="..\helpers\db_helpers.cpp">
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- </ClCompile>
<ClCompile Include="..\helpers\gen_helpers.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
diff --git a/plugins/Variables/Variables_10.vcxproj.filters b/plugins/Variables/Variables_10.vcxproj.filters index ecd6ebe9ce..03ffbf41a4 100644 --- a/plugins/Variables/Variables_10.vcxproj.filters +++ b/plugins/Variables/Variables_10.vcxproj.filters @@ -94,9 +94,6 @@ <ClCompile Include="trigger_variables.cpp">
<Filter>TriggerPlugin</Filter>
</ClCompile>
- <ClCompile Include="..\helpers\db_helpers.cpp">
- <Filter>External</Filter>
- </ClCompile>
<ClCompile Include="..\helpers\gen_helpers.cpp">
<Filter>External</Filter>
</ClCompile>
diff --git a/plugins/Variables/action_variables.cpp b/plugins/Variables/action_variables.cpp index d767250578..e4d1a17aa1 100644 --- a/plugins/Variables/action_variables.cpp +++ b/plugins/Variables/action_variables.cpp @@ -139,11 +139,8 @@ INT_PTR CALLBACK DlgProcOptsParseString(HWND hwndDlg, UINT msg, WPARAM wParam, L case TM_ADDACTION: {
// wParam = action ID
// lParam = 0
- DWORD actionID;
- TCHAR *tszText;
-
- actionID = (DWORD)wParam;
- tszText = Hlp_GetDlgItemText(hwndDlg, IDC_PARSESTRING);
+ DWORD actionID = (DWORD)wParam;
+ TCHAR *tszText = Hlp_GetDlgItemText(hwndDlg, IDC_PARSESTRING);
if (tszText != NULL) {
DBWriteActionSettingTString(actionID, NULL, MODULENAME, SETTING_PARSESTRING, tszText);
mir_free(tszText);
diff --git a/plugins/Variables/help.cpp b/plugins/Variables/help.cpp index 66d24ee12f..9c35806f11 100644 --- a/plugins/Variables/help.cpp +++ b/plugins/Variables/help.cpp @@ -148,14 +148,13 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM break;
case VARM_SETSUBJECT: {
- TCHAR *tszContact;
LPARAM res = 0;
HANDLE hContact, hItem;
hContact = (HANDLE)wParam;
log_debugA("VARM_SETSUBJECT: %u", hContact);
if (hContact == INVALID_HANDLE_VALUE) {
- tszContact = db_gets(SETTING_SUBJECT, NULL);
+ TCHAR *tszContact = db_get_tsa(NULL, MODULENAME, SETTING_SUBJECT);
log_debugA("VARM_SETSUBJECT: %s", tszContact);
if (tszContact != NULL) {
hContact = decodeContactFromString(tszContact);
@@ -233,13 +232,13 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM break;
case WM_DESTROY:
- db_del(SETTING_SUBJECT);
+ db_unset(NULL, MODULENAME, SETTING_SUBJECT);
{
HANDLE hContact = (HANDLE)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0);
if (hContact != NULL) {
TCHAR *tszContact = encodeContactToString(hContact);
if (tszContact != NULL) {
- db_sets(SETTING_SUBJECT, tszContact);
+ db_set_ts(NULL, MODULENAME, SETTING_SUBJECT, tszContact);
mir_free(tszContact);
} } }
break;
@@ -677,7 +676,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM ZeroMemory(dat, sizeof(INPUTDLGDATA));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
// splitter things
- dat->splitterPos = (INT_PTR)db_getd(SETTING_SPLITTERPOS, -1);
+ dat->splitterPos = (INT_PTR)db_get_dw(NULL, MODULENAME, SETTING_SPLITTERPOS, -1);
{
RECT rc;
POINT pt;
@@ -816,7 +815,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM case WM_DESTROY:
KillTimer(hwndDlg, IDT_PARSE);
- db_setd(SETTING_SPLITTERPOS, dat->splitterPos);
+ db_set_dw(NULL, MODULENAME, SETTING_SPLITTERPOS, dat->splitterPos);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) OldSplitterProc);
if (dat != NULL) {
mir_free(dat);
diff --git a/plugins/Variables/main.cpp b/plugins/Variables/main.cpp index 4d47d84439..fc0d49147a 100644 --- a/plugins/Variables/main.cpp +++ b/plugins/Variables/main.cpp @@ -80,9 +80,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" int __declspec(dllexport) Load(void)
{
-
- if (UnicodeCheck(pluginInfoEx.shortName, FALSE))
- return 0;
mir_getLP( &pluginInfoEx );
hExitHook = HookEvent(ME_SYSTEM_OKTOEXIT, Exit);
diff --git a/plugins/Variables/options.cpp b/plugins/Variables/options.cpp index e94e27fcdf..0220386564 100644 --- a/plugins/Variables/options.cpp +++ b/plugins/Variables/options.cpp @@ -34,10 +34,10 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA DBFreeVariant(&dbv);
}
}
- CheckDlgButton(hwndDlg, IDC_PARSEATSTARTUP, db_getb(SETTING_PARSEATSTARTUP, 0));
- CheckDlgButton(hwndDlg, IDC_STRIPCRLF, db_getb(SETTING_STRIPCRLF, 0));
- CheckDlgButton(hwndDlg, IDC_STRIPWS, db_getb(SETTING_STRIPWS, 0));
- CheckDlgButton(hwndDlg, IDC_STRIPALL, db_getb(SETTING_STRIPALL, 0));
+ CheckDlgButton(hwndDlg, IDC_PARSEATSTARTUP, db_get_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, 0));
+ CheckDlgButton(hwndDlg, IDC_STRIPCRLF, db_get_b(NULL, MODULENAME, SETTING_STRIPCRLF, 0));
+ CheckDlgButton(hwndDlg, IDC_STRIPWS, db_get_b(NULL, MODULENAME, SETTING_STRIPWS, 0));
+ CheckDlgButton(hwndDlg, IDC_STRIPALL, db_get_b(NULL, MODULENAME, SETTING_STRIPALL, 0));
EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPCRLF), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?FALSE:TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPWS), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?FALSE:TRUE);
variables_skin_helpbutton(hwndDlg, IDC_SHOWHELP);
@@ -93,14 +93,14 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA break;
if (GetDlgItemText(hwndDlg, IDC_FORMATTEXT, szFormatText, len+1) != 0)
- db_sets(SETTING_STARTUPTEXT, szFormatText);
+ db_set_ts(NULL, MODULENAME, SETTING_STARTUPTEXT, szFormatText);
mir_free(szFormatText);
}
- db_setb(SETTING_PARSEATSTARTUP, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PARSEATSTARTUP)?1:0));
- db_setb(SETTING_STRIPCRLF, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPCRLF)?1:0));
- db_setb(SETTING_STRIPWS, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPWS)?1:0));
- db_setb(SETTING_STRIPALL, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?1:0));
+ db_set_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PARSEATSTARTUP)?1:0));
+ db_set_b(NULL, MODULENAME, SETTING_STRIPCRLF, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPCRLF)?1:0));
+ db_set_b(NULL, MODULENAME, SETTING_STRIPWS, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPWS)?1:0));
+ db_set_b(NULL, MODULENAME, SETTING_STRIPALL, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?1:0));
}
break;
diff --git a/plugins/Variables/parse_str.cpp b/plugins/Variables/parse_str.cpp index 4ee815cdae..112b064d1f 100644 --- a/plugins/Variables/parse_str.cpp +++ b/plugins/Variables/parse_str.cpp @@ -19,15 +19,13 @@ #include "variables.h"
#include "parse_str.h"
-static TCHAR *parseCaps(ARGUMENTSINFO *ai) {
-
- TCHAR *cur, *res;
-
+static TCHAR *parseCaps(ARGUMENTSINFO *ai)
+{
if (ai->argc != 2)
return NULL;
- res = mir_tstrdup(ai->targv[1]);
- cur = res;
+ TCHAR *res = mir_tstrdup(ai->targv[1]);
+ TCHAR *cur = res;
CharLower(res);
*cur = (TCHAR)CharUpper((LPTSTR)*cur);
cur++;
@@ -46,15 +44,13 @@ static TCHAR *parseCaps(ARGUMENTSINFO *ai) { return res;
}
-static TCHAR *parseCaps2(ARGUMENTSINFO *ai) {
-
- TCHAR *cur, *res;
-
+static TCHAR *parseCaps2(ARGUMENTSINFO *ai)
+{
if (ai->argc != 2)
return NULL;
- res = mir_tstrdup(ai->targv[1]);
- cur = res;
+ TCHAR *res = mir_tstrdup(ai->targv[1]);
+ TCHAR *cur = res;
*cur = (TCHAR)CharUpper((LPTSTR)*cur);
cur++;
while (*cur != _T('\0')) {
@@ -68,93 +64,84 @@ static TCHAR *parseCaps2(ARGUMENTSINFO *ai) { return res;
}
-static TCHAR *parseCrlf(ARGUMENTSINFO *ai) {
-
+static TCHAR *parseCrlf(ARGUMENTSINFO *ai)
+{
ai->flags |= AIF_DONTPARSE;
-
return mir_tstrdup(_T("\r\n"));
}
-static TCHAR *parseEolToCrlf(ARGUMENTSINFO *ai) {
-
- int loc;
- TCHAR *cur, *res;
-
- if (ai->argc != 2) {
+static TCHAR *parseEolToCrlf(ARGUMENTSINFO *ai)
+{
+ if (ai->argc != 2)
return NULL;
- }
- res = mir_tstrdup(ai->targv[1]);
- cur = res;
+
+ TCHAR *res = mir_tstrdup(ai->targv[1]);
+ TCHAR *cur = res;
do {
cur = _tcschr(cur, _T('\n'));
- if ((cur == NULL) || ((cur > res) && (*(cur-1) == '\r'))) {
+ if ((cur == NULL) || ((cur > res) && (*(cur-1) == '\r')))
continue;
- }
+
log_debug(cur);
- loc = cur - res;
+ int loc = cur - res;
res = (TCHAR*)mir_realloc(res, (_tcslen(res)+2)*sizeof(TCHAR));
cur = res + loc;
MoveMemory(cur+2, cur+1, (_tcslen(cur+1)+1)*sizeof(TCHAR));
CopyMemory(cur, _T("\r\n"), 2*sizeof(TCHAR));
cur += 2;
- } while (cur != NULL);
+ }
+ while (cur != NULL);
return res;
}
-static TCHAR *parseFixeol(ARGUMENTSINFO *ai) {
-
- TCHAR *cur, *szReplacement, *res;
-
- if (ai->argc == 2) {
+static TCHAR *parseFixeol(ARGUMENTSINFO *ai)
+{
+ TCHAR *szReplacement;
+ if (ai->argc == 2)
szReplacement = _T("(...)");
- }
- else if (ai->argc == 3) {
+ else if (ai->argc == 3)
szReplacement = ai->targv[2];
- }
- else {
+ else
return NULL;
- }
- cur = ai->targv[1];
- while ( (_tcscmp(cur, _T("\r\n"))) && (*cur != _T('\n')) && (*cur != _T('\0'))) {
+
+ TCHAR *cur = ai->targv[1];
+ while ( (_tcscmp(cur, _T("\r\n"))) && (*cur != _T('\n')) && (*cur != _T('\0')))
cur++;
- }
- if (*cur == '\0') {
+
+ if (*cur == '\0')
return mir_tstrdup(ai->targv[1]);
- }
+
cur--;
- res = (TCHAR*)mir_alloc((cur-ai->targv[1] + _tcslen(szReplacement) + 1)*sizeof(TCHAR));
- if (res == NULL) {
+ TCHAR *res = (TCHAR*)mir_alloc((cur-ai->targv[1] + _tcslen(szReplacement) + 1)*sizeof(TCHAR));
+ if (res == NULL)
return res;
- }
+
ZeroMemory(res, ((cur - ai->targv[1]) + 1)*sizeof(TCHAR));
_tcsncpy(res, ai->targv[1], cur-ai->targv[1]);
_tcscat(res, szReplacement);
-
return res;
}
-static TCHAR *parseFixeol2(ARGUMENTSINFO *ai) {
-
- TCHAR *res, *cur, *szEol, *szReplacement;
-
- unsigned int pos = 0;
- res = mir_tstrdup(ai->targv[1]);
+static TCHAR *parseFixeol2(ARGUMENTSINFO *ai)
+{
+ TCHAR *szReplacement;
switch( ai->argc ) {
case 2: szReplacement = _T(" "); break;
case 3: szReplacement = ai->targv[2]; break;
default: return NULL;
}
- for ( pos=0; pos < _tcslen(res); pos++ ) {
- cur = res+pos;
- szEol = NULL;
- if (!_tcsncmp(cur, _T("\r\n"), _tcslen(_T("\r\n")))) {
+ TCHAR *res = mir_tstrdup(ai->targv[1]);
+ for (unsigned int pos=0; pos < _tcslen(res); pos++ ) {
+ TCHAR *cur = res+pos;
+ TCHAR *szEol = NULL;
+ if (!_tcsncmp(cur, _T("\r\n"), _tcslen(_T("\r\n"))))
szEol = _T("\r\n");
- }
- if (*cur == _T('\n')) {
+
+ if (*cur == _T('\n'))
szEol = _T("\n");
- }
+
if (szEol != NULL) {
if ( _tcslen(szReplacement) > _tcslen(szEol)) {
res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(szReplacement) - _tcslen(szEol) + 1)*sizeof(TCHAR));
@@ -165,218 +152,185 @@ static TCHAR *parseFixeol2(ARGUMENTSINFO *ai) { pos += _tcslen(szReplacement) - 1;
}
}
- res = (TCHAR*)mir_realloc(res, (_tcslen(res)+1)*sizeof(TCHAR));
-
- return res;
+ return (TCHAR*)mir_realloc(res, (_tcslen(res)+1)*sizeof(TCHAR));
}
-static TCHAR *parseInsert(ARGUMENTSINFO *ai) {
-
- TCHAR *res;
- unsigned int pos;
-
- if (ai->argc != 4) {
+static TCHAR *parseInsert(ARGUMENTSINFO *ai)
+{
+ if (ai->argc != 4)
return NULL;
- }
- pos = ttoi(ai->targv[3]);
- if (pos > _tcslen(ai->targv[1])) {
+ unsigned int pos = ttoi(ai->targv[3]);
+ if (pos > _tcslen(ai->targv[1]))
return NULL;
- }
- res = (TCHAR*)mir_alloc((_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1)*sizeof(TCHAR));
- if (res == NULL) {
+
+ TCHAR *res = (TCHAR*)mir_alloc((_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1)*sizeof(TCHAR));
+ if (res == NULL)
return NULL;
- }
+
ZeroMemory(res, (_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1)*sizeof(TCHAR));
_tcsncpy(res, ai->targv[1], pos);
_tcscpy(res + pos, ai->targv[2]);
_tcscpy(res+pos+_tcslen(ai->targv[2]), ai->targv[1]+pos);
-
return res;
}
-static TCHAR *parseLeft(ARGUMENTSINFO *ai) {
-
- int len;
- TCHAR *res;
-
- if (ai->argc != 3) {
+static TCHAR *parseLeft(ARGUMENTSINFO *ai)
+{
+ if (ai->argc != 3)
return NULL;
- }
- len = ttoi(ai->targv[2]);
- if (len < 0) {
+
+ int len = ttoi(ai->targv[2]);
+ if (len < 0)
return NULL;
- }
+
len = min(len, (signed int)_tcslen(ai->targv[1]));
- res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
- if (res == NULL) {
+ TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
+ if (res == NULL)
return NULL;
- }
+
ZeroMemory(res, (len+1)*sizeof(TCHAR));
_tcsncpy(res, ai->targv[1], len);
-
return res;
}
-static TCHAR *parseLen(ARGUMENTSINFO *ai) {
-
- int len;
-
- if (ai->argc != 2) {
+static TCHAR *parseLen(ARGUMENTSINFO *ai)
+{
+ if (ai->argc != 2)
return NULL;
- }
- len = _tcslen(ai->targv[1]);
-
- return itot(len);
-}
-static TCHAR *parseLineCount(ARGUMENTSINFO *ai) {
-
- int count;
- TCHAR *cur;
+ return itot( _tcslen( ai->targv[1] ));
+}
- if (ai->argc != 2) {
+static TCHAR *parseLineCount(ARGUMENTSINFO *ai)
+{
+ if (ai->argc != 2)
return NULL;
- }
- count = 1;
- cur = ai->targv[1];
+
+ int count = 1;
+ TCHAR *cur = ai->targv[1];
while (cur < (ai->targv[1] + _tcslen(ai->targv[1]))) {
if (!_tcsncmp(cur, _T("\r\n"), 2)) {
count += 1;
cur++;
}
- else if (*cur == _T('\n')) {
- count += 1;
- }
+ else if (*cur == _T('\n'))
+ count++;
+
cur++;
}
return itot(count);
}
-static TCHAR *parseLower(ARGUMENTSINFO *ai) {
-
- TCHAR *res;
-
- if (ai->argc != 2) {
+static TCHAR *parseLower(ARGUMENTSINFO *ai)
+{
+ if (ai->argc != 2)
return NULL;
- }
- res = mir_tstrdup(ai->targv[1]);
- if (res == NULL) {
+
+ TCHAR *res = mir_tstrdup(ai->targv[1]);
+ if (res == NULL)
return NULL;
- }
return CharLower(res);
}
-static TCHAR *parseLongest(ARGUMENTSINFO *ai) {
-
- unsigned int i, iLong;
-
- if (ai->argc < 2) {
+static TCHAR *parseLongest(ARGUMENTSINFO *ai)
+{
+ if (ai->argc < 2)
return NULL;
- }
- iLong = 1;
- for (i=2;i<ai->argc;i++) {
- if ( _tcslen(ai->targv[i]) > _tcslen(ai->targv[iLong])) {
+
+ unsigned int iLong = 1;
+ for (unsigned int i=2; i < ai->argc; i++)
+ if ( _tcslen(ai->targv[i]) > _tcslen(ai->targv[iLong]))
iLong = i;
- }
- }
- return mir_tstrdup(ai->targv[iLong]);
-}
-static TCHAR *parseNoOp(ARGUMENTSINFO *ai) {
+ return mir_tstrdup( ai->targv[iLong] );
+}
- if (ai->argc != 2) {
+static TCHAR *parseNoOp(ARGUMENTSINFO *ai)
+{
+ if (ai->argc != 2)
return NULL;
- }
- return mir_tstrdup(ai->targv[1]);
+ return mir_tstrdup( ai->targv[1] );
}
-static TCHAR *parsePad(ARGUMENTSINFO *ai) {
-
- unsigned int addcount, i;
- int padding;
- TCHAR *res, padchar, *cur;
-
+static TCHAR *parsePad(ARGUMENTSINFO *ai)
+{
+ TCHAR padchar;
switch( ai->argc ) {
case 3: padchar = _T(' '); break;
case 4: padchar = *ai->targv[3]; break;
default: return NULL;
}
- padding = ttoi(ai->targv[2]);
+ int padding = ttoi(ai->targv[2]);
if (padding < 0)
return NULL;
- addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- res = (TCHAR*)mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ unsigned int addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
+ TCHAR *res = (TCHAR*)mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
ZeroMemory(res, (addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
- cur = res;
- for ( i=0; i < addcount; i++ )
+ TCHAR *cur = res;
+ for ( unsigned int i=0; i < addcount; i++ )
*cur++ = padchar;
_tcscat(res, ai->targv[1]);
return res;
}
-static TCHAR *parsePadright(ARGUMENTSINFO *ai) {
-
- unsigned int addcount, i;
- int padding;
- TCHAR *res, padchar, *cur;
-
+static TCHAR *parsePadright(ARGUMENTSINFO *ai)
+{
+ TCHAR padchar;
switch (ai->argc ) {
case 3: padchar = _T(' '); break;
case 4: padchar = *ai->targv[3]; break;
default: return NULL;
}
- padding = ttoi(ai->targv[2]);
+ int padding = ttoi(ai->targv[2]);
if (padding < 0)
return NULL;
- addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- res = (TCHAR*)mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ unsigned int addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
+ TCHAR *res = (TCHAR*)mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
ZeroMemory(res, (addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
_tcscpy(res, ai->targv[1]);
- cur = res + _tcslen(ai->targv[1]);
- for (i=0;i<addcount;i++)
+ TCHAR *cur = res + _tcslen(ai->targv[1]);
+ for (unsigned int i=0; i < addcount; i++)
*cur++ = padchar;
return res;
}
-static TCHAR *parsePadcut(ARGUMENTSINFO *ai) {
-
- int padding, addcount, i;
- TCHAR *res, padchar, *cur;
-
+static TCHAR *parsePadcut(ARGUMENTSINFO *ai)
+{
+ TCHAR padchar;
switch( ai->argc ) {
case 3: padchar = _T(' '); break;
case 4: padchar = *ai->targv[3]; break;
default: return NULL;
}
- padding = ttoi(ai->targv[2]);
+ int padding = ttoi(ai->targv[2]);
if (padding < 0)
return NULL;
- addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- res = (TCHAR*)mir_alloc((padding + 1)*sizeof(TCHAR));
+ int addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
+ TCHAR *res = (TCHAR*)mir_alloc((padding + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
ZeroMemory(res, (padding + 1)*sizeof(TCHAR));
- cur = res;
- for (i=0;i<addcount;i++)
+ TCHAR *cur = res;
+ for (int i=0; i < addcount; i++)
*cur++ = padchar;
if (padding > addcount)
@@ -385,29 +339,27 @@ static TCHAR *parsePadcut(ARGUMENTSINFO *ai) { return res;
}
-static TCHAR *parsePadcutright(ARGUMENTSINFO *ai) {
-
- int padding, addcount, i;
- TCHAR *res, padchar, *cur;
-
+static TCHAR *parsePadcutright(ARGUMENTSINFO *ai)
+{
+ TCHAR padchar;
switch( ai->argc ) {
case 3: padchar = _T(' '); break;
case 4: padchar = *ai->targv[3]; break;
default: return NULL;
}
- padding = ttoi(ai->targv[2]);
+ int padding = ttoi(ai->targv[2]);
if (padding < 0)
return NULL;
- addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- res = (TCHAR*)mir_alloc((padding + 1)*sizeof(TCHAR));
+ int addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
+ TCHAR *res = (TCHAR*)mir_alloc((padding + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
ZeroMemory(res, (padding + 1)*sizeof(TCHAR));
- cur = res + padding - addcount;
- for (i=0; i < addcount; i++ )
+ TCHAR *cur = res + padding - addcount;
+ for (int i=0; i < addcount; i++ )
*cur++ = padchar;
if (padding > addcount )
@@ -416,8 +368,8 @@ static TCHAR *parsePadcutright(ARGUMENTSINFO *ai) { return res;
}
-static TCHAR *parseRepeat(ARGUMENTSINFO *ai) {
-
+static TCHAR *parseRepeat(ARGUMENTSINFO *ai)
+{
TCHAR *res;
unsigned int i, count;
diff --git a/plugins/Variables/variables.cpp b/plugins/Variables/variables.cpp index f5666b4279..9a451fb671 100644 --- a/plugins/Variables/variables.cpp +++ b/plugins/Variables/variables.cpp @@ -541,9 +541,9 @@ int setParseOptions(struct ParseOptions *po) { po = &gParseOpts;
}
ZeroMemory(po, sizeof(struct ParseOptions));
- if (!db_getb(SETTING_STRIPALL, 0)) {
- po->bStripEOL = db_getb(SETTING_STRIPCRLF, 0);
- po->bStripWS = db_getb(SETTING_STRIPWS, 0);
+ if (!db_get_b(NULL, MODULENAME, SETTING_STRIPALL, 0)) {
+ po->bStripEOL = db_get_b(NULL, MODULENAME, SETTING_STRIPCRLF, 0);
+ po->bStripWS = db_get_b(NULL, MODULENAME, SETTING_STRIPWS, 0);
}
else {
po->bStripAll = TRUE;
@@ -607,10 +607,10 @@ int LoadVarModule() log_debugA("Variables: Internal tokens registered");
- if (db_getb(SETTING_PARSEATSTARTUP, 0)) {
+ if (db_get_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, 0)) {
FORMATINFO fi = { 0 };
fi.cbSize = sizeof(fi);
- fi.tszFormat = db_gets(SETTING_STARTUPTEXT, NULL);
+ fi.tszFormat = db_get_tsa(NULL, MODULENAME, SETTING_STARTUPTEXT);
if (fi.tszFormat != NULL) {
freeMemory((WPARAM)formatString(&fi), 0);
mir_free(fi.tszFormat);
diff --git a/plugins/Variables/variables.h b/plugins/Variables/variables.h index 17de157cf1..68ac51aa3a 100644 --- a/plugins/Variables/variables.h +++ b/plugins/Variables/variables.h @@ -21,6 +21,7 @@ #define MIRANDA_VER 0x0A00
#include <tchar.h>
+#include <malloc.h>
#include <windows.h>
#include <commctrl.h>
@@ -43,11 +44,10 @@ #include <m_utils.h>
#include <m_icolib.h>
#include "m_variables.h"
-//#include "dbhelpers.h"
+
#define MODULENAME "Variables"
-//#define LOGLEVEL __LOGLEVEL_DEBUG
+
#include "../helpers/gen_helpers.h"
-#include "../helpers/db_helpers.h"
#define SETTING_STARTUPTEXT "StartupText"
#define SETTING_STRIPCRLF "StripCRLF"
|