diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-24 20:20:56 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-24 20:20:56 +0000 |
commit | 1b33fad341b6eae6f3f377e67b91ed81b845269a (patch) | |
tree | e3eb972e370b65811c8cb11ee09fb0701d38f81b /plugins | |
parent | f95c6ed55da24f45ea3cf15d3802d6ca686c16a2 (diff) |
Non-IM-Contacts:
-Many memory issues fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@11900 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Non-IM Contact/src/contactinfo.cpp | 13 | ||||
-rw-r--r-- | plugins/Non-IM Contact/src/dialog.cpp | 4 | ||||
-rw-r--r-- | plugins/Non-IM Contact/src/files.cpp | 36 | ||||
-rw-r--r-- | plugins/Non-IM Contact/src/main.cpp | 12 | ||||
-rw-r--r-- | plugins/Non-IM Contact/src/namereplacing.cpp | 43 | ||||
-rw-r--r-- | plugins/Non-IM Contact/src/services.cpp | 8 | ||||
-rw-r--r-- | plugins/Non-IM Contact/src/timer.cpp | 6 |
7 files changed, 61 insertions, 61 deletions
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index 137c9f1953..a14a5da846 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -317,14 +317,14 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case IDC_DOIT:
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE))) {
- char *replace = (char*)malloc(GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1);
char newString[MAX_REPLACES][512], oldString[MAX_REPLACES][512];
char dbVar1[2000], dbVar2[2000];
int i=0,j=0, k=0;
char *string = oldString[k];
MCONTACT hContact1 = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), hContact2;
- GetDlgItemTextA(hwnd, IDC_STRING_REPLACE, replace, GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1);
if (db_get_static(hContact1, MODNAME, "Name", dbVar1)) {
+ char *replace = (char*)malloc(GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1);
+ GetDlgItemTextA(hwnd, IDC_STRING_REPLACE, replace, GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1);
// get the list of replace strings
while (replace[i] != '\0') {
if (replace[i] == ',') {
@@ -334,7 +334,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) else if (!strncmp(&replace[i], "\r\n",2)) {
if (string == newString[k])
k--;
- if (k = MAX_REPLACES) break;
+ if (k == MAX_REPLACES) break;
string = oldString[++k];
i+=2;
continue;
@@ -399,9 +399,10 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) }
else {
char dbVar1[2000];
- MCONTACT hContact1 = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), hContact2;
+ MCONTACT hContact1 = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (db_get_static(hContact1, MODNAME, "Name", dbVar1)) {
- if (!(hContact2 = (MCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0))) {
+ MCONTACT hContact2 = (MCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0);
+ if (!hContact2) {
msg("contact did not get created","");
return 0;
}
@@ -615,6 +616,8 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) mir_snprintf(tmp, SIZEOF(tmp), "Icon: On The Phone\r\n");
else if (icon == ID_STATUS_OUTTOLUNCH)
mir_snprintf(tmp, SIZEOF(tmp), "Icon: Out To Lunch\r\n");
+ else
+ continue;
msg = (char*)realloc(msg, strlen(msg) + strlen(tmp) +1);
strcat(msg,tmp);
}
diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp index 418237407c..d48e53a45b 100644 --- a/plugins/Non-IM Contact/src/dialog.cpp +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -209,13 +209,13 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return FALSE;
}
-INT_PTR testStringReplacer(WPARAM wParam, LPARAM lParam)
+INT_PTR testStringReplacer(WPARAM, LPARAM)
{
CreateDialog(hInst, MAKEINTRESOURCE(IDD_TEST_LINE), 0, TestWindowDlgProc);
return 0;
}
-INT_PTR LoadFilesDlg(WPARAM wParam, LPARAM lParam)
+INT_PTR LoadFilesDlg(WPARAM, LPARAM)
{
CreateDialog(hInst,MAKEINTRESOURCE(IDD_ADD_FILE),0,DlgProcFiles);
return 0;
diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp index f9e6479b36..704a7533f3 100644 --- a/plugins/Non-IM Contact/src/files.cpp +++ b/plugins/Non-IM Contact/src/files.cpp @@ -79,8 +79,8 @@ void reloadFiles(HWND fileList) {
mir_snprintf(fn, SIZEOF(fn), "fn%d", i);
if (db_get_static(NULL, MODNAME, fn, file)) {
- index = SendMessageA(fileList, CB_ADDSTRING,0, (LPARAM)(char*)file);
- SendMessage(fileList, CB_SETITEMDATA, index, (LPARAM)(int)i);
+ index = SendMessageA(fileList, CB_ADDSTRING,0, (LPARAM)file);
+ SendMessage(fileList, CB_SETITEMDATA, index, (LPARAM)i);
SendMessage(fileList, CB_SETCURSEL, index,0);
SetDlgItemTextA(GetParent(fileList), IDC_FN, _itoa(i, fn, 10));
/* add the file contents to the edit box */
@@ -106,7 +106,6 @@ void readFile(HWND hwnd) {
int lineNumber, fileLength=0, width=0;
char temp[MAX_STRING_LENGTH], szFileName[512], temp1[MAX_STRING_LENGTH], fn[8];
- FILE* filen;
int fileNumber = SendDlgItemMessage(hwnd, IDC_FILE_LIST,CB_GETCURSEL, 0,0);
mir_snprintf(fn, SIZEOF(fn), "fn%d", fileNumber);
if (!db_get_static(NULL, MODNAME, fn, szFileName)) {
@@ -114,12 +113,12 @@ void readFile(HWND hwnd) return;
}
- if ( (!strncmp("http://", szFileName, strlen("http://"))) || (!strncmp("https://", szFileName, strlen("https://"))) )
+ if ( !strncmp("http://", szFileName, strlen("http://")) || !strncmp("https://", szFileName, strlen("https://")))
mir_snprintf(szFileName, SIZEOF(szFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), fileNumber);
- filen = fopen(szFileName,"r");
+ FILE *filen = fopen(szFileName,"r");
if (!filen) {
- MessageBoxA(0, Translate("File couldn't be opened,2"), modFullname,MB_OK);
+ MessageBox(0, TranslateT("File couldn't be opened,2"), _T(modFullname),MB_OK);
return;
}
lineNumber = 0;
@@ -140,8 +139,6 @@ void readFile(HWND hwnd) SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS,LB_SETHORIZONTALEXTENT,(strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5)),0);
}
fclose(filen);
-
- return ;
}
#define WM_RELOADWINDOW (WM_USER+11)
@@ -161,7 +158,8 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if ( (!strncmp("http://", string, strlen("http://"))) || (!strncmp("https://", string, strlen("https://"))) )
{
SetDlgItemTextA(hwnd,IDC_URL, string);
- SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, strcat(fn, "_timer"), 60), tmp, 10));
+ mir_snprintf(fn,SIZEOF(fn),"fn%d_timer", i);
+ SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, fn, 60), tmp, 10));
}
readFile(hwnd);
}
@@ -205,7 +203,8 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) GetDlgItemTextA(hwnd,IDC_WWW_TIMER,text,SIZEOF(text));
timer = atoi(text);
}
- db_set_w(NULL, MODNAME, strcat(fn, "_timer"), (WORD)timer);
+ mir_snprintf(fn, SIZEOF(fn), "fn%d_timer", i);
+ db_set_w(NULL, MODNAME, fn, (WORD)timer);
SendMessage(hwnd, WM_RELOADWINDOW, 0,0);
}
}
@@ -229,8 +228,8 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (Openfile(file,1))
{
db_set_s(NULL, MODNAME, fn, file);
- index = SendDlgItemMessageA(hwnd, IDC_FILE_LIST, CB_ADDSTRING, 0, (LPARAM)(char*)file);
- SendDlgItemMessage(hwnd, IDC_FILE_LIST,CB_SETITEMDATA,index,(LPARAM)(int)i);
+ index = SendDlgItemMessageA(hwnd, IDC_FILE_LIST, CB_ADDSTRING, 0, (LPARAM)file);
+ SendDlgItemMessage(hwnd, IDC_FILE_LIST,CB_SETITEMDATA,index,(LPARAM)i);
SendDlgItemMessage(hwnd, IDC_FILE_LIST,CB_SETCURSEL, index ,0);
SetDlgItemTextA(hwnd, IDC_FN, _itoa(i, fn, 10));
mir_snprintf(fn, SIZEOF(fn), "fn%d", index);
@@ -279,7 +278,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (HIWORD(wParam) == CBN_SELCHANGE )
{
int index = SendDlgItemMessage(hwnd, IDC_FILE_LIST,CB_GETCURSEL, 0,0);
- char fn[6], tmp[MAX_PATH];
+ char fn[20], tmp[MAX_PATH];
SetDlgItemTextA(hwnd, IDC_FN, _itoa(index, fn, 10));
mir_snprintf(fn, SIZEOF(fn), "fn%d", index);
if (db_get_static(NULL, MODNAME, fn, tmp) )
@@ -287,7 +286,8 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (!strncmp("http://", tmp, strlen("http://")) || !strncmp("https://", tmp, strlen("https://")))
{
SetDlgItemTextA(hwnd,IDC_URL, tmp);
- SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, strcat(fn, "_timer"), 60), tmp, 10));
+ mir_snprintf(fn, SIZEOF(fn), "fn%d_timer", index);
+ SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, fn, 60), tmp, 10));
}
else
{
@@ -320,9 +320,11 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) }
else timer = 60;
- if (db_get_static(NULL, MODNAME, fn, string) )
- if (!strncmp("http://", string, strlen("http://")) || !strncmp("https://", string, strlen("https://")))
- db_set_w(NULL, MODNAME, strcat(fn, "_timer"), (WORD)timer);
+ if (db_get_static(NULL, MODNAME, fn, string))
+ if (!strncmp("http://", string, strlen("http://")) || !strncmp("https://", string, strlen("https://"))) {
+ mir_snprintf(fn, SIZEOF(fn), "fn%d_timer", i);
+ db_set_w(NULL, MODNAME, fn, (WORD)timer);
+ }
return TRUE;
}
diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp index 0d5247dc58..6452e85981 100644 --- a/plugins/Non-IM Contact/src/main.cpp +++ b/plugins/Non-IM Contact/src/main.cpp @@ -31,7 +31,7 @@ INT_PTR doubleClick(WPARAM wParam,LPARAM lParam) char* proto = GetContactProto(wParam);
if (proto && !strcmp(proto, MODNAME)) {
if (GetKeyState(VK_CONTROL)&0x8000) // ctrl is pressed
- editContact((WPARAM)(HANDLE)wParam, (LPARAM)NULL); // for later when i add a second double click setting
+ editContact(wParam, 0); // for later when i add a second double click setting
else if (db_get_static(wParam, MODNAME, "Program", program) && strcmp(program, ""))
{
if (!db_get_static(wParam, MODNAME, "ProgramParams", params) )
@@ -42,7 +42,7 @@ INT_PTR doubleClick(WPARAM wParam,LPARAM lParam) if (shellEXEerror == ERROR_FILE_NOT_FOUND || shellEXEerror == ERROR_PATH_NOT_FOUND)
CallService(MS_UTILS_OPENURL,OUF_NEWWINDOW,(LPARAM)program);
}
- else editContact((WPARAM)(HANDLE)wParam, (LPARAM)NULL);
+ else editContact(wParam, 0);
return 1;
}
return 0;
@@ -60,7 +60,7 @@ int LCStatus = ID_STATUS_OFFLINE; // Returns : int
// Description : Called at very beginning of plugin
//=====================================================
-int NimcOptInit(WPARAM wParam,LPARAM lParam)
+int NimcOptInit(WPARAM wParam,LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = hInst;
@@ -71,12 +71,6 @@ int NimcOptInit(WPARAM wParam,LPARAM lParam) Options_AddPage(wParam, &odp);
return 0;
}
-
-int MainInit(WPARAM wparam,LPARAM lparam)
-{
- return 0;
-}
-
//=====================================================
// Name : __declspec(dllexport) PLUGININFO* MirandaPluginInfo
// Parameters: (DWORD mirandaVersion)
diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp index 5203b48931..c9df0de9e1 100644 --- a/plugins/Non-IM Contact/src/namereplacing.cpp +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -5,13 +5,16 @@ int readFileIntoArray(int fileNumber, char *FileContents[]) char dbSetting[20], temp[MAX_STRING_LENGTH];
mir_snprintf(dbSetting, SIZEOF(dbSetting), "fn%d", fileNumber);
- DBVARIANT dbv;
- char tszFileName[MAX_PATH];
- if (db_get_ts(NULL, MODNAME, dbSetting, &dbv))
+ char *szVar = db_get_sa(NULL, MODNAME, dbSetting);
+ if (szVar == NULL)
return 0;
- if (!strncmp("http://", tszFileName, 7))
+ char tszFileName[MAX_PATH];
+ if (!strncmp("http://", szVar, 7) || !strncmp("https://", szVar, 7))
mir_snprintf(tszFileName, SIZEOF(tszFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), fileNumber);
+ else
+ mir_strncpy(tszFileName, szVar, SIZEOF(tszFileName));
+ mir_free(szVar);
FILE* file = fopen(tszFileName, "r");
if (file == NULL)
@@ -26,7 +29,7 @@ int readFileIntoArray(int fileNumber, char *FileContents[]) else temp[strlen(temp)]='\0';
FileContents[i] = (char*)malloc(strlen(temp)+1);
- if (FileContents[i] == NULL) return i;
+ if (FileContents[i] == NULL) break;
strcpy(FileContents[i], temp);
}
fclose(file);
@@ -89,7 +92,7 @@ int findLine(char* FileContents[], const char* string, int linesInFile,int start return linesInFile - (i+1);
}
- *positionInOldString ++;
+ (*positionInOldString)++;
return (linesInFile - 1);
}
@@ -234,10 +237,10 @@ void checkStringForcompare(char *str) // do save("A","B") A is DBVar name, B is value
void checkStringForSave(MCONTACT hContact, char* str)
{
+ if (!strstr(str,"save(\"")) return;
char *A,*B,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str);
unsigned int i, j=0, s = (int)strlen(str);
newStr[0] = '\0';
- if (!strstr(str,"save(\"")) return;
for (i=0; i<s; i++) {
if (!strncmp(&str[i],"save(\"", strlen("save(\""))) {
i += (int)strlen("save(\"");
@@ -260,10 +263,10 @@ void checkStringForSave(MCONTACT hContact, char* str) // do load("A") A is DBVar name
void checkStringForLoad(MCONTACT hContact, char* str)
{
+ if (!strstr(str,"load(\"")) return;
char *A,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str);
unsigned int i, j=0, s = (int)strlen(str);
newStr[0] = '\0';
- if (!strstr(str,"load(\"")) return;
for (i=0; i<s; i++) {
if (!strncmp(&str[i], "load(\"", strlen("load(\""))) {
i += (int)strlen("load(\"");
@@ -289,10 +292,10 @@ void checkStringForLoad(MCONTACT hContact, char* str) // do saveN("A","B","C","D") A is module, B is setting, c is value, D is type 0/b 1/w 2/d 3/s
void checkStringForSaveN(char* str)
{
+ if (!strstr(str,"saveN(\"")) return;
char *A,*B,*C,*D,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str);
unsigned int i, j=0, s = (int)strlen(str);
newStr[0] = '\0';
- if (!strstr(str,"saveN(\"")) return;
for (i=0; i<s; i++) {
if (!strncmp(&str[i], "saveN(\"", strlen("saveN(\""))) {
i += (int)strlen("saveN(\"");
@@ -334,17 +337,17 @@ void checkStringForSaveN(char* str) // do loadN("A","B") A is module, B is setting
void checkStringForLoadN(char* str)
{
- char *A,*B,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str), temp[32];
+ if (!strstr(str,"loadN(\"")) return;
+ char *newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str), temp[32];
unsigned int i, j=0, s = (int)strlen(str);
newStr[0] = '\0';
- if (!strstr(str,"loadN(\"")) return;
for (i=0; i<s; i++) {
if (!strncmp(&str[i], "loadN(\"", strlen("loadN(\""))) {
i += (int)strlen("loadN(\"");
- A = strtok(©OfStr[i], "\",\"");
- B = strtok(NULL, ",\")");
- j = B - ©OfStr[i] + (int)strlen(B)+1;
+ char *A = strtok(©OfStr[i], "\",\"");
+ char *B = strtok(NULL, ",\")");
if (A && B) {
+ j = B - ©OfStr[i] + (int)strlen(B)+1;
DBVARIANT dbv;
if ( !db_get(NULL, A, B, &dbv)) {
switch (dbv.type) {
@@ -364,7 +367,7 @@ void checkStringForLoadN(char* str) db_free(&dbv);
}
}
- else strncat(newStr, &str[i], j);
+ else strncat(newStr, &str[i], i);
i += j;
}
else strncat(newStr, &str[i], 1);
@@ -407,14 +410,16 @@ int lastChecked(char *newStr, const char *str) sscanf(&str[cbPattern], "%d", &file);
mir_snprintf(szSetting, SIZEOF(szSetting), "fn%d", file);
- DBVARIANT dbv;
- if (db_get_s(NULL, MODNAME, szSetting, &dbv))
+ char *szVar = db_get_sa(NULL, MODNAME, szSetting);
+ if (szVar == NULL)
return 0;
- if (!strncmp("http://", dbv.pszVal, 7) || !strncmp("https://", dbv.pszVal, 8))
+ if (!strncmp("http://", szVar, 7) || !strncmp("https://", szVar, 8))
mir_snprintf(tszFileName, SIZEOF(tszFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), file);
else
- strncpy(tszFileName, dbv.pszVal, SIZEOF(tszFileName));
+ mir_strncpy(tszFileName, szVar, SIZEOF(tszFileName));
+ mir_free(szVar);
+
HANDLE hFile = CreateFileA(tszFileName, 0, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
return 0;
diff --git a/plugins/Non-IM Contact/src/services.cpp b/plugins/Non-IM Contact/src/services.cpp index 79f4020e3f..a0a3810397 100644 --- a/plugins/Non-IM Contact/src/services.cpp +++ b/plugins/Non-IM Contact/src/services.cpp @@ -79,11 +79,7 @@ int SetLCStatus(WPARAM wParam,LPARAM lParam) else if (db_get_w(NULL, MODNAME, "Timer",1))
startTimer(TIMER);
- for (MCONTACT hContact = db_find_first(MODNAME); hContact; hContact = db_find_next(hContact)) {
- char *proto = GetContactProto(hContact);
- if (proto == NULL || strcmp(proto, MODNAME))
- continue;
-
+ for (MCONTACT hContact = db_find_first(MODNAME); hContact; hContact = db_find_next(hContact,MODNAME)) {
if (LCStatus != ID_STATUS_OFFLINE)
replaceAllStrings(hContact);
@@ -101,7 +97,7 @@ int SetLCStatus(WPARAM wParam,LPARAM lParam) case ID_STATUS_AWAY:
if (db_get_b(NULL, MODNAME, "AwayAsStatus", 0) && (db_get_b(hContact, MODNAME, "AlwaysVisible",0) || (db_get_w(hContact, MODNAME, "Icon",ID_STATUS_ONLINE)==ID_STATUS_AWAY)) )
- db_set_w(hContact, MODNAME, "Status",(WORD)(WORD)db_get_w(hContact, MODNAME, "Icon",ID_STATUS_ONLINE));
+ db_set_w(hContact, MODNAME, "Status",(WORD)db_get_w(hContact, MODNAME, "Icon",ID_STATUS_ONLINE));
else if (!db_get_b(NULL, MODNAME, "AwayAsStatus", 0))
db_set_w(hContact, MODNAME, "Status",(WORD)db_get_w(hContact, MODNAME, "Icon",ID_STATUS_ONLINE));
else
diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp index be73097219..fad1057038 100644 --- a/plugins/Non-IM Contact/src/timer.cpp +++ b/plugins/Non-IM Contact/src/timer.cpp @@ -9,7 +9,7 @@ UINT_PTR timerId; // Description : called when the timer interval occurs
//=====================================================
-void timerFunc(LPVOID di)
+void timerFunc(void *di)
{
char text[512], fn[16], szFileName[MAX_PATH], temp[MAX_PATH];
@@ -27,8 +27,8 @@ void timerFunc(LPVOID di) if (!db_get_static(NULL, MODNAME, fn, text))
break;
- if (!strncmp("http://", text, strlen("http://"))) {
- strcat(fn, "_timer");
+ if (!strncmp("http://", text, strlen("http://")) || !strncmp("https://", text, strlen("https://"))) {
+ mir_snprintf(fn, SIZEOF(fn), "fn%d_timer", i);
int timer = db_get_w(NULL, MODNAME, fn, 60);
if (timer && !(timerCount % timer)) {
if (!InternetDownloadFile(text)) {
|