From bcef20b32d93e14f162caa83cf25497b67dcb08e Mon Sep 17 00:00:00 2001 From: anders_k Date: Mon, 5 Jun 2017 21:43:07 +0000 Subject: [PATCH] Bring back optimized mystrcpy(tmpbuf, _T("NUL")) from NSIS2 git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6869 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/exehead/util.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/exehead/util.c b/Source/exehead/util.c index c4db02d4..138b9f68 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -546,7 +546,11 @@ void RenameViaWininit(const TCHAR* prevName, const TCHAR* newName) int spn; // length of the short path name in TCHARs. - mystrcpy(tmpbuf, _T("NUL")); + // Optimized mystrcpy(tmpbuf, _T("NUL")): + if (sizeof(TCHAR) == 1) + *(UINT32*)tmpbuf = ((UINT32)'N' << 0) | ((UINT32)'U' << 8) | ((UINT32)'L' << 16) | ((UINT32)'\0' << 24); + else + *(UINT64*)tmpbuf = ((UINT64)'N' << 0) | ((UINT64)'U' << 16) | ((UINT64)'L' << 32) | ((UINT64)'\0' << 48); if (newName) { // create the file if it's not already there to prevent GetShortPathName from failing