diff options
author | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-08 22:13:57 +0000 |
---|---|---|
committer | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-08 22:13:57 +0000 |
commit | 13eb83bea655c3302c74a82d826d75bceb9232a2 (patch) | |
tree | ea992cbd9002e078a06e9fe65a73698eec4fbc22 /plugins/SeenPlugin/src | |
parent | ef741fcb36d679b094e44d01714f423c34357383 (diff) |
code cleanup around mir_snprintf
git-svn-id: http://svn.miranda-ng.org/main/trunk@11285 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SeenPlugin/src')
-rw-r--r-- | plugins/SeenPlugin/src/utils.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 3c9bc669fb..a5fcd575ce 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -570,11 +570,12 @@ int UpdateValues(WPARAM hContact,LPARAM lparam) db_set_b(hContact, S_MOD, "Offline", 1);
{
DWORD t;
- char *str = (char *)malloc(MAXMODULELABELLENGTH+9);
- mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",proto);
- t = db_get_dw(NULL,S_MOD,str,0);
- if (!t) t = time(NULL);
- free(str);
+ char str[MAXMODULELABELLENGTH + 9];
+
+ mir_snprintf(str, SIZEOF(str), "OffTime-%s", proto);
+ t = db_get_dw(NULL, S_MOD, str, 0);
+ if (!t)
+ t = time(NULL);
DBWriteTimeTS(t, hContact);
}
@@ -653,10 +654,9 @@ static void cleanThread(void *param) }
}
- char *str = (char *)malloc(MAXMODULELABELLENGTH+9);
- mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",infoParam->sProtoName);
- db_unset(NULL,S_MOD,str);
- free(str);
+ char str[MAXMODULELABELLENGTH + 9];
+ mir_snprintf(str, SIZEOF(str), "OffTime-%s", infoParam->sProtoName);
+ db_unset(NULL, S_MOD, str);
}
free(infoParam);
}
@@ -690,12 +690,12 @@ int ModeChange(WPARAM wparam,LPARAM lparam) else if ((isetting==ID_STATUS_OFFLINE)&&((WORD)ack->hProcess>ID_STATUS_OFFLINE)) {
//we have just loged-off
if (IsWatchedProtocol(ack->szModule)) {
- char *str = (char *)malloc(MAXMODULELABELLENGTH+9);
+ char str[MAXMODULELABELLENGTH + 9];
time_t t;
+
time(&t);
- mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",ack->szModule);
- db_set_dw(NULL,S_MOD,str,t);
- free(str);
+ mir_snprintf(str, SIZEOF(str), "OffTime-%s", ack->szModule);
+ db_set_dw(NULL, S_MOD, str, t);
}
}
|