Get rid of the remaining calls to strncpyW, and remove that function

from wine/unicode.h.
This commit is contained in:
Alexandre Julliard 2005-04-21 17:18:50 +00:00
parent 56c34e1b2c
commit b965457c4a
6 changed files with 18 additions and 22 deletions

View File

@ -2669,6 +2669,7 @@ static BOOL ParseStringSecurityDescriptorToSecurityDescriptor(
WCHAR tok[MAX_PATH];
LPCWSTR lptoken;
LPBYTE lpNext = NULL;
DWORD len;
*cBytes = 0;
@ -2696,7 +2697,9 @@ static BOOL ParseStringSecurityDescriptorToSecurityDescriptor(
if (*lptoken)
lptoken--;
strncpyW(tok, StringSecurityDescriptor, lptoken - StringSecurityDescriptor);
len = lptoken - StringSecurityDescriptor;
memcpy( tok, StringSecurityDescriptor, len * sizeof(WCHAR) );
tok[len] = 0;
switch (toktype)
{

View File

@ -866,10 +866,12 @@ static int TIME_GetTimeZoneInfoFromReg(LPTIME_ZONE_INFORMATION tzinfo)
RtlInitUnicodeString( &nameW, valkey );\
if (!NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, KpInfo,\
sizeof(buf), &size )) { \
strncpyW( tofield, (WCHAR*) KpInfo->Data, \
sizeof( tofield) / sizeof(WCHAR) ); \
size_t len = (strlenW( (WCHAR*)KpInfo->Data ) + 1) * sizeof(WCHAR); \
if (len > sizeof(tofield)) len = sizeof(tofield); \
memcpy( tofield, KpInfo->Data, len ); \
tofield[(len/sizeof(WCHAR))-1] = 0; \
}
GTZIFR_N( TZStandardStartW, tzinfo->StandardDate)
GTZIFR_N( TZDaylightStartW, tzinfo->DaylightDate)
GTZIFR_N( TZBiasW, tzinfo->Bias)

View File

@ -182,7 +182,10 @@ INT __cdecl NTDLL_wcsncmp( LPCWSTR str1, LPCWSTR str2, INT n )
*/
LPWSTR __cdecl NTDLL_wcsncpy( LPWSTR s1, LPCWSTR s2, INT n )
{
return strncpyW( s1, s2, n );
WCHAR *ret = s1;
while (n-- > 0) if (!(*s1++ = *s2++)) break;
while (n-- > 0) *s1++ = 0;
return ret;
}

View File

@ -864,8 +864,7 @@ BOOL WINAPI FTP_FtpGetCurrentDirectoryW(LPWININETFTPSESSIONW lpwfs, LPWSTR lpszC
}
len = lastpos - firstpos - 1;
strncpyW(lpszCurrentDirectory, &lpszResponseBuffer[firstpos+1],
len < *lpdwCurrentDirectory ? len : *lpdwCurrentDirectory);
lstrcpynW(lpszCurrentDirectory, &lpszResponseBuffer[firstpos+1], *lpdwCurrentDirectory);
HeapFree(GetProcessHeap(), 0, lpszResponseBuffer);
*lpdwCurrentDirectory = len;
bSuccess = TRUE;

View File

@ -53,15 +53,12 @@ time_t ConvertTimeString(LPCWSTR asctime)
if(!asctime || !timelen)
return 0;
/* The atoiWs below relie on that tmpChar is \0 padded? */
strncpyW(tmpChar, asctime, TIME_STRING_LEN);
/* FIXME: the atoiWs below rely on that tmpChar is \0 padded */
memset( tmpChar, 0, sizeof(tmpChar) );
lstrcpynW(tmpChar, asctime, TIME_STRING_LEN);
/* Assert that the string is the expected length */
if (tmpChar[TIME_STRING_LEN - 1] != '\0')
{
tmpChar[TIME_STRING_LEN - 1] = '\0';
FIXME("\n");
}
if (strlenW(asctime) >= TIME_STRING_LEN) FIXME("\n");
/* Convert a time such as 'Mon, 15 Nov 1999 16:09:35 GMT' into a SYSTEMTIME structure
* We assume the time is in this format

View File

@ -204,14 +204,6 @@ static inline int strncmpW( const WCHAR *str1, const WCHAR *str2, int n )
return *str1 - *str2;
}
static inline WCHAR *strncpyW( WCHAR *str1, const WCHAR *str2, int n )
{
WCHAR *ret = str1;
while (n-- > 0) if (!(*str1++ = *str2++)) break;
while (n-- > 0) *str1++ = 0;
return ret;
}
static inline WCHAR *strcatW( WCHAR *dst, const WCHAR *src )
{
strcpyW( dst + strlenW(dst), src );