summaryrefslogtreecommitdiff
path: root/plugins/Spamotron
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-08-28 16:22:41 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-08-28 16:22:41 +0000
commitc370af60855db957c5b200914bf0bde743845528 (patch)
tree0bd2ef127097c9e937c2650e8b202c3f09453323 /plugins/Spamotron
parent7f082bd5d4865c30b313661b7a02f048b4b137be (diff)
mir_sntprintf / mir_snprintf: obsoleted second parameter removed wherever possible
git-svn-id: http://svn.miranda-ng.org/main/trunk@15064 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Spamotron')
-rw-r--r--plugins/Spamotron/src/bayes.cpp16
-rw-r--r--plugins/Spamotron/src/options.cpp2
-rw-r--r--plugins/Spamotron/src/spamotron.cpp2
-rw-r--r--plugins/Spamotron/src/utils.cpp6
4 files changed, 13 insertions, 13 deletions
diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp
index a9587ee991..d6d582a59b 100644
--- a/plugins/Spamotron/src/bayes.cpp
+++ b/plugins/Spamotron/src/bayes.cpp
@@ -17,7 +17,7 @@ int CheckBayes()
char* tmp = Utils_ReplaceVars("%miranda_userdata%");
if (tmp[mir_strlen(tmp)-1] == '\\')
tmp[mir_strlen(tmp)-1] = 0;
- mir_snprintf(bayesdb_tmp, _countof(bayesdb_tmp), "%s\\%s", tmp, BAYESDB_PATH);
+ mir_snprintf(bayesdb_tmp, "%s\\%s", tmp, BAYESDB_PATH);
mir_free(tmp);
if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
@@ -82,7 +82,7 @@ int OpenBayes()
tmp = Utils_ReplaceVars("%miranda_userdata%");
if (tmp[mir_strlen(tmp)-1] == '\\')
tmp[mir_strlen(tmp)-1] = 0;
- mir_snprintf(bayesdb_fullpath, _countof(bayesdb_fullpath), "%s\\%s\\%s", tmp, BAYESDB_PATH, BAYESDBG_FILENAME);
+ mir_snprintf(bayesdb_fullpath, "%s\\%s\\%s", tmp, BAYESDB_PATH, BAYESDBG_FILENAME);
mir_free(tmp);
bayesdb_fullpath_utf8 = mir_utf8encode(bayesdb_fullpath);
if (sqlite3_open(bayesdb_fullpath_utf8, &bayesdbg) == SQLITE_OK)
@@ -110,7 +110,7 @@ int get_token_count(int type)
if (bayesdb == NULL)
return 0;
- mir_snprintf(q, _countof(q), "SELECT COUNT(1) FROM %s", type == SPAM ? "spam" : "ham");
+ mir_snprintf(q, "SELECT COUNT(1) FROM %s", type == SPAM ? "spam" : "ham");
sqlite3_prepare_v2(bayesdb, q, -1, &stmt, NULL);
if (sqlite3_step(stmt) == SQLITE_ROW) {
count = sqlite3_column_int(stmt, 0);
@@ -165,7 +165,7 @@ int get_token_score(int type, char *token)
if (bayesdb == NULL)
return 0;
- mir_snprintf(sql, _countof(sql), "SELECT num FROM %s WHERE token=?", type == SPAM ? "spam" : "ham");
+ mir_snprintf(sql, "SELECT num FROM %s WHERE token=?", type == SPAM ? "spam" : "ham");
tokenhash(token, digest);
sqlite3_prepare_v2(bayesdb, sql, -1, &stmt, NULL);
sqlite3_bind_blob(stmt, 1, digest, 16, NULL);
@@ -323,10 +323,10 @@ void learn(int type, TCHAR *msg)
message = mir_u2a(msg);
tok = strtok(message, DELIMS);
- mir_snprintf(sql_counter, _countof(sql_counter), "UPDATE stats SET value=value+1 WHERE key='%s'", type == SPAM ? "spam_msgcount" : "ham_msgcount");
- mir_snprintf(sql_select, _countof(sql_select), "SELECT 1 FROM %s WHERE token=?", type == SPAM ? "spam" : "ham");
- mir_snprintf(sql_update, _countof(sql_update), "UPDATE %s SET num=num+1 WHERE token=?", type ? "spam" : "ham");
- mir_snprintf(sql_insert, _countof(sql_insert), "INSERT INTO %s VALUES(?, 1)", type ? "spam" : "ham");
+ mir_snprintf(sql_counter, "UPDATE stats SET value=value+1 WHERE key='%s'", type == SPAM ? "spam_msgcount" : "ham_msgcount");
+ mir_snprintf(sql_select, "SELECT 1 FROM %s WHERE token=?", type == SPAM ? "spam" : "ham");
+ mir_snprintf(sql_update, "UPDATE %s SET num=num+1 WHERE token=?", type ? "spam" : "ham");
+ mir_snprintf(sql_insert, "INSERT INTO %s VALUES(?, 1)", type ? "spam" : "ham");
#ifdef _DEBUG
sqlite3_exec(bayesdbg, "BEGIN", NULL, NULL, NULL);
#endif
diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp
index ff8863bd3b..6c65d556c4 100644
--- a/plugins/Spamotron/src/options.cpp
+++ b/plugins/Spamotron/src/options.cpp
@@ -519,7 +519,7 @@ INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARA
if (!dbuf)
return FALSE;
GetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, dbuf, len);
- mir_snprintf(cbuf, _countof(cbuf), "%0.04f", get_msg_score(dbuf));
+ mir_snprintf(cbuf, "%0.04f", get_msg_score(dbuf));
SetDlgItemText(optDlg, IDC_OPT_BAYES_LEARNBOX, _T(""));
MessageBoxA(NULL, cbuf, Translate("Message score"), MB_OK);
free(dbuf);
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp
index 29d76e78a3..6ce5f16438 100644
--- a/plugins/Spamotron/src/spamotron.cpp
+++ b/plugins/Spamotron/src/spamotron.cpp
@@ -388,7 +388,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
case SPAMOTRON_MODE_MATH:
a = (rand() % 10) + 1;
b = (rand() % 10) + 1;
- mir_sntprintf(mexpr, _countof(mexpr), _T("%d + %d"), a, b);
+ mir_sntprintf(mexpr, _T("%d + %d"), a, b);
if (dbei->eventType == EVENTTYPE_AUTHREQUEST)
_getOptS(challengeW, maxmsglen, "AuthChallengeMath", defaultAuthChallengeMath);
else
diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp
index aa6bb0df29..20d0b0bd2e 100644
--- a/plugins/Spamotron/src/utils.cpp
+++ b/plugins/Spamotron/src/utils.cpp
@@ -427,7 +427,7 @@ int _notify(MCONTACT hContact, BYTE type, TCHAR *message, TCHAR *origmessage)
{
char *tmp, *tmporig;
TCHAR msg[MAX_BUFFER_LENGTH];
- mir_sntprintf(msg, _countof(msg), message, pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_sntprintf(msg, message, pcli->pfnGetContactDisplayName(hContact, 0));
if (_getOptB("LogActions", defaultLogActions)) {
tmp = mir_u2a(msg);
@@ -467,9 +467,9 @@ int LogToSystemHistory(char *message, char *origmessage)
dbei.szModule = PLUGIN_NAME;
dbei.pBlob = (PBYTE)msg;
if (origmessage)
- dbei.cbBlob = (1 + mir_snprintf(msg, _countof(msg), "%s: %s%s %s: %s", PLUGIN_NAME, message, DOT(message), Translate("Their message was"), origmessage));
+ dbei.cbBlob = (1 + mir_snprintf(msg, "%s: %s%s %s: %s", PLUGIN_NAME, message, DOT(message), Translate("Their message was"), origmessage));
else
- dbei.cbBlob = (1 + mir_snprintf(msg, _countof(msg), "%s: %s%s", PLUGIN_NAME, message, DOT(message)));
+ dbei.cbBlob = (1 + mir_snprintf(msg, "%s: %s%s", PLUGIN_NAME, message, DOT(message)));
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_READ;
db_event_add(NULL, &dbei);