summaryrefslogtreecommitdiff
path: root/plugins/Spamotron
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-05-22 10:06:32 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-05-22 10:06:32 +0000
commit5a17c9299e03bebf46169927abdeee34aaf8e854 (patch)
treecbd13080f33ac0b6396b9d3b8ba31a3c98de59f8 /plugins/Spamotron
parented64312924e77707e7e5b5965c301692519f293a (diff)
replace strlen to mir_strlen
git-svn-id: http://svn.miranda-ng.org/main/trunk@13747 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Spamotron')
-rw-r--r--plugins/Spamotron/src/bayes.cpp24
-rw-r--r--plugins/Spamotron/src/spamotron.cpp10
-rw-r--r--plugins/Spamotron/src/utils.cpp6
3 files changed, 20 insertions, 20 deletions
diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp
index d7b7518182..b1d8720b02 100644
--- a/plugins/Spamotron/src/bayes.cpp
+++ b/plugins/Spamotron/src/bayes.cpp
@@ -16,8 +16,8 @@ int CheckBayes()
char bayesdb_tmp[MAX_PATH];
char* tmp = Utils_ReplaceVars("%miranda_userdata%");
- if (tmp[strlen(tmp)-1] == '\\')
- tmp[strlen(tmp)-1] = 0;
+ if (tmp[mir_strlen(tmp)-1] == '\\')
+ tmp[mir_strlen(tmp)-1] = 0;
mir_snprintf(bayesdb_tmp, SIZEOF(bayesdb_tmp), "%s\\%s", tmp, BAYESDB_PATH);
mir_free(tmp);
@@ -49,8 +49,8 @@ int OpenBayes()
}
else {
tmp = Utils_ReplaceVars("%miranda_userdata%");
- if (tmp[strlen(tmp)-1] == '\\')
- tmp[strlen(tmp)-1] = 0;
+ if (tmp[mir_strlen(tmp)-1] == '\\')
+ tmp[mir_strlen(tmp)-1] = 0;
strcpy(bayesdb_fullpath, tmp);
strcat(bayesdb_fullpath, "\\"BAYESDB_PATH);
mir_free(tmp);
@@ -81,8 +81,8 @@ int OpenBayes()
#ifdef _DEBUG
tmp = Utils_ReplaceVars("%miranda_userdata%");
- if (tmp[strlen(tmp)-1] == '\\')
- tmp[strlen(tmp)-1] = 0;
+ if (tmp[mir_strlen(tmp)-1] == '\\')
+ tmp[mir_strlen(tmp)-1] = 0;
mir_snprintf(bayesdb_fullpath, SIZEOF(bayesdb_fullpath), "%s\\%s\\%s", tmp, BAYESDB_PATH, BAYESDBG_FILENAME);
mir_free(tmp);
bayesdb_fullpath_utf8 = mir_utf8encode(bayesdb_fullpath);
@@ -99,7 +99,7 @@ int OpenBayes()
char *tokenhash(const char *token, BYTE *digest)
{
- mir_md5_hash((BYTE *)token, (int)strlen(token), digest);
+ mir_md5_hash((BYTE *)token, (int)mir_strlen(token), digest);
return (char*)digest;
}
@@ -140,13 +140,13 @@ BOOL is_token_valid(char *token)
{
unsigned int i;
// skip digits only tokens
- for (i = 0; i < strlen(token); i++) {
+ for (i = 0; i < mir_strlen(token); i++) {
if ((unsigned char)token[i] >= 48 && (unsigned char)token[i] <= 57)
return FALSE;
}
// skip 1- and 2-character tokens
- if (strlen(token) < 3)
+ if (mir_strlen(token) < 3)
return FALSE;
// skip "www", "com", "org", etc.
@@ -239,7 +239,7 @@ void queue_message(MCONTACT hContact, DWORD msgtime, TCHAR *message)
sqlite3_bind_int(stmt, 1, (DWORD)hContact);
sqlite3_bind_int(stmt, 2, msgtime);
tmp = mir_u2a(message);
- sqlite3_bind_text(stmt, 3, tmp, (int)strlen(tmp), NULL);
+ sqlite3_bind_text(stmt, 3, tmp, (int)mir_strlen(tmp), NULL);
sqlite3_step(stmt);
mir_free(tmp);
sqlite3_finalize(stmt);
@@ -353,7 +353,7 @@ void learn(int type, TCHAR *msg)
#ifdef _DEBUG
sqlite3_prepare_v2(bayesdbg, sql_select, -1, &stmtdbg, NULL);
- sqlite3_bind_text(stmtdbg, 1, tok, (int)strlen(tok), NULL);
+ sqlite3_bind_text(stmtdbg, 1, tok, (int)mir_strlen(tok), NULL);
if (SQLITE_ROW == sqlite3_step(stmtdbg)) {
sqlite3_finalize(stmtdbg);
sqlite3_prepare_v2(bayesdbg, sql_update, -1, &stmtdbg, NULL);
@@ -361,7 +361,7 @@ void learn(int type, TCHAR *msg)
sqlite3_finalize(stmtdbg);
sqlite3_prepare_v2(bayesdbg, sql_insert, -1, &stmtdbg, NULL);
}
- sqlite3_bind_text(stmtdbg, 1, tok, (int)strlen(tok), SQLITE_STATIC);
+ sqlite3_bind_text(stmtdbg, 1, tok, (int)mir_strlen(tok), SQLITE_STATIC);
sqlite3_step(stmtdbg);
sqlite3_finalize(stmtdbg);
#endif
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp
index 4ce453a710..f37ae252db 100644
--- a/plugins/Spamotron/src/spamotron.cpp
+++ b/plugins/Spamotron/src/spamotron.cpp
@@ -135,7 +135,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
} else if (dbei->eventType == EVENTTYPE_AUTHREQUEST) {
msgblob = (char *)(dbei->pBlob + sizeof(DWORD) + sizeof(HANDLE));
for(a=4;a>0;a--)
- msgblob += strlen(msgblob)+1;
+ msgblob += mir_strlen(msgblob)+1;
}
if (dbei->flags & DBEF_UTF)
@@ -464,7 +464,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
} else {
if (_getOptB("MarkMsgUnreadOnApproval", defaultMarkMsgUnreadOnApproval)) {
DBVARIANT _dbv;
- DWORD dbei_size = 3*sizeof(DWORD) + sizeof(WORD) + dbei->cbBlob + (DWORD)strlen(dbei->szModule)+1;
+ DWORD dbei_size = 3*sizeof(DWORD) + sizeof(WORD) + dbei->cbBlob + (DWORD)mir_strlen(dbei->szModule)+1;
PBYTE eventdata = (PBYTE)malloc(dbei_size);
PBYTE pos = eventdata;
if (eventdata != NULL && dbei->cbBlob > 0) {
@@ -478,9 +478,9 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam)
memcpy(pos, &dbei->eventType, sizeof(WORD));
memcpy(pos+sizeof(WORD), &dbei->flags, sizeof(DWORD));
memcpy(pos+sizeof(WORD)+sizeof(DWORD), &dbei->timestamp, sizeof(DWORD));
- memcpy(pos+sizeof(WORD)+sizeof(DWORD)*2, dbei->szModule, strlen(dbei->szModule)+1);
- memcpy(pos+sizeof(WORD)+sizeof(DWORD)*2+strlen(dbei->szModule)+1, &dbei->cbBlob, sizeof(DWORD));
- memcpy(pos+sizeof(WORD)+sizeof(DWORD)*3+strlen(dbei->szModule)+1, dbei->pBlob, dbei->cbBlob);
+ memcpy(pos+sizeof(WORD)+sizeof(DWORD)*2, dbei->szModule, mir_strlen(dbei->szModule)+1);
+ memcpy(pos+sizeof(WORD)+sizeof(DWORD)*2+mir_strlen(dbei->szModule)+1, &dbei->cbBlob, sizeof(DWORD));
+ memcpy(pos+sizeof(WORD)+sizeof(DWORD)*3+mir_strlen(dbei->szModule)+1, dbei->pBlob, dbei->cbBlob);
db_set_blob(hContact, PLUGIN_NAME, "LastMsgEvents", eventdata, (pos - eventdata) + dbei_size);
free(eventdata);
}
diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp
index 22ca8df42b..81d1493fa7 100644
--- a/plugins/Spamotron/src/utils.cpp
+++ b/plugins/Spamotron/src/utils.cpp
@@ -454,7 +454,7 @@ int _notify(MCONTACT hContact, BYTE type, TCHAR *message, TCHAR *origmessage)
}
return 0;
}
-#define DOT(a) (a[strlen(a)-1] == 46) ? "" : "."
+#define DOT(a) (a[mir_strlen(a)-1] == 46) ? "" : "."
int LogToSystemHistory(char *message, char *origmessage)
{
char msg[MAX_BUFFER_LENGTH];
@@ -497,9 +497,9 @@ void MarkUnread(MCONTACT hContact)
memcpy(&_dbei.flags, pos, sizeof(DWORD)); pos += sizeof(DWORD);
memcpy(&_dbei.timestamp, pos, sizeof(DWORD)); pos += sizeof(DWORD);
- _dbei.szModule = (char*)malloc(strlen((const char*)pos)+1);
+ _dbei.szModule = (char*)malloc(mir_strlen((const char*)pos)+1);
strcpy(_dbei.szModule, (const char*)pos);
- pos += strlen((const char*)pos)+1;
+ pos += mir_strlen((const char*)pos)+1;
memcpy(&_dbei.cbBlob, pos, sizeof(DWORD)); pos += sizeof(DWORD);
_dbei.pBlob = (PBYTE)malloc(_dbei.cbBlob);