diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2015-05-23 17:49:58 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2015-05-23 17:49:58 +0000 |
commit | 6fcfba2c46a456677b5825a899469ba4e8905448 (patch) | |
tree | b4b6f6f9001b8609998a815ec1c7c92aa30b287e /protocols | |
parent | 24bed968f1e96aa4598d8dbe3a6e8a34dded3dc2 (diff) |
replace strncpy to mir_strncpy
git-svn-id: http://svn.miranda-ng.org/main/trunk@13785 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
41 files changed, 82 insertions, 82 deletions
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 2bf2907cf4..6d4bfcb17d 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -207,7 +207,7 @@ int gg_decodehosts(char *var, GGHOST *hosts, int max) // Insert new item
hosts[hp].hostname[127] = 0;
- strncpy(hosts[hp].hostname, hostname, 127);
+ mir_strncpy(hosts[hp].hostname, hostname, 127);
hosts[hp].port = portname ? atoi(portname) : 443;
hp ++;
diff --git a/protocols/Gadu-Gadu/src/dynstuff.cpp b/protocols/Gadu-Gadu/src/dynstuff.cpp index 4d21ed7eb0..e84273f6a3 100644 --- a/protocols/Gadu-Gadu/src/dynstuff.cpp +++ b/protocols/Gadu-Gadu/src/dynstuff.cpp @@ -247,7 +247,7 @@ int string_append_n(string_t s, const char *str, int count) string_realloc(s, s->len + count);
s->str[s->len + count] = 0;
- strncpy(s->str + s->len, str, count);
+ mir_strncpy(s->str + s->len, str, count);
s->len += count;
@@ -480,7 +480,7 @@ char **array_make(const char *string, const char *sep, int max, int trim, int qu } else {
for (q = p, len = 0; *q && (last || !strchr(sep, *q)); q++, len++);
token = (char*)calloc(1, len + 1);
- strncpy(token, p, len);
+ mir_strncpy(token, p, len);
token[len] = 0;
p = q;
}
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 3d23d0a9a5..bfa4e99c50 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -269,7 +269,7 @@ void __cdecl GGPROTO::dccmainthread(void*) {
PROTOFILETRANSFERSTATUS pfts;
local_dcc->tick = tick;
- strncpy(filename, local_dcc->folder, sizeof(filename));
+ mir_strncpy(filename, local_dcc->folder, sizeof(filename));
mir_strncat(filename, (char*)local_dcc->file_info.filename, sizeof(filename) - mir_strlen(filename));
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
@@ -300,7 +300,7 @@ void __cdecl GGPROTO::dccmainthread(void*) if (local_dcc->file_fd != -1)
{
PROTOFILETRANSFERSTATUS pfts;
- strncpy(filename, local_dcc->folder, sizeof(filename));
+ mir_strncpy(filename, local_dcc->folder, sizeof(filename));
mir_strncat(filename, (char*)local_dcc->file_info.filename, sizeof(filename) - mir_strlen(filename));
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
@@ -499,7 +499,7 @@ void __cdecl GGPROTO::dccmainthread(void*) {
PROTOFILETRANSFERSTATUS pfts;
local_dcc7->tick = tick;
- strncpy(filename, local_dcc7->folder, sizeof(filename));
+ mir_strncpy(filename, local_dcc7->folder, sizeof(filename));
mir_strncat(filename, (char*)local_dcc7->filename, sizeof(filename) - mir_strlen(filename));
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
@@ -530,7 +530,7 @@ void __cdecl GGPROTO::dccmainthread(void*) if (local_dcc7->file_fd != -1)
{
PROTOFILETRANSFERSTATUS pfts;
- strncpy(filename, local_dcc7->folder, sizeof(filename));
+ mir_strncpy(filename, local_dcc7->folder, sizeof(filename));
mir_strncat(filename, (char*)local_dcc7->filename, sizeof(filename) - mir_strlen(filename));
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
@@ -666,7 +666,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const PROTOCHAR* szPath) {
struct gg_dcc *dcc = (struct gg_dcc *) hTransfer;
char fileName[MAX_PATH], *path = mir_t2a(szPath);
- strncpy(fileName, path, sizeof(fileName));
+ mir_strncpy(fileName, path, sizeof(fileName));
mir_strncat(fileName, (char*)dcc->file_info.filename, sizeof(fileName) - mir_strlen(fileName));
dcc->folder = _strdup((char *) path);
dcc->tick = 0;
@@ -708,7 +708,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const PROTOCHAR* szPath) struct gg_dcc7 *dcc7 = (struct gg_dcc7 *) hTransfer;
char fileName[MAX_PATH], *path = mir_t2a(szPath);
int iFtRemoveRes;
- strncpy(fileName, path, sizeof(fileName));
+ mir_strncpy(fileName, path, sizeof(fileName));
mir_strncat(fileName, (char*)dcc7->filename, sizeof(fileName) - mir_strlen(fileName));
dcc7->folder = _strdup((char *) path);
dcc7->tick = 0;
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 45fd51745f..7196ed4b3c 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -436,7 +436,7 @@ void gg_debughandler(int level, const char *format, va_list ap) char *nl = strrchr(szFormat, '\n');
if (nl) *nl = 0;
- strncpy(szText + PREFIXLEN, "[libgadu] \0", sizeof(szText) - PREFIXLEN);
+ mir_strncpy(szText + PREFIXLEN, "[libgadu] \0", sizeof(szText) - PREFIXLEN);
char prefix[6];
mir_snprintf(prefix, SIZEOF(prefix), "%lu", GetCurrentThreadId());
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 2ca709ae01..2b903179bb 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -119,7 +119,7 @@ char *strndup(char *str, int c) {
char *ret = (char*)malloc(c + 1);
ret[c] = 0;
- strncpy(ret, str, c);
+ mir_strncpy(ret, str, c);
return ret;
}
@@ -174,7 +174,7 @@ void GGPROTO::parsecontacts(char *contacts) if (n && n != p)
{
strPhone = (char*)malloc((n - p) + 5);
- strncpy(strPhone, p, (n - p));
+ mir_strncpy(strPhone, p, (n - p));
mir_strcpy((strPhone + (n - p)), " SMS"); // Add SMS postfix
}
p = (n + 1);
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index d0f442d872..09b79b9b44 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -42,7 +42,7 @@ char *gg_status2db(int status, const char *suffix) case ID_STATUS_OUTTOLUNCH: prefix = "Otl"; break;
default: return NULL;
}
- strncpy(str, prefix, sizeof(str));
+ mir_strncpy(str, prefix, sizeof(str));
mir_strncat(str, suffix, sizeof(str) - mir_strlen(str));
return str;
}
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index 2fcf36d31d..85df02f089 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -132,7 +132,7 @@ int GGPROTO::gettoken(GGTOKEN *token) }
// Return token id
- strncpy(dat.id, t->tokenid, sizeof(dat.id));
+ mir_strncpy(dat.id, t->tokenid, sizeof(dat.id));
dat.width = t->width;
dat.height = t->height;
@@ -154,8 +154,8 @@ int GGPROTO::gettoken(GGTOKEN *token) return FALSE;
// Fillup patterns
- strncpy(token->id, dat.id, sizeof(token->id));
- strncpy(token->val, dat.val, sizeof(token->val));
+ mir_strncpy(token->id, dat.id, sizeof(token->id));
+ mir_strncpy(token->val, dat.val, sizeof(token->val));
return TRUE;
}
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index a5fcae5ee3..1dd223b08a 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -126,7 +126,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) if (!gg->getString(GG_KEY_EMAIL, &dbv_email))
{
- strncpy(email, dbv_email.pszVal, sizeof(email));
+ mir_strncpy(email, dbv_email.pszVal, sizeof(email));
db_free(&dbv_email);
}
diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index d4c8379d75..48bc68d16e 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -47,7 +47,7 @@ static INT_PTR icqGetCaps(WPARAM wParam, LPARAM lParam) static INT_PTR icqGetName(WPARAM wParam, LPARAM lParam)
{
- strncpy((char*)lParam, Translate(protoName), wParam);
+ mir_strncpy((char*)lParam, Translate(protoName), wParam);
return 0;
}
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 3a5974df1a..a94f366290 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -612,7 +612,7 @@ char* __fastcall null_strcpy(char *dest, const char *src, size_t maxlen) return NULL;
if (src && src[0]) {
- strncpy(dest, src, maxlen);
+ mir_strncpy(dest, src, maxlen);
dest[maxlen] = '\0';
}
else
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 79335a9182..6aeab1a831 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -602,7 +602,7 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM hContact, LPARAM) void CJabberProto::MenuInit()
{
char text[200];
- strncpy(text, m_szModuleName, sizeof(text)-1);
+ mir_strncpy(text, m_szModuleName, sizeof(text)-1);
char* tDest = text + mir_strlen(text);
CLISTMENUITEM mi = { sizeof(mi) };
@@ -825,7 +825,7 @@ void CJabberProto::GlobalMenuInit() // Hotkeys
char text[200];
- strncpy(text, m_szModuleName, sizeof(text) - 1);
+ mir_strncpy(text, m_szModuleName, sizeof(text) - 1);
char* tDest = text + mir_strlen(text);
HOTKEYDESC hkd = { sizeof(hkd) };
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index d2f84ff04f..483f1f488f 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -669,7 +669,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & cle.ptszTooltip = szStatusText;
if (getByte("TrayIconNewMailClkToInbox", MRA_DEFAULT_TRAYICON_NEW_MAIL_CLK_TO_INBOX)) {
- strncpy(szServiceFunction, m_szModuleName, MAX_PATH);
+ mir_strncpy(szServiceFunction, m_szModuleName, MAX_PATH);
pszServiceFunctionName = szServiceFunction + mir_strlen(m_szModuleName);
memcpy(pszServiceFunctionName, MRA_GOTO_INBOX, sizeof(MRA_GOTO_INBOX));
cle.pszService = szServiceFunction;
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index 6f349e9d0d..f4c6136ca4 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -278,7 +278,7 @@ int CMraProto::MraRebuildContactMenu(WPARAM hContact, LPARAM) int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM)
{
CHAR szServiceFunction[MAX_PATH * 2], *pszServiceFunctionName, szValueName[MAX_PATH];
- strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
+ mir_strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
pszServiceFunctionName = szServiceFunction + mir_strlen(m_szModuleName);
TCHAR szItem[MAX_PATH + 64];
@@ -326,7 +326,7 @@ HGENMENU CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bI return NULL;
char szServiceFunction[MAX_PATH];
- strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
+ mir_strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
char *pszServiceFunctionName = szServiceFunction + mir_strlen(m_szModuleName);
CLISTMENUITEM mi = { sizeof(mi) };
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 4e9b439eb7..da9fd4f2b4 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -50,7 +50,7 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p _tcsncpy(info->mChatID, _A2T(pszID), SIZEOF(info->mChatID));
parseWLID(NEWSTR_ALLOCA(pszID), &szNet, &szEmail, NULL);
info->netId = atoi(szNet);
- strncpy(info->szEmail, szEmail, sizeof(info->szEmail));
+ mir_strncpy(info->szEmail, szEmail, sizeof(info->szEmail));
TCHAR szName[512];
InterlockedIncrement(&m_chatID);
@@ -123,7 +123,7 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli) if (!gcu) {
gcu = new GCUserItem;
info->mJoinedContacts.insert(gcu);
- strncpy(gcu->WLID, mri, sizeof(gcu->WLID));
+ mir_strncpy(gcu->WLID, mri, sizeof(gcu->WLID));
}
mir_tstrcpy(gcu->role, _A2T(role));
diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp index 78e9c66584..bf45995a0f 100644 --- a/protocols/MSN/src/msn_libstr.cpp +++ b/protocols/MSN/src/msn_libstr.cpp @@ -411,6 +411,6 @@ time_t MsnTSToUnixtime(const char *pszTS) char szTS[16];
if (!*pszTS) return time(NULL);
- strncpy(szTS, pszTS, 10);
+ mir_strncpy(szTS, pszTS, 10);
return (time_t)atoi(szTS);
}
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index fbaa187a5c..6a50f7dcd4 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -100,7 +100,7 @@ bool CMsnProto::p2p_createListener(filetransfer* ft, directconnection *dc, MimeH newThread->mCaller = 3;
newThread->mIncomingBoundPort = sb;
newThread->mIncomingPort = nlb.wPort;
- strncpy(newThread->mCookie, dc->callId, sizeof(newThread->mCookie));
+ mir_strncpy(newThread->mCookie, dc->callId, sizeof(newThread->mCookie));
newThread->mInitialContactWLID = mir_strdup(ft->p2p_dest);
newThread->startThread(&CMsnProto::p2p_filePassiveThread, this);
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index f9a2ee775f..b1a15f850a 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -363,15 +363,15 @@ void CSametimeProto::LoadOptions() DBVARIANT dbv;
if (!db_get_utf(0, m_szModuleName, "ServerName", &dbv)) {
- strncpy(options.server_name, dbv.pszVal, LSTRINGLEN);
+ mir_strncpy(options.server_name, dbv.pszVal, LSTRINGLEN);
db_free(&dbv);
}
if (!db_get_utf(0, m_szModuleName, "stid", &dbv)) {
- strncpy(options.id, dbv.pszVal, LSTRINGLEN);
+ mir_strncpy(options.id, dbv.pszVal, LSTRINGLEN);
db_free(&dbv);
}
if (!db_get_utf(0, m_szModuleName, "Password", &dbv)) {
- strncpy(options.pword, dbv.pszVal, LSTRINGLEN);
+ mir_strncpy(options.pword, dbv.pszVal, LSTRINGLEN);
db_free(&dbv);
}
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index 708be8481f..627b9a7d56 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -44,7 +44,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO */
INT_PTR CSametimeProto::GetName(WPARAM wParam, LPARAM lParam)
{
- strncpy((char*)lParam, m_szModuleName, wParam);
+ mir_strncpy((char*)lParam, m_szModuleName, wParam);
return 0;
}
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index debe054ec3..0fd6d87e72 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -687,11 +687,11 @@ void mwResolve_handler_callback(mwServiceResolve* srvc, guint32 id, guint32 code for (; ri; ri = ri->next) {
mri = ((mwResolveResult *)ri->data)->matches;
for (; mri; mri = mri->next) {
- strncpy(mcsr.psr.stid, ((mwResolveMatch *)mri->data)->id, 256);
+ mir_strncpy(mcsr.psr.stid, ((mwResolveMatch *)mri->data)->id, 256);
mcsr.psr.stid[255] = 0;
MultiByteToWideChar(CP_UTF8, 0, mcsr.psr.stid, -1, mcsr.pszFields[0], 512);
- strncpy(mcsr.psr.name, ((mwResolveMatch *)mri->data)->name, 256);
+ mir_strncpy(mcsr.psr.name, ((mwResolveMatch *)mri->data)->name, 256);
mcsr.psr.name[255] = 0;
MultiByteToWideChar(CP_UTF8, 0, mcsr.psr.name, -1, mcsr.pszFields[1], 512);
diff --git a/protocols/SkypeClassic/src/filexfer.cpp b/protocols/SkypeClassic/src/filexfer.cpp index 313af9a315..5a8ff3df76 100644 --- a/protocols/SkypeClassic/src/filexfer.cpp +++ b/protocols/SkypeClassic/src/filexfer.cpp @@ -366,7 +366,7 @@ BOOL FXHandleMessage(const char *pszMsg) if (!pTok)
return FALSE;
- strncpy(args.szNum, pszMsg, pTok - pszMsg);
+ mir_strncpy(args.szNum, pszMsg, pTok - pszMsg);
pszMsg = pTok + 1;
if (!(pTok = strchr(pszMsg, ' '))) return FALSE;
pTok++;
@@ -374,7 +374,7 @@ BOOL FXHandleMessage(const char *pszMsg) return FALSE;
ft_args *pargs = (ft_args*)malloc(sizeof(args));
if (!pargs) return TRUE;
- strncpy(args.szArg, pTok, sizeof(args.szArg));
+ mir_strncpy(args.szArg, pTok, sizeof(args.szArg));
memcpy(pargs, &args, sizeof(args));
pthread_create((pThreadFunc)FXHandleMessageThread, pargs);
return TRUE;
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 147b467ecc..14a4363533 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -1387,7 +1387,7 @@ void MessageListProcessingThread(char *str) { // Frst we need to sort the message timestamps
for ((token = strtok_r(str+1, ", ", &nextoken)); token; token = strtok_r(NULL, ", ", &nextoken)) {
if (args = (fetchmsg_arg*)calloc(1, sizeof(fetchmsg_arg) + sizeof(DWORD))) {
- strncpy(args->msgnum, token, sizeof(args->msgnum)-1);
+ mir_strncpy(args->msgnum, token, sizeof(args->msgnum)-1);
args->getstatus = TRUE;
args->bIsRead = *str;
args->bDontMarkSeen = *str;
@@ -2163,7 +2163,7 @@ LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) // If new message is available, fetch it
ptr[0] = 0;
if (!(args = (fetchmsg_arg *)calloc(1, sizeof(*args)))) break;
- strncpy(args->msgnum, pMsgNum, sizeof(args->msgnum)-1);
+ mir_strncpy(args->msgnum, pMsgNum, sizeof(args->msgnum)-1);
args->getstatus = FALSE;
//args->bIsRead = strncmp(ptr+8, "READ", 4) == 0;
pthread_create((pThreadFunc)FetchMessageThreadSync, args);
@@ -2467,7 +2467,7 @@ void RetrieveUserAvatar(void *param) // Got it
MoveFileExA(pszTempFile, AvatarFile, MOVEFILE_REPLACE_EXISTING);
AI.format = PA_FORMAT_JPEG;
- strncpy(AI.filename, AvatarFile,SIZEOF(AI.filename)-1);
+ mir_strncpy(AI.filename, AvatarFile,SIZEOF(AI.filename)-1);
ack.hProcess = (HANDLE)&AI;
}
diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index ad6bc71967..e86658e69f 100644 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ b/protocols/SkypeClassic/src/skypeapi.cpp @@ -518,7 +518,7 @@ char *SkypeRcvMsg(char *what, time_t st, MCONTACT hContact, DWORD maxwait) // isn't using the ID anymore, so we have to save the ID as new identifier for message recognition
pCurMsg+=iLenWhat;
if ((pMsg = strchr (pCurMsg, ' ')) && (pMsg=strchr (pMsg+1, ' ')))
- strncpy (msgid, pCurMsg, pMsg-pCurMsg);
+ mir_strncpy (msgid, pCurMsg, pMsg-pCurMsg);
else if (strncmp (pCurMsg, "ERROR", 5) == 0) bIsError = TRUE;
}
@@ -1171,7 +1171,7 @@ INT_PTR SkypeSetAvatar(WPARAM wParam, LPARAM lParam) { // Backup old file
if (hasOldAvatar)
{
- strncpy(OldAvatarFile, dbv.pszVal, sizeof(OldAvatarFile)-4);
+ mir_strncpy(OldAvatarFile, dbv.pszVal, sizeof(OldAvatarFile)-4);
OldAvatarFile[sizeof(OldAvatarFile)-5] = '\0';
mir_strcat(OldAvatarFile, "_old");
DeleteFileA(OldAvatarFile);
diff --git a/protocols/SkypeClassic/src/skypeopt.cpp b/protocols/SkypeClassic/src/skypeopt.cpp index 358a95e153..fb35c5f483 100644 --- a/protocols/SkypeClassic/src/skypeopt.cpp +++ b/protocols/SkypeClassic/src/skypeopt.cpp @@ -611,12 +611,12 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L db_set_b (NULL, SKYPE_PROTONAME, "secondary", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SECONDARY)));
GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,text,SIZEOF(text));
- strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
+ mir_strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
CallService (MS_UTILS_PATHTORELATIVE, (WPARAM)text, (LPARAM)szRelativePath);
db_set_s(NULL, SKYPE_PROTONAME, "CommandLine", szRelativePath);
GetDlgItemTextA(hwndDlg,IDC_DATAPATH,text,SIZEOF(text));
- strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
+ mir_strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
CallService (MS_UTILS_PATHTORELATIVE, (WPARAM)text, (LPARAM)szRelativePath);
db_set_s(NULL, SKYPE_PROTONAME, "datapath", szRelativePath);
diff --git a/protocols/SkypeClassic/src/skypeprofile.cpp b/protocols/SkypeClassic/src/skypeprofile.cpp index 045a5b7d78..b796a96667 100644 --- a/protocols/SkypeClassic/src/skypeprofile.cpp +++ b/protocols/SkypeClassic/src/skypeprofile.cpp @@ -105,7 +105,7 @@ static void LoadSaveSkype(SkypeProfile *pstProf, BOOL bSet) if (astSettings[i].cType == sizeof(char)) {
char *pBuf;
if (utf8_decode (ptr, &pBuf) != -1) {
- strncpy ((char*)astSettings[i].lpDest, pBuf, astSettings[i].iSize);
+ mir_strncpy ((char*)astSettings[i].lpDest, pBuf, astSettings[i].iSize);
free (pBuf);
}
} else {
diff --git a/protocols/SkypeClassic/src/skypeproxy/skypeproxy.c b/protocols/SkypeClassic/src/skypeproxy/skypeproxy.c index 200b79632a..0802788e10 100644 --- a/protocols/SkypeClassic/src/skypeproxy/skypeproxy.c +++ b/protocols/SkypeClassic/src/skypeproxy/skypeproxy.c @@ -520,7 +520,7 @@ int main(int argc, char *argv[]) { }
for (i=0;i<argc;i++) {
if (!mir_strcmpi(argv[i], "-i") && argc>i+1)
- strncpy(BindIP, argv[i+1], sizeof(BindIP));
+ mir_strncpy(BindIP, argv[i+1], sizeof(BindIP));
if (!mir_strcmpi(argv[i], "-p") && argc>i+1)
if (!(BindPort=atoi(argv[i+1]))) {
OUTPUT("ERROR: Cannot convert port to int. bye..");
diff --git a/protocols/SkypeClassic/src/skypesvc.cpp b/protocols/SkypeClassic/src/skypesvc.cpp index fae8b8cd3b..e893721e42 100644 --- a/protocols/SkypeClassic/src/skypesvc.cpp +++ b/protocols/SkypeClassic/src/skypesvc.cpp @@ -147,7 +147,7 @@ INT_PTR SkypeGetName(WPARAM wParam, LPARAM lParam) {
if (lParam)
{
- strncpy((char *)lParam, SKYPE_PROTONAME, wParam);
+ mir_strncpy((char *)lParam, SKYPE_PROTONAME, wParam);
return 0; // Success
}
return 1; // Failure
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index e87fcac01d..e82ddbc75f 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -214,7 +214,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) if (end == NULL) {
end = resp->headers[i].szValue + mir_strlen(resp->headers[i].szValue);
}
- strncpy(cookie, start, (end - start));
+ mir_strncpy(cookie, start, (end - start));
break;
}
}
diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index 71ad60185f..fb58de29c0 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -578,7 +578,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info) if (numFiles == 1) {
if ((p=TlenXmlGetAttrValue(node, "n")) != NULL) {
p = TlenTextDecode(p);
- strncpy(szFilename, p, sizeof(szFilename)-1);
+ mir_strncpy(szFilename, p, sizeof(szFilename)-1);
mir_free(p);
} else {
mir_strcpy(szFilename, Translate("1 File"));
diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp index cb72d33849..51499497f3 100644 --- a/protocols/Tlen/src/tlen_p2p_old.cpp +++ b/protocols/Tlen/src/tlen_p2p_old.cpp @@ -334,7 +334,7 @@ static HANDLE TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) return NULL;
}
in.S_un.S_addr = *(PDWORD)(buf+4);
- strncpy(sb->szHost, inet_ntoa(in), sizeof(sb->szHost)-1);
+ mir_strncpy(sb->szHost, inet_ntoa(in), sizeof(sb->szHost)-1);
sb->wPort = htons(*(PWORD)(buf+2));
ft->s = s;
forkthread((void (__cdecl *)(void*))TlenFileBindSocks4Thread, 0, ft);
@@ -463,11 +463,11 @@ HANDLE TlenP2PListen(TLEN_FILE_TRANSFER *ft) if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE)) {
sb.useAuth = TRUE;
if (!db_get_s(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
- strncpy(sb.szUser, dbv.pszVal, sizeof(sb.szUser)-1);
+ mir_strncpy(sb.szUser, dbv.pszVal, sizeof(sb.szUser)-1);
db_free(&dbv);
}
if (!db_get_s(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
- strncpy(sb.szPassword, dbv.pszVal, sizeof(sb.szPassword)-1);
+ mir_strncpy(sb.szPassword, dbv.pszVal, sizeof(sb.szPassword)-1);
db_free(&dbv);
}
}
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 705b4ca150..487302c7fd 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -55,7 +55,7 @@ DWORD_PTR TlenProtocol::GetCaps(int type, MCONTACT hContact) INT_PTR TlenProtocol::GetName(WPARAM wParam, LPARAM lParam)
{
- strncpy((char*)lParam, m_szModuleName, wParam);
+ mir_strncpy((char*)lParam, m_szModuleName, wParam);
return 0;
}
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index f614b0a323..c8aef49d25 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -130,7 +130,7 @@ void __cdecl TlenServerThread(ThreadData *info) DBVARIANT dbv;
if (!db_get(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
- strncpy(info->username, dbv.pszVal, sizeof(info->username));
+ mir_strncpy(info->username, dbv.pszVal, sizeof(info->username));
info->username[sizeof(info->username)-1] = '\0';
_strlwr(info->username);
db_set_s(NULL, info->proto->m_szModuleName, "LoginName", info->username);
@@ -143,7 +143,7 @@ void __cdecl TlenServerThread(ThreadData *info) if (loginErr == 0) {
if (!db_get(NULL, info->proto->m_szModuleName, "LoginServer", &dbv)) {
- strncpy(info->server, dbv.pszVal, sizeof(info->server));
+ mir_strncpy(info->server, dbv.pszVal, sizeof(info->server));
info->server[sizeof(info->server)-1] = '\0';
_strlwr(info->server);
db_set_s(NULL, info->proto->m_szModuleName, "LoginServer", info->server);
@@ -168,7 +168,7 @@ void __cdecl TlenServerThread(ThreadData *info) CloseHandle(hEventPasswdDlg);
if (onlinePassword[0] != (char) -1) {
- strncpy(info->password, onlinePassword, sizeof(info->password));
+ mir_strncpy(info->password, onlinePassword, sizeof(info->password));
info->password[sizeof(info->password)-1] = '\0';
}
else {
@@ -178,7 +178,7 @@ void __cdecl TlenServerThread(ThreadData *info) }
else {
if (!db_get(NULL, info->proto->m_szModuleName, "Password", &dbv)) {
- strncpy(info->password, dbv.pszVal, sizeof(info->password));
+ mir_strncpy(info->password, dbv.pszVal, sizeof(info->password));
info->password[sizeof(info->password)-1] = '\0';
db_free(&dbv);
}
@@ -211,7 +211,7 @@ void __cdecl TlenServerThread(ThreadData *info) db_set_s(NULL, info->proto->m_szModuleName, "jid", jidStr);
if (!db_get(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) {
- strncpy(info->manualHost, dbv.pszVal, sizeof(info->manualHost));
+ mir_strncpy(info->manualHost, dbv.pszVal, sizeof(info->manualHost));
info->manualHost[sizeof(info->manualHost)-1] = '\0';
db_free(&dbv);
}
@@ -227,7 +227,7 @@ void __cdecl TlenServerThread(ThreadData *info) if (!db_get(NULL, info->proto->m_szModuleName, "AvatarHash", &dbv)) {
- strncpy(info->proto->threadData->avatarHash, dbv.pszVal, sizeof(info->proto->threadData->avatarHash)-1);
+ mir_strncpy(info->proto->threadData->avatarHash, dbv.pszVal, sizeof(info->proto->threadData->avatarHash)-1);
db_free(&dbv);
}
info->avatarFormat = db_get_dw(NULL, info->proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
@@ -587,7 +587,7 @@ static void TlenProcessAvatar(XmlNode* node, ThreadData *info) XmlNode *aNode = TlenXmlGetChild(node, "a");
if (tokenNode != NULL) {
char *token = tokenNode->text;
- strncpy(info->avatarToken, token, sizeof(info->avatarToken)-1);
+ mir_strncpy(info->avatarToken, token, sizeof(info->avatarToken)-1);
}
if (aNode != NULL) {
if (TlenProcessAvatarNode(info->proto, node, NULL)) {
diff --git a/protocols/Tlen/src/tlen_util.cpp b/protocols/Tlen/src/tlen_util.cpp index f315a3e177..61bde3433d 100644 --- a/protocols/Tlen/src/tlen_util.cpp +++ b/protocols/Tlen/src/tlen_util.cpp @@ -85,7 +85,7 @@ char *TlenResourceFromJID(const char *jid2) if (p != NULL && p[1] != '\0') {
p++;
if ((nick=(char *) mir_alloc(1+mir_strlen(jid)-(p-jid))) != NULL) {
- strncpy(nick, p, mir_strlen(jid)-(p-jid));
+ mir_strncpy(nick, p, mir_strlen(jid)-(p-jid));
nick[mir_strlen(jid)-(p-jid)] = '\0';
}
}
@@ -107,7 +107,7 @@ char *TlenNickFromJID(const char *jid2) p = strchr(jid, '/');
if (p != NULL) {
if ((nick=(char *) mir_alloc((p-jid)+1)) != NULL) {
- strncpy(nick, jid, p-jid);
+ mir_strncpy(nick, jid, p-jid);
nick[p-jid] = '\0';
}
}
@@ -128,7 +128,7 @@ char *TlenLoginFromJID(const char *jid2) p = strchr(jid, '/');
if (p != NULL) {
if ((nick=(char *) mir_alloc((p-jid)+1)) != NULL) {
- strncpy(nick, jid, p-jid);
+ mir_strncpy(nick, jid, p-jid);
nick[p-jid] = '\0';
}
}
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index 70bf723c23..1c4149c8ae 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -1016,7 +1016,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) db_free(&dbv);
}
else {
- strncpy(jid, from, SIZEOF(jid) - 1);
+ mir_strncpy(jid, from, SIZEOF(jid) - 1);
}
ignore = !IsAuthorized(proto, jid);
ask = true;
@@ -1029,7 +1029,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) db_free(&dbv);
}
else {
- strncpy(jid, from, SIZEOF(jid) - 1);
+ mir_strncpy(jid, from, SIZEOF(jid) - 1);
}
ask = !IsAuthorized(proto, jid);
ignore = false;
diff --git a/protocols/Tlen/src/tlen_xml.cpp b/protocols/Tlen/src/tlen_xml.cpp index 408df2ab3a..5939c65d58 100644 --- a/protocols/Tlen/src/tlen_xml.cpp +++ b/protocols/Tlen/src/tlen_xml.cpp @@ -126,18 +126,18 @@ int TlenXmlParse(XmlState *xmlState, char *buffer, int datalen) } else { if (*(p+1) == '/') { // closing tag - strncpy(tag, p+2, r-(p+2)); + mir_strncpy(tag, p+2, r-(p+2)); tag[r-(p+2)] = '\0'; elemType = ELEM_CLOSE; } else { if (*(r-1) == '/') { // single open/close tag - strncpy(tag, p+1, r-(p+1)-1); + mir_strncpy(tag, p+1, r-(p+1)-1); tag[r-(p+1)-1] = '\0'; elemType = ELEM_OPENCLOSE; } else { - strncpy(tag, p+1, r-(p+1)); + mir_strncpy(tag, p+1, r-(p+1)); tag[r-(p+1)] = '\0'; elemType = ELEM_OPEN; } @@ -147,7 +147,7 @@ int TlenXmlParse(XmlState *xmlState, char *buffer, int datalen) // TlenLog("ATTR_MAX_LEN too small, ignore current tag"); } else { - strncpy(attr, r, q-r); + mir_strncpy(attr, r, q-r); if ((q-r)>0 && attr[q-r-1] == '/') { attr[q-r-1] = '\0'; elemType = ELEM_OPENCLOSE; @@ -171,7 +171,7 @@ int TlenXmlParse(XmlState *xmlState, char *buffer, int datalen) for (q=p+1; q<eob && *q != '<'; q++); if (q < eob) { // found starting bracket of the next element str = (char *) mir_alloc(q-p+1); - strncpy(str, p, q-p); + mir_strncpy(str, p, q-p); str[q-p] = '\0'; TlenXmlProcessElem(xmlState, ELEM_TEXT, str, NULL); mir_free(str); @@ -220,7 +220,7 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) if (*p == '\0') { a->name = (char *) mir_alloc(klen+1); - strncpy(a->name, kstart, klen); + mir_strncpy(a->name, kstart, klen); a->name[klen] = '\0'; a->value = mir_strdup(""); break; @@ -228,7 +228,7 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) if (*p != '=') { a->name = (char *) mir_alloc(klen+1); - strncpy(a->name, kstart, klen); + mir_strncpy(a->name, kstart, klen); a->name[klen] = '\0'; a->value = mir_strdup(""); continue; @@ -242,7 +242,7 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) if (*p == '\0') { a->name = (char *) mir_alloc(klen+1); - strncpy(a->name, kstart, klen); + mir_strncpy(a->name, kstart, klen); a->name[klen] = '\0'; a->value = mir_strdup(""); break; @@ -263,10 +263,10 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) } a->name = (char *) mir_alloc(klen+1); - strncpy(a->name, kstart, klen); + mir_strncpy(a->name, kstart, klen); a->name[klen] = '\0'; a->value = (char *) mir_alloc(vlen+1); - strncpy(a->value, vstart, vlen); + mir_strncpy(a->value, vstart, vlen); a->value[vlen] = '\0'; } } diff --git a/protocols/Xfire/src/client.cpp b/protocols/Xfire/src/client.cpp index 024cfc16d9..4e0e7d1321 100644 --- a/protocols/Xfire/src/client.cpp +++ b/protocols/Xfire/src/client.cpp @@ -92,7 +92,7 @@ using namespace std; struct sockaddr_in sa;
int iLen = sizeof(sa);
getsockname(socket->m_sock, (SOCKADDR*)&sa, &iLen);
- strncpy(this->localaddr,inet_ntoa(sa.sin_addr), sizeof(this->localaddr)-1);
+ mir_strncpy(this->localaddr,inet_ntoa(sa.sin_addr), sizeof(this->localaddr)-1);
this->llocaladdr=inet_addr(this->localaddr);
packetReader->setSocket(socket);
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 0978600aaf..c6509ee017 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -2833,7 +2833,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc GameServerQuery_query gsqq = { 0 };
gsqq.port = gameob->port;
gsqq.xfiregameid = entry->game;
- strncpy(gsqq.ip, temp, SIZEOF(gsqq.ip)-1);
+ mir_strncpy(gsqq.ip, temp, SIZEOF(gsqq.ip)-1);
CallService("GameServerQuery/Query", (WPARAM)entry, (LPARAM)&gsqq);
}
}
@@ -3395,7 +3395,7 @@ INT_PTR GetAvatarInfo(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv;
if (!db_get(pai->hContact, "ContactPhoto", "File", &dbv))
{
- strncpy(pai->filename, dbv.pszVal, sizeof(pai->filename)-1);
+ mir_strncpy(pai->filename, dbv.pszVal, sizeof(pai->filename)-1);
db_free(&dbv);
}
else
diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp index 01fb52f082..81bd3e9427 100644 --- a/protocols/Xfire/src/searching4games.cpp +++ b/protocols/Xfire/src/searching4games.cpp @@ -67,7 +67,7 @@ BOOL CheckPath(char*ppath, char*pathwildcard = NULL) {
char temp[XFIRE_MAX_STATIC_STRING_LEN];
- strncpy(temp, ppath,XFIRE_MAX_STATIC_STRING_LEN-1);
+ mir_strncpy(temp, ppath,XFIRE_MAX_STATIC_STRING_LEN-1);
*(temp + mir_strlen(temp) - 1) = 0;
mir_strncat(temp, wfd.cFileName, SIZEOF(temp) - mir_strlen(temp));
mir_strncat(temp, "\\", SIZEOF(temp) - mir_strlen(temp));
diff --git a/protocols/Xfire/src/services.cpp b/protocols/Xfire/src/services.cpp index 380308cc14..2955dc85fc 100644 --- a/protocols/Xfire/src/services.cpp +++ b/protocols/Xfire/src/services.cpp @@ -58,7 +58,7 @@ INT_PTR GetMyAvatar(WPARAM wparam, LPARAM lparam) { if (!db_get(NULL, protocolname, "MyAvatarFile", &dbv))
{
- strncpy((char*)wparam, dbv.pszVal, (int)lparam);
+ mir_strncpy((char*)wparam, dbv.pszVal, (int)lparam);
db_free(&dbv);
return 0;
}
diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp index 05658e1ac8..0b4ccc956d 100644 --- a/protocols/Xfire/src/tools.cpp +++ b/protocols/Xfire/src/tools.cpp @@ -211,7 +211,7 @@ char* GetLaunchPath(char*launch) if (launch == NULL) return temp; - strncpy(temp, launch, XFIRE_MAX_STATIC_STRING_LEN -1); + mir_strncpy(temp, launch, XFIRE_MAX_STATIC_STRING_LEN -1); while (*p != 0 && *f != 0) { diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp index 70f167e933..dd1d038f30 100644 --- a/protocols/Xfire/src/variables.cpp +++ b/protocols/Xfire/src/variables.cpp @@ -23,7 +23,7 @@ char* Varxfiregame(ARGUMENTSINFO *ai) DBVARIANT dbv3;
if (!db_get(ai->fi->hContact, protocolname, "RGame", &dbv3))
{
- strncpy(temp, dbv3.pszVal, 255);
+ mir_strncpy(temp, dbv3.pszVal, 255);
db_free(&dbv3);
return mir_strdup(temp);
}
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 58c9089d4d..a2a20516cd 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -289,7 +289,7 @@ const char* CYahooProto::find_buddy( const char *yahoo_id) if (GetStringUtf(hContact, "Nick", &dbv))
return NULL;
- strncpy(nick, dbv.pszVal, sizeof(nick)-1);
+ mir_strncpy(nick, dbv.pszVal, sizeof(nick)-1);
db_free(&dbv);
return nick;
}
|