Fixed POSIX !searchparse bug (patch #251) and hopefully better compatibility with 2.46
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6485 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
881fa61896
commit
0bcb8f40ed
7 changed files with 31 additions and 49 deletions
|
@ -67,21 +67,13 @@ double my_wtof(const wchar_t *str)
|
|||
return atof(buf);
|
||||
}
|
||||
|
||||
unsigned int my_strncpy(TCHAR*Dest, const TCHAR*Src, unsigned int cchMax)
|
||||
size_t my_strncpy(TCHAR*Dest, const TCHAR*Src, size_t cchMax)
|
||||
{
|
||||
// Dest and Src must be valid, Dest is always \0 terminated.
|
||||
// Returns number of TCHARs copied to Dest; min(strlen(Src),cchMax-1).
|
||||
unsigned int cch = 0;
|
||||
if (cchMax)
|
||||
{
|
||||
for(;--cchMax;)
|
||||
{
|
||||
TCHAR ch = Src[cch];
|
||||
if (!ch) break;
|
||||
Dest[cch++] = ch;
|
||||
}
|
||||
Dest[cch] = _T('\0');
|
||||
}
|
||||
// Returns number of TCHARs copied to Dest (not counting \0); min(strlen(Src),cchMax-1).
|
||||
size_t cch = 0;
|
||||
if (cchMax) for (TCHAR c; --cchMax;) if (!(c = Src[cch])) break; else Dest[cch++] = c;
|
||||
Dest[cch] = _T('\0');
|
||||
return cch;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue