Sync with trunk r63270.

svn path=/branches/shell-experiments/; revision=63271
This commit is contained in:
David Quintana 2014-05-13 12:11:12 +00:00
commit 8db8073cbb
452 changed files with 42806 additions and 6586 deletions

View file

@ -7,6 +7,7 @@
#include <precomp.h>
#include <tchar.h>
#include <mbctype.h>
#if IS_SECAPI
#define _FAILURE -1
@ -99,12 +100,24 @@ _tsplitpath_x(
drive[2] = '\0';
}
path += 2;
}
}
/* Scan the rest of the string */
dir_start = path;
while (*path != '\0')
{
#if !defined(_UNICODE) && !defined(_LIBCNT_)
/* Check for multibyte lead bytes */
if (_ismbblead((unsigned char)*path))
{
/* Check for unexpected end of string */
if (path[1] == 0) break;
/* Skip the lead byte and the following byte */
path += 2;
continue;
}
#endif
/* Remember last path separator and last dot */
if ((*path == '\\') || (*path == '/')) file_start = path + 1;
if (*path == '.') ext_start = path;
@ -114,14 +127,14 @@ _tsplitpath_x(
/* Check if we got a file name / extension */
if (!file_start)
file_start = dir_start;
if (!ext_start || ext_start < file_start)
if (!ext_start || (ext_start < file_start))
ext_start = path;
if (dir)
{
src = dir_start;
count = dir_size - 1;
while (src < file_start && count--) *dir++ = *src++;
while ((src < file_start) && count--) *dir++ = *src++;
*dir = '\0';
}

View file

@ -113,10 +113,7 @@ int CDECL _i64toa_s(__int64 value, char *str, size_t size, int radix)
*p++ = *pos--;
str[0] = '\0';
MSVCRT_INVALID_PMT("str[size] is too small");
#ifndef _LIBCNT_
*_errno() = ERANGE;
#endif
MSVCRT_INVALID_PMT("str[size] is too small", ERANGE);
return ERANGE;
}
@ -182,10 +179,7 @@ int CDECL _ui64toa_s(unsigned __int64 value, char *str,
}while(value != 0);
if((unsigned)(buffer-pos+65) > size) {
MSVCRT_INVALID_PMT("str[size] is too small");
#ifndef _LIBCNT_
*_errno() = EINVAL;
#endif
MSVCRT_INVALID_PMT("str[size] is too small", EINVAL);
return EINVAL;
}
@ -322,10 +316,7 @@ int CDECL _ltoa_s(long value, char *str, size_t size, int radix)
*p++ = *pos--;
str[0] = '\0';
MSVCRT_INVALID_PMT("str[size] is too small");
#ifndef _LIBCNT_
*_errno() = EINVAL;
#endif
MSVCRT_INVALID_PMT("str[size] is too small", ERANGE);
return ERANGE;
}

View file

@ -123,11 +123,8 @@ _i64tow_s(__int64 value, wchar_t *str, size_t size, int radix)
for (pos = buffer + 63, i = 0; i < size; i++)
*p++ = *pos--;
MSVCRT_INVALID_PMT("str[size] is too small");
MSVCRT_INVALID_PMT("str[size] is too small", ERANGE);
str[0] = '\0';
#ifndef _LIBCNT_
*_errno() = ERANGE;
#endif
return ERANGE;
}
@ -195,10 +192,7 @@ _ui64tow_s( unsigned __int64 value, wchar_t *str,
} while (value != 0);
if((size_t)(buffer-pos+65) > size) {
MSVCRT_INVALID_PMT("str[size] is too small");
#ifndef _LIBCNT_
*_errno() = EINVAL;
#endif
MSVCRT_INVALID_PMT("str[size] is too small", EINVAL);
return EINVAL;
}
@ -338,11 +332,8 @@ _ltow_s(long value, wchar_t *str, size_t size, int radix)
for (pos = buffer + 31, i = 0; i < size; i++)
*p++ = *pos--;
MSVCRT_INVALID_PMT("str[size] is too small");
MSVCRT_INVALID_PMT("str[size] is too small", ERANGE);
str[0] = '\0';
#ifndef _LIBCNT_
*_errno() = ERANGE;
#endif
return ERANGE;
}

View file

@ -204,8 +204,7 @@ int CDECL __wcserror_s(wchar_t* buffer, size_t nc, const wchar_t* str)
if (str && *str) len += lstrlenW(str) + 2 /* ': ' */;
if (len > nc)
{
MSVCRT_INVALID_PMT("buffer[nc] is too small");
_set_errno(ERANGE);
MSVCRT_INVALID_PMT("buffer[nc] is too small", ERANGE);
return ERANGE;
}
if (str && *str)

View file

@ -432,7 +432,7 @@ INT CDECL wcsncat_s(wchar_t *dst, size_t elem,
}
if (dststart == elem)
{
MSVCRT_INVALID_PMT("dst[elem] is not NULL terminated\n");
MSVCRT_INVALID_PMT("dst[elem] is not NULL terminated\n", EINVAL);
return EINVAL;
}
@ -453,7 +453,7 @@ INT CDECL wcsncat_s(wchar_t *dst, size_t elem,
dst[dststart+srclen] = '\0';
return ret;
}
MSVCRT_INVALID_PMT("dst[elem] is too small");
MSVCRT_INVALID_PMT("dst[elem] is too small", ERANGE);
dst[0] = '\0';
return ERANGE;
}