summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-05-23 17:49:58 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-05-23 17:49:58 +0000
commit6fcfba2c46a456677b5825a899469ba4e8905448 (patch)
treeb4b6f6f9001b8609998a815ec1c7c92aa30b287e /src
parent24bed968f1e96aa4598d8dbe3a6e8a34dded3dc2 (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 'src')
-rw-r--r--src/core/miranda.cpp2
-rw-r--r--src/core/stdchat/src/main.cpp12
-rw-r--r--src/core/stdclist/src/clcfonts.cpp14
-rw-r--r--src/modules/database/dbutils.cpp4
-rw-r--r--src/modules/fonts/FontOptions.cpp2
-rw-r--r--src/modules/fonts/FontService.cpp8
-rw-r--r--src/modules/metacontacts/meta_services.cpp4
-rw-r--r--src/modules/netlib/netlibhttp.cpp2
-rw-r--r--src/modules/netlib/netlibsock.cpp2
-rw-r--r--src/modules/netlib/netlibupnp.cpp12
-rw-r--r--src/modules/protocols/protochains.cpp2
-rw-r--r--src/modules/utils/path.cpp2
12 files changed, 33 insertions, 33 deletions
diff --git a/src/core/miranda.cpp b/src/core/miranda.cpp
index b5b65f8d40..510b6b2abf 100644
--- a/src/core/miranda.cpp
+++ b/src/core/miranda.cpp
@@ -363,7 +363,7 @@ static INT_PTR GetMirandaVersionText(WPARAM wParam, LPARAM lParam)
UINT blockSize;
VerQueryValue(pVerInfo, _T("\\StringFileInfo\\000004b0\\ProductVersion"), (LPVOID*)&productVersion, &blockSize);
- strncpy((char*)lParam, _T2A(productVersion), wParam);
+ mir_strncpy((char*)lParam, _T2A(productVersion), wParam);
#if defined(_WIN64)
strcat_s((char*)lParam, wParam, " x64");
#endif
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp
index 48b31036a2..28390d4b66 100644
--- a/src/core/stdchat/src/main.cpp
+++ b/src/core/stdchat/src/main.cpp
@@ -286,30 +286,30 @@ static void OnLoadSettings()
static void RegisterFonts()
{
ColourIDT colourid = { sizeof(colourid) };
- strncpy(colourid.dbSettingsGroup, CHAT_MODULE, sizeof(colourid.dbSettingsGroup));
+ mir_strncpy(colourid.dbSettingsGroup, CHAT_MODULE, sizeof(colourid.dbSettingsGroup));
_tcsncpy(colourid.group, LPGENT("Chat module"), SIZEOF(colourid.group));
- strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting));
+ mir_strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Group chat log background"), SIZEOF(colourid.name));
colourid.defcolour = GetSysColor(COLOR_WINDOW);
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "ColorMessageBG", SIZEOF(colourid.setting));
+ mir_strncpy(colourid.setting, "ColorMessageBG", SIZEOF(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Message background"), SIZEOF(colourid.name));
colourid.defcolour = GetSysColor(COLOR_WINDOW);
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "ColorNicklistBG", SIZEOF(colourid.setting));
+ mir_strncpy(colourid.setting, "ColorNicklistBG", SIZEOF(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Nick list background"), SIZEOF(colourid.name));
colourid.defcolour = GetSysColor(COLOR_WINDOW);
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "ColorNicklistLines", SIZEOF(colourid.setting));
+ mir_strncpy(colourid.setting, "ColorNicklistLines", SIZEOF(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Nick list lines"), SIZEOF(colourid.name));
colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER);
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "ColorNicklistSelectedBG", SIZEOF(colourid.setting));
+ mir_strncpy(colourid.setting, "ColorNicklistSelectedBG", SIZEOF(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Nick list background (selected)"), SIZEOF(colourid.name));
colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
ColourRegisterT(&colourid);
diff --git a/src/core/stdclist/src/clcfonts.cpp b/src/core/stdclist/src/clcfonts.cpp
index 02ae7b298e..07e823d998 100644
--- a/src/core/stdclist/src/clcfonts.cpp
+++ b/src/core/stdclist/src/clcfonts.cpp
@@ -53,7 +53,7 @@ void RegisterCListFonts()
{
FontIDT fontid = { sizeof(fontid) };
fontid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWREREGISTER | FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS;
- strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup));
+ mir_strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup));
_tcsncpy(fontid.group, LPGENT("Contact list"), SIZEOF(fontid.group));
HDC hdc = GetDC(NULL);
@@ -74,7 +74,7 @@ void RegisterCListFonts()
char idstr[10];
mir_snprintf(idstr, SIZEOF(idstr), "Font%d", i);
- strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix));
+ mir_strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix));
fontid.order = i;
FontRegisterT(&fontid);
}
@@ -84,27 +84,27 @@ void RegisterCListFonts()
ColourIDT colourid = { 0 };
colourid.cbSize = sizeof(ColourIDT);
colourid.order = 0;
- strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup));
+ mir_strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup));
- strncpy(colourid.setting, "BkColour", sizeof(colourid.setting));
+ mir_strncpy(colourid.setting, "BkColour", sizeof(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name));
_tcsncpy(colourid.group, LPGENT("Contact list"), SIZEOF(colourid.group));
colourid.defcolour = CLCDEFAULT_BKCOLOUR;
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting));
+ mir_strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Selected text"), SIZEOF(colourid.name));
colourid.order = 1;
colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR;
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting));
+ mir_strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Hottrack text"), SIZEOF(colourid.name));
colourid.order = 1;
colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR;
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting));
+ mir_strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Quicksearch text"), SIZEOF(colourid.name));
colourid.order = 1;
colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR;
diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp
index 2e7ef5de9e..91b1f170b4 100644
--- a/src/modules/database/dbutils.cpp
+++ b/src/modules/database/dbutils.cpp
@@ -282,7 +282,7 @@ static INT_PTR GetProfilePath(WPARAM wParam, LPARAM lParam)
return 1;
char *dst = (char*)lParam;
- strncpy(dst, _T2A(g_profileDir), wParam);
+ mir_strncpy(dst, _T2A(g_profileDir), wParam);
dst[wParam-1] = 0;
return 0;
}
@@ -295,7 +295,7 @@ static INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam)
char *dst = (char*)lParam;
char *tmp = makeFileName(g_profileName);
- strncpy(dst, tmp, wParam);
+ mir_strncpy(dst, tmp, wParam);
mir_free(tmp);
dst[wParam-1] = 0;
diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp
index 6efdc67f7d..45f79e0713 100644
--- a/src/modules/fonts/FontOptions.cpp
+++ b/src/modules/fonts/FontOptions.cpp
@@ -149,7 +149,7 @@ static BOOL ExportSettings(HWND hwndDlg, const TCHAR *filename, OBJLIST<FontInte
mir_snprintf(buff, SIZEOF(buff), "\n[%s]", F.dbSettingsGroup);
if (mir_strcmp(buff, header) != 0) {
- strncpy(header, buff, SIZEOF(header));
+ mir_strncpy(header, buff, SIZEOF(header));
WriteLine(out, buff);
}
diff --git a/src/modules/fonts/FontService.cpp b/src/modules/fonts/FontService.cpp
index 166110f2a8..d8f6dac156 100644
--- a/src/modules/fonts/FontService.cpp
+++ b/src/modules/fonts/FontService.cpp
@@ -90,22 +90,22 @@ int LoadFontserviceModule(void)
// create generic fonts
FontIDT fontid = { sizeof(fontid) };
- strncpy(fontid.dbSettingsGroup, "Fonts", sizeof(fontid.dbSettingsGroup));
+ mir_strncpy(fontid.dbSettingsGroup, "Fonts", sizeof(fontid.dbSettingsGroup));
_tcsncpy_s(fontid.group, LPGENT("General"), _TRUNCATE);
_tcsncpy_s(fontid.name, LPGENT("Headers"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSHEADER;
- strncpy(fontid.prefix, "Header", SIZEOF(fontid.prefix));
+ mir_strncpy(fontid.prefix, "Header", SIZEOF(fontid.prefix));
FontRegisterT(&fontid);
_tcsncpy_s(fontid.name, LPGENT("Generic text"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSGENERAL;
- strncpy(fontid.prefix, "Generic", SIZEOF(fontid.prefix));
+ mir_strncpy(fontid.prefix, "Generic", SIZEOF(fontid.prefix));
FontRegisterT(&fontid);
_tcsncpy_s(fontid.name, LPGENT("Small text"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSSMALL;
- strncpy(fontid.prefix, "Small", SIZEOF(fontid.prefix));
+ mir_strncpy(fontid.prefix, "Small", SIZEOF(fontid.prefix));
FontRegisterT(&fontid);
// do last for silly dyna plugin
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp
index f550d4edbd..3d50e8a455 100644
--- a/src/modules/metacontacts/meta_services.cpp
+++ b/src/modules/metacontacts/meta_services.cpp
@@ -83,7 +83,7 @@ INT_PTR Meta_GetName(WPARAM wParam, LPARAM lParam)
{
char *name = (char *)Translate(META_PROTO);
size_t size = min(mir_strlen(name), wParam - 1); // copy only the first size bytes.
- if (strncpy((char *)lParam, name, size) == NULL)
+ if (mir_strncpy((char *)lParam, name, size) == NULL)
return 1;
((char *)lParam)[size] = '\0';
return 0;
@@ -243,7 +243,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam, LPARAM lParam)
tfap->hContact = ccs->hContact;
tfap->hEvent = hEvent;
tfap->id = 10;
- strncpy(tfap->msg, Translate("No online contacts found."), SIZEOF(tfap->msg) - 1);
+ mir_strncpy(tfap->msg, Translate("No online contacts found."), SIZEOF(tfap->msg) - 1);
CloseHandle(mir_forkthread(sttFakeAckFail, (void*)tfap));
SetEvent(hEvent);
diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp
index cd7a173f1a..a30a15f2bf 100644
--- a/src/modules/netlib/netlibhttp.cpp
+++ b/src/modules/netlib/netlibhttp.cpp
@@ -583,7 +583,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
nlc->szNewUrl = (char*)mir_realloc(nlc->szNewUrl, rlen + mir_strlen(tmpUrl) * 3 + 1);
- strncpy(nlc->szNewUrl, pszFullUrl, rlen);
+ mir_strncpy(nlc->szNewUrl, pszFullUrl, rlen);
mir_strcpy(nlc->szNewUrl + rlen, tmpUrl);
pszFullUrl = nlc->szNewUrl;
pszUrl = NULL;
diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp
index e53e73bd89..5aaea3613a 100644
--- a/src/modules/netlib/netlibsock.cpp
+++ b/src/modules/netlib/netlibsock.cpp
@@ -237,7 +237,7 @@ void NetlibGetConnectionInfo(NetlibConnection* nlc, NETLIBCONNINFO *connInfo)
connInfo->dwIpv4 = sin.si_family == AF_INET ? htonl(sin.Ipv4.sin_addr.s_addr) : 0;
char *szTmp = NetlibAddressToString(&sin);
- strncpy(connInfo->szIpPort, szTmp, sizeof(connInfo->szIpPort));
+ mir_strncpy(connInfo->szIpPort, szTmp, sizeof(connInfo->szIpPort));
connInfo->szIpPort[sizeof(connInfo->szIpPort) - 1] = 0;
mir_free(szTmp);
}
diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp
index 2e3445126f..54fc04d640 100644
--- a/src/modules/netlib/netlibupnp.cpp
+++ b/src/modules/netlib/netlibupnp.cpp
@@ -147,7 +147,7 @@ static bool txtParseParam(char* szData, char* presearch,
while (*(cp1-1) == ' ' && cp1 > cp) --cp1;
len = min((size_t)(cp1 - cp), size-1);
- strncpy(param, cp, len);
+ mir_strncpy(param, cp, len);
param[len] = 0;
return true;
@@ -171,7 +171,7 @@ void parseURL(char* szUrl, char* szHost, unsigned short* sPort, char* szPath)
if (szHost != NULL) {
sz = pport - phost + 1;
if (sz > 256) sz = 256;
- strncpy(szHost, phost, sz);
+ mir_strncpy(szHost, phost, sz);
szHost[sz - 1] = 0;
}
@@ -185,7 +185,7 @@ void parseURL(char* szUrl, char* szHost, unsigned short* sPort, char* szPath)
}
if (szPath != NULL) {
- strncpy(szPath, ppath, 256);
+ mir_strncpy(szPath, ppath, 256);
szPath[255] = 0;
}
}
@@ -514,7 +514,7 @@ static bool getUPnPURLs(char* szUrl, size_t sizeUrl)
size_t ctlLen;
txtParseParam(szData, NULL, "<URLBase>", "</URLBase>", szTemp, sizeof(szTemp));
- strncpy(szCtlUrl, szTemp[0] ? szTemp : szUrl, sizeof(szCtlUrl));
+ mir_strncpy(szCtlUrl, szTemp[0] ? szTemp : szUrl, sizeof(szCtlUrl));
szCtlUrl[sizeof(szCtlUrl) - 1] = 0;
mir_snprintf(szTemp, SIZEOF(szTemp), search_device, szDev);
@@ -541,11 +541,11 @@ static bool getUPnPURLs(char* szUrl, size_t sizeUrl)
size_t ctlCLen = mir_strlen(szCtlUrl);
rpth = szCtlUrl + ctlCLen;
if (ctlCLen != 0 && *(rpth - 1) != '/')
- strncpy(rpth++, "/", sizeof(szCtlUrl) - ctlCLen);
+ mir_strncpy(rpth++, "/", sizeof(szCtlUrl) - ctlCLen);
}
ctlLen = sizeof(szCtlUrl) - (rpth - szCtlUrl);
- strncpy(rpth, szUrl, ctlLen);
+ mir_strncpy(rpth, szUrl, ctlLen);
szCtlUrl[sizeof(szCtlUrl) - 1] = 0;
}
else {
diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp
index be760d9877..b664922f49 100644
--- a/src/modules/protocols/protochains.cpp
+++ b/src/modules/protocols/protochains.cpp
@@ -34,7 +34,7 @@ static int GetProtocolP(MCONTACT hContact, char *szBuf, int cbLen)
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
if (cc && cc->szProto != NULL) {
- strncpy(szBuf, cc->szProto, cbLen);
+ mir_strncpy(szBuf, cc->szProto, cbLen);
szBuf[cbLen - 1] = 0;
return 0;
}
diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp
index 3564e357f0..91b8dba050 100644
--- a/src/modules/utils/path.cpp
+++ b/src/modules/utils/path.cpp
@@ -109,7 +109,7 @@ static __forceinline int _xcscmp(const char *s1, const char *s2) { return mir_st
static __forceinline int _xcsncmp(const char *s1, const char *s2, size_t n) { return strncmp(s1, s2, n); }
static __forceinline size_t _xcslen(const char *s1) { return mir_strlen(s1); }
static __forceinline char *_xcscpy(char *s1, const char *s2) { return mir_strcpy(s1, s2); }
-static __forceinline char *_xcsncpy(char *s1, const char *s2, size_t n) { return strncpy(s1, s2, n); }
+static __forceinline char *_xcsncpy(char *s1, const char *s2, size_t n) { return mir_strncpy(s1, s2, n); }
static __forceinline char *_xstrselect(char *, char *s1, TCHAR *s2) { return s1; }
static __forceinline char *_itox(char *, int a) { return itoa(a, (char *)mir_alloc(sizeof(char)*20), 10); }
static __forceinline char *mir_a2x(char *, char *s) { return mir_strdup(s); }