summaryrefslogtreecommitdiff
path: root/plugins/MirOTR/src/otr.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
commit4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch)
tree9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /plugins/MirOTR/src/otr.cpp
parentf0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (diff)
SIZEOF replaced with more secure analog - _countof
git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR/src/otr.cpp')
-rw-r--r--plugins/MirOTR/src/otr.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp
index 9d5a690cd3..b7ee6b3963 100644
--- a/plugins/MirOTR/src/otr.cpp
+++ b/plugins/MirOTR/src/otr.cpp
@@ -182,7 +182,7 @@ extern "C" {
if (context->protocol_version < MIROTR_PROTO_LATEST){
size_t remaining = mir_tstrlen(buff);
TCHAR *offset = buff + remaining;
- remaining = SIZEOF(buff) - remaining;
+ remaining = _countof(buff) - remaining;
mir_sntprintf(offset, remaining, TranslateT("\nusing older protocol version %i"), context->protocol_version);
}
ShowMessage(hContact, buff);
@@ -314,68 +314,68 @@ extern "C" {
break;
case OTRL_MSGEVENT_ENCRYPTION_REQUIRED:
msgfunc = ShowMessageInline;
- mir_tstrncpy(msg, TranslateT("Attempting to start a private conversation..."), SIZEOF(msg));
+ mir_tstrncpy(msg, TranslateT("Attempting to start a private conversation..."), _countof(msg));
break;
case OTRL_MSGEVENT_ENCRYPTION_ERROR:
msgfunc = ShowMessageInline;
- mir_tstrncpy(msg, TranslateT("An error occurred when encrypting your message.\nThe message was not sent"), SIZEOF(msg));
+ mir_tstrncpy(msg, TranslateT("An error occurred when encrypting your message.\nThe message was not sent"), _countof(msg));
break;
case OTRL_MSGEVENT_CONNECTION_ENDED:
msgfunc = ShowMessageInline;
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("'%s' has already closed his/her private connection to you; you should do the same"), contact);
+ mir_snwprintf(msg, _countof(msg), TranslateT("'%s' has already closed his/her private connection to you; you should do the same"), contact);
break;
case OTRL_MSGEVENT_SETUP_ERROR:
// title = TranslateT("OTR Error");
if (!err) err = GPG_ERR_INV_VALUE;
switch (gcry_err_code(err)){
case GPG_ERR_INV_VALUE:
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("Error setting up private conversation: %s"), TranslateT("Malformed message received"));
+ mir_snwprintf(msg, _countof(msg), TranslateT("Error setting up private conversation: %s"), TranslateT("Malformed message received"));
break;
default:{
TCHAR* tmp = mir_utf8decodeT(gcry_strerror(err));
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("Error setting up private conversation: %s"), tmp);
+ mir_snwprintf(msg, _countof(msg), TranslateT("Error setting up private conversation: %s"), tmp);
mir_free(tmp); }
}
break;
case OTRL_MSGEVENT_MSG_REFLECTED:
// title = TranslateT("OTR Error");
- mir_tstrncpy(msg, TranslateT("We are receiving our own OTR messages.\nYou are either trying to talk to yourself, or someone is reflecting your messages back at you"), SIZEOF(msg));
+ mir_tstrncpy(msg, TranslateT("We are receiving our own OTR messages.\nYou are either trying to talk to yourself, or someone is reflecting your messages back at you"), _countof(msg));
break;
case OTRL_MSGEVENT_MSG_RESENT:
// title = TranslateT("Message resent");
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("The last message to '%s' was resent"), contact);
+ mir_snwprintf(msg, _countof(msg), TranslateT("The last message to '%s' was resent"), contact);
break;
case OTRL_MSGEVENT_RCVDMSG_NOT_IN_PRIVATE:
// title = TranslateT("Unreadable message");
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("The encrypted message received from '%s' is unreadable, as you are not currently communicating privately"), contact);
+ mir_snwprintf(msg, _countof(msg), TranslateT("The encrypted message received from '%s' is unreadable, as you are not currently communicating privately"), contact);
break;
case OTRL_MSGEVENT_RCVDMSG_UNREADABLE:
// title = TranslateT("OTR Error");
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("We received an unreadable encrypted message from '%s'"), contact);
+ mir_snwprintf(msg, _countof(msg), TranslateT("We received an unreadable encrypted message from '%s'"), contact);
break;
case OTRL_MSGEVENT_RCVDMSG_MALFORMED:
// title = TranslateT("OTR Error");
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("We received a malformed data message from '%s'"), contact);
+ mir_snwprintf(msg, _countof(msg), TranslateT("We received a malformed data message from '%s'"), contact);
break;
case OTRL_MSGEVENT_RCVDMSG_GENERAL_ERR:{
// title = TranslateT("OTR Error");
TCHAR* tmp = mir_utf8decodeT(message);
- mir_tstrncpy(msg, tmp, SIZEOF(msg));
+ mir_tstrncpy(msg, tmp, _countof(msg));
mir_free(tmp);
break; }
case OTRL_MSGEVENT_RCVDMSG_UNENCRYPTED:{
// title = TranslateT("Received unencrypted message");
TCHAR* tmp = mir_utf8decodeT(message);
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("The following message received from '%s' was NOT encrypted: [%s]"), contact, tmp);
+ mir_snwprintf(msg, _countof(msg), TranslateT("The following message received from '%s' was NOT encrypted: [%s]"), contact, tmp);
mir_free(tmp);
break; }
case OTRL_MSGEVENT_RCVDMSG_FOR_OTHER_INSTANCE:
// title = TranslateT("Received message for a different session");
- mir_snwprintf(msg, SIZEOF(msg), TranslateT("'%s' has sent a message intended for a different session. If you are logged in multiple times, another session may have received the message."), contact);
+ mir_snwprintf(msg, _countof(msg), TranslateT("'%s' has sent a message intended for a different session. If you are logged in multiple times, another session may have received the message."), contact);
break;
default:
// title = TranslateT("OTR Error");
- mir_tstrncpy(msg, TranslateT("unknown OTR message received, please report that to Miranda NG"), SIZEOF(msg));
+ mir_tstrncpy(msg, TranslateT("unknown OTR message received, please report that to Miranda NG"), _countof(msg));
}
if (msg[0])
msgfunc(hContact, msg);