diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2014-11-28 21:19:14 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2014-11-28 21:19:14 +0000 |
commit | 6895d635acb37ba42e53ba95ca3eee2ddbbef24d (patch) | |
tree | f85a1d97784c4597099864119acb027b9a3f2dba /plugins/Spamotron/src/utils.cpp | |
parent | 8ef06acf351fdb6034b6e13670d84bfd79161956 (diff) |
Massive code cleanup and fixes for a lot of warnings reported in #837
git-svn-id: http://svn.miranda-ng.org/main/trunk@11136 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Spamotron/src/utils.cpp')
-rw-r--r-- | plugins/Spamotron/src/utils.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index ef78a9f29d..ce8730a7b9 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -206,25 +206,24 @@ int get_response_num(const TCHAR *str) return i;
}
-TCHAR* get_response(TCHAR* dst, unsigned int dstlen, int num)
+TCHAR* get_response(TCHAR *dst, unsigned int dstlen, int num)
{
- int i = 0;
- TCHAR *tmp, *src = NULL;
if (num < 0)
return dst;
- src = (TCHAR*)malloc(MAX_BUFFER_LENGTH * sizeof(TCHAR));
+ TCHAR *src = (TCHAR*)malloc(MAX_BUFFER_LENGTH * sizeof(TCHAR));
+ int i = 0;
if (src != NULL) {
_getOptS(src, MAX_BUFFER_LENGTH, "Response", defaultResponse);
- _tcscpy(src, src);
- tmp = _tcstok(src, L"\r\n");
+ _tcsncpy(dst, src, dstlen);
+ TCHAR *tmp = _tcstok(src, L"\r\n");
while (tmp) {
if (i == num) {
- _tcscpy(dst, tmp);
+ _tcsncpy(dst, tmp, dstlen);
free(src);
return dst;
}
i++;
- tmp = _tcstok(NULL, L"\r\n");
+ tmp = _tcstok(src, L"\r\n");
}
free(src);
}
|