extern errno_t _ultoa_s( unsigned long inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
extern errno_t _ultow_s( unsigned long inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
-extern errno_t _i64toa_s( long long inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
extern errno_t _i64tow_s( long long inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
-extern errno_t _ui64toa_s( unsigned long long inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
-extern errno_t _ui64tow_s( unsigned long long inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
-
extern errno_t _makepath_s( char* outDest, size_t inDestBufferSize, const char* inDrive, const char* inDirectory, const char* inFilename, const char* inExtension );
extern errno_t _wmakepath_s( WCHAR* outDest, size_t inDestBufferSize, const WCHAR* inDrive, const WCHAR* inDirectory, const WCHAR* inFilename, const WCHAR* inExtension );
extern int sscanf_s( const char *string, const char *format, ... );
extern int swscanf_s( const WCHAR *string, const WCHAR *format, ... );
-extern int _snscanf_s( const char *string, size_t count, const char *format, ... );
-extern int _snwscanf_s( const WCHAR *string, size_t count, const WCHAR *format, ... );
-
extern errno_t memcpy_s( void * dst, size_t sizeInBytes, const void * src, size_t count ) THROW_DECL;
extern errno_t memmove_s( void * dst, size_t sizeInBytes, const void * src, size_t count );
#define printf PAL_printf
#define vprintf PAL_vprintf
#define wprintf PAL_wprintf
-#define wcsspn PAL_wcsspn
#define wcstod PAL_wcstod
-#define wcstol PAL_wcstol
#define wcstoul PAL_wcstoul
#define wcscat PAL_wcscat
#define wcscpy PAL_wcscpy
#define swscanf PAL_swscanf
#define wcspbrk PAL_wcspbrk
#define wcscmp PAL_wcscmp
-#define wcsncat PAL_wcsncat
#define wcsncpy PAL_wcsncpy
#define wcstok PAL_wcstok
#define wcscspn PAL_wcscspn
#define time PAL_time
#define getenv PAL_getenv
#define fgets PAL_fgets
-#define fgetws PAL_fgetws
-#define fputc PAL_fputc
-#define putchar PAL_putchar
#define qsort PAL_qsort
#define bsearch PAL_bsearch
#define ferror PAL_ferror
#define fread PAL_fread
#define fwrite PAL_fwrite
-#define feof PAL_feof
#define ftell PAL_ftell
#define fclose PAL_fclose
-#define setbuf PAL_setbuf
#define fflush PAL_fflush
#define fputs PAL_fputs
#define fseek PAL_fseek
#define fgetpos PAL_fgetpos
#define fsetpos PAL_fsetpos
-#define getc PAL_getc
-#define fgetc PAL_getc // not a typo
-#define ungetc PAL_ungetc
#define setvbuf PAL_setvbuf
-#define atol PAL_atol
-#define labs PAL_labs
#define acos PAL_acos
#define acosh PAL_acosh
#define asin PAL_asin
#define scalbnf PAL_scalbnf
#define malloc PAL_malloc
#define free PAL_free
-#define mkstemp PAL_mkstemp
-#define rename PAL_rename
#define _strdup PAL__strdup
#define _getcwd PAL__getcwd
#define _open PAL__open
PALIMPORT size_t __cdecl strspn(const char *, const char *);
PALIMPORT size_t __cdecl strcspn(const char *, const char *);
PALIMPORT int __cdecl atoi(const char *);
-PALIMPORT LONG __cdecl atol(const char *);
PALIMPORT ULONG __cdecl strtoul(const char *, char **, int);
PALIMPORT double __cdecl atof(const char *);
PALIMPORT double __cdecl strtod(const char *, char **);
PALIMPORT DLLEXPORT errno_t __cdecl memcpy_s(void *, size_t, const void *, size_t) THROW_DECL;
PALIMPORT errno_t __cdecl memmove_s(void *, size_t, const void *, size_t);
-PALIMPORT char * __cdecl _strlwr(char *);
PALIMPORT DLLEXPORT int __cdecl _stricmp(const char *, const char *);
PALIMPORT DLLEXPORT int __cdecl vsprintf_s(char *, size_t, const char *, va_list);
PALIMPORT char * __cdecl _gcvt_s(char *, int, double, int);
PALIMPORT DLLEXPORT int __cdecl PAL_wcscmp(const WCHAR*, const WCHAR*);
PALIMPORT DLLEXPORT int __cdecl PAL_wcsncmp(const WCHAR *, const WCHAR *, size_t);
PALIMPORT DLLEXPORT WCHAR * __cdecl PAL_wcscat(WCHAR *, const WCHAR *);
-PALIMPORT WCHAR * __cdecl PAL_wcsncat(WCHAR *, const WCHAR *, size_t);
PALIMPORT WCHAR * __cdecl PAL_wcscpy(WCHAR *, const WCHAR *);
PALIMPORT WCHAR * __cdecl PAL_wcsncpy(WCHAR *, const WCHAR *, size_t);
PALIMPORT DLLEXPORT const WCHAR * __cdecl PAL_wcschr(const WCHAR *, WCHAR);
PALIMPORT int __cdecl PAL_swprintf(WCHAR *, const WCHAR *, ...);
PALIMPORT int __cdecl PAL_vswprintf(WCHAR *, const WCHAR *, va_list);
PALIMPORT int __cdecl PAL_swscanf(const WCHAR *, const WCHAR *, ...);
-PALIMPORT LONG __cdecl PAL_wcstol(const WCHAR *, WCHAR **, int);
PALIMPORT DLLEXPORT ULONG __cdecl PAL_wcstoul(const WCHAR *, WCHAR **, int);
-PALIMPORT size_t __cdecl PAL_wcsspn (const WCHAR *, const WCHAR *);
PALIMPORT double __cdecl PAL_wcstod(const WCHAR *, WCHAR **);
PALIMPORT WCHAR * __cdecl _wcslwr(WCHAR *);
// clang complains if this is declared with __int64
PALIMPORT long long __cdecl llabs(long long);
#ifndef PAL_STDCPP_COMPAT
-PALIMPORT LONG __cdecl labs(LONG);
-PALIMPORT int __cdecl _signbit(double);
PALIMPORT int __cdecl _finite(double);
PALIMPORT int __cdecl _isnan(double);
PALIMPORT double __cdecl _copysign(double, double);
PALIMPORT double __cdecl tan(double);
PALIMPORT double __cdecl tanh(double);
-PALIMPORT int __cdecl _signbitf(float);
PALIMPORT int __cdecl _finitef(float);
PALIMPORT int __cdecl _isnanf(float);
PALIMPORT float __cdecl _copysignf(float, float);
#endif // PAL_STDCPP_COMPAT
PALIMPORT int __cdecl PAL_fclose(PAL_FILE *);
-PALIMPORT void __cdecl PAL_setbuf(PAL_FILE *, char*);
PALIMPORT DLLEXPORT int __cdecl PAL_fflush(PAL_FILE *);
PALIMPORT size_t __cdecl PAL_fwrite(const void *, size_t, size_t, PAL_FILE *);
PALIMPORT size_t __cdecl PAL_fread(void *, size_t, size_t, PAL_FILE *);
PALIMPORT char * __cdecl PAL_fgets(char *, int, PAL_FILE *);
PALIMPORT int __cdecl PAL_fputs(const char *, PAL_FILE *);
-PALIMPORT int __cdecl PAL_fputc(int c, PAL_FILE *stream);
-PALIMPORT int __cdecl PAL_putchar(int c);
PALIMPORT DLLEXPORT int __cdecl PAL_fprintf(PAL_FILE *, const char *, ...);
PALIMPORT int __cdecl PAL_vfprintf(PAL_FILE *, const char *, va_list);
PALIMPORT int __cdecl PAL_fseek(PAL_FILE *, LONG, int);
PALIMPORT LONG __cdecl PAL_ftell(PAL_FILE *);
-PALIMPORT int __cdecl PAL_feof(PAL_FILE *);
PALIMPORT int __cdecl PAL_ferror(PAL_FILE *);
PALIMPORT PAL_FILE * __cdecl PAL_fopen(const char *, const char *);
-PALIMPORT int __cdecl PAL_getc(PAL_FILE *stream);
-PALIMPORT int __cdecl PAL_fgetc(PAL_FILE *stream);
-PALIMPORT int __cdecl PAL_ungetc(int c, PAL_FILE *stream);
PALIMPORT int __cdecl PAL_setvbuf(PAL_FILE *stream, char *, int, size_t);
-PALIMPORT WCHAR * __cdecl PAL_fgetws(WCHAR *, int, PAL_FILE *);
PALIMPORT DLLEXPORT int __cdecl PAL_fwprintf(PAL_FILE *, const WCHAR *, ...);
PALIMPORT int __cdecl PAL_vfwprintf(PAL_FILE *, const WCHAR *, va_list);
PALIMPORT int __cdecl PAL_wprintf(const WCHAR*, ...);
PALIMPORT int __cdecl _putw(int, PAL_FILE *);
PALIMPORT PAL_FILE * __cdecl _fdopen(int, const char *);
PALIMPORT PAL_FILE * __cdecl _wfopen(const WCHAR *, const WCHAR *);
-PALIMPORT PAL_FILE * __cdecl _wfsopen(const WCHAR *, const WCHAR *, int);
/* Maximum value that can be returned by the rand function. */
#define _wfopen_s _wfopen_unsafe
#define fopen_s _fopen_unsafe
-#define _strlwr_s _strlwr_unsafe
-
#define _vscprintf _vscprintf_unsafe
extern "C++" {
return 0;
}
-inline errno_t __cdecl _strlwr_unsafe(char *str, size_t sz)
-{
- char *copy = (char *)malloc(sz);
- if(copy == nullptr)
- return 1;
-
- errno_t retCode = strcpy_s(copy, sz, str);
- if(retCode) {
- free(copy);
- return 1;
- }
-
- _strlwr(copy);
- strcpy_s(str, sz, copy);
- free(copy);
-
- return 0;
-}
inline int __cdecl _vscprintf_unsafe(const char *_Format, va_list _ArgList)
{
#define _vsntprintf_s _vsnprintf_s
#define _tscanf_s scanf_s
#define _tsscanf_s sscanf_s
-#define _tsnscanf_s _snscanf_s
#elif defined(_UNICODE) || defined(UNICODE)
#define _vsntprintf_s _vsnwprintf_s
#define _tscanf_s wscanf_s
#define _tsscanf_s swscanf_s
-#define _tsnscanf_s _swnscanf_s
#elif defined(_MBCS)
#define _sntprintf_s _snprintf_s
#define _tscanf_s scanf_s
#define _tsscanf_s sscanf_s
-#define _tsnscanf_s _snscanf_s
#else
/* no inline version of swscanf_s */
-/* _snscanf_s */
-_SAFECRT__EXTERN_C
-int __cdecl _snscanf_s(const char *_String, size_t _Count, const char *_Format, ...);
-
-/* no C++ overload for snscanf_s */
-
-/* no inline version of snscanf_s */
-
/* _swnscanf_s */
_SAFECRT__EXTERN_C
int __cdecl _swnscanf_s(const WCHAR *_String, size_t _Count, const WCHAR *_Format, ...);
#define HAVE_LOWERCASE_ISO_NAME 0
#define HAVE_READ_REAL_TIME 0
#define HAVE_UNDERSCORE_ISO_NAME 0
-#define MKSTEMP64_IS_USED_INSTEAD_OF_MKSTEMP 0
#define NEED_DLCOMPAT 0
#define OPEN64_IS_USED_INSTEAD_OF_OPEN 0
#define PAL_IGNORE_NORMAL_THREAD_PRIORITY 0
}
/*++
-Function:
-_wfsopen
-
-see MSDN doc.
-
---*/
-PAL_FILE *
-__cdecl
-_wfsopen(
- const wchar_16 *fileName,
- const wchar_16 *mode,
- int shflag)
-{
- // UNIXTODO: Implement this.
- ERROR("Needs Implementation!!!");
- return NULL;
-}
-
-/*++
Function
PAL_get_stdout.
return nRetVal;
}
- int __cdecl PAL__flushall()
- {
- return fflush(NULL);
- }
-
-wchar_16 *
-__cdecl
-PAL_fgetws(wchar_16 *s, int n, PAL_FILE *f)
+int __cdecl PAL__flushall()
{
- ASSERT (0);
- return NULL;
+ return fflush(NULL);
}
+int __cdecl PAL_getc(PAL_FILE *stream);
/*++
Function :
/*++
Function :
- setbuf
-
- See MSDN for more details.
---*/
-void
-_cdecl
-PAL_setbuf(PAL_FILE * f, char * buffer)
-{
- PERF_ENTRY(setbuf);
- ENTRY( "setbuf( %p, %p )\n", f, buffer );
-
- _ASSERTE(f != NULL);
-
- setbuf( f->bsdFilePtr, buffer );
-
- LOGEXIT( "setbuf\n" );
- PERF_EXIT(setbuf);
-}
-
-/*++
-Function :
-
fputs
See MSDN for more details.
return nRetVal;
}
-/*--
-Function :
-
- fputc
-
- See MSDN for more details.
---*/
-int
-_cdecl
-PAL_fputc(int c, PAL_FILE * f)
-{
- INT nRetVal = 0;
-
- PERF_ENTRY(fputc);
- ENTRY( "fputc( 0x%x (%c), %p )\n", c, c, f);
-
- _ASSERTE(f != NULL);
-
- CLEARERR(f);
-
- nRetVal = fputc( c, f->bsdFilePtr );
-
- LOGEXIT( "fputc returning %d\n", nRetVal );
- PERF_EXIT(fputc);
- return nRetVal;
-}
-
-/*--
-Function :
-
- putchar
-
- See MSDN for more details.
---*/
-int
-_cdecl
-PAL_putchar( int c )
-{
- INT nRetVal = 0;
-
- PERF_ENTRY(putchar);
- ENTRY( "putchar( 0x%x (%c) )\n", c, c);
-
- nRetVal = putchar( c );
-
- LOGEXIT( "putchar returning %d\n", nRetVal );
- PERF_EXIT(putchar);
- return nRetVal;
-}
-
/*++
Function :
/*++
Function :
-
- feof
-
- See MSDN for more details.
---*/
-int
-_cdecl
-PAL_feof(PAL_FILE * f)
-{
- INT nRetVal = 0;
-
- PERF_ENTRY(feof);
- ENTRY( "feof( %p )\n", f );
-
- _ASSERTE(f != NULL);
- nRetVal = feof( f->bsdFilePtr );
-
- LOGEXIT( "feof returning %d\n", nRetVal );
- PERF_EXIT(feof);
- return nRetVal;
-}
-
-/*++
-Function :
-
getc
See MSDN for more details.
/*++
Function :
- ungetc
-
- See MSDN for more details.
---*/
-int
-_cdecl
-PAL_ungetc(int c, PAL_FILE * f)
-{
- INT nRetVal = 0;
-
- PERF_ENTRY(ungetc);
- ENTRY( "ungetc( %c, %p )\n", c, f );
-
- _ASSERTE(f != NULL);
-
-#if UNGETC_NOT_RETURN_EOF
- /* On some Unix platform such as Solaris, ungetc does not return EOF
- on write-only file. */
- if (f->bWriteOnlyMode)
- {
- nRetVal = EOF;
- }
- else
-#endif //UNGETC_NOT_RETURN_EOF
- {
- CLEARERR(f);
-
- nRetVal = ungetc( c, f->bsdFilePtr );
- }
-
- LOGEXIT( "ungetc returning %d\n", nRetVal );
- PERF_EXIT(ungetc);
- return nRetVal;
-}
-
-
-
-/*++
-Function :
-
setvbuf
See MSDN for more details.
/*++
-PAL_mkstemp
-
-Wrapper function for InternalMkstemp.
-
-Input parameters:
-
-szNameTemplate = template to follow when naming the created file
-
-Return value:
- Open file descriptor on success, -1 if file could not be created
---*/
-int
-__cdecl
-PAL_mkstemp(char *szNameTemplate)
-{
- return InternalMkstemp(szNameTemplate);
-}
-
-/*++
-InternalMkstemp
-
-Wrapper for mkstemp.
-
-Input parameters:
-
-szNameTemplate = template to follow when naming the created file
-
-Return value:
- Open file descriptor on success, -1 if file could not be created
---*/
-int
-CorUnix::InternalMkstemp(
- char *szNameTemplate
- )
-{
- int nRet = -1;
-#if MKSTEMP64_IS_USED_INSTEAD_OF_MKSTEMP
- nRet = mkstemp64(szNameTemplate);
-#else
- nRet = mkstemp(szNameTemplate);
-#endif
- return nRet;
-}
-
-
-/*++
PAL__open
Wrapper function for InternalOpen.
/*++
-PAL_rename
-
-Wrapper function for rename.
-
-Input parameters:
-
-szOldName = pointer to the pathname of the file to be renamed
-szNewName = pointer to the new pathname of the file
-
-Return value:
- Returns 0 on success and -1 on failure
---*/
-int
-__cdecl
-PAL_rename(
- const char *szOldName,
- const char *szNewName
- )
-{
- return rename(szOldName, szNewName);
-}
-
-
-/*++
PAL_fgets
Wrapper function for InternalFgets.
/*++
Function:
- _signbit
-
-Determines whether given double-precision floating point value has a negative sign.
-
-Return Value
-
-_signbit returns a nonzero value (TRUE) if the sign of its argument x is negative.
-
-Parameter
-
-x Double-precision floating-point value
-
---*/
-int __cdecl _signbit(double x)
-{
- int ret;
- PERF_ENTRY(_signbit);
- ENTRY("_signbit (x=%f)\n", x);
-
- ret = signbit(x);
-
- LOGEXIT("_signbit returns int %d\n", ret);
- PERF_EXIT(_signbit);
- return ret;
-}
-
-/*++
-Function:
_finite
Determines whether given double-precision floating point value is finite.
/*++
Function:
- labs
-
-See MSDN.
---*/
-PALIMPORT LONG __cdecl PAL_labs(LONG l)
-{
- long lRet;
- PERF_ENTRY(labs);
- ENTRY("labs (l=%ld)\n", l);
-
- lRet = labs(l);
-
- LOGEXIT("labs returns long %ld\n", lRet);
- PERF_EXIT(labs);
- return (LONG)lRet; // This explicit cast to LONG is used to silence any potential warnings due to implicitly casting the native long lRet to LONG when returning.
-}
-
-/*++
-Function:
log
See MSDN.
/*++
Function:
- _signbitf
-
-Determines whether given single-precision floating point value has a negative sign.
-
-Return Value
-
-_signbitf returns a nonzero value (TRUE) if the sign of its argument x is negative.
-
-Parameter
-
-x Single-precision floating-point value
-
---*/
-int __cdecl _signbitf(float x)
-{
- int ret;
- PERF_ENTRY(_signbitf);
- ENTRY("_signbitf (x=%f)\n", x);
-
- ret = signbit(x);
-
- LOGEXIT("_signbitf returns int %d\n", ret);
- PERF_EXIT(_signbitf);
- return ret;
-}
-
-/*++
-Function:
_finitef
Determines whether given single-precision floating point value is finite.
/*******************************************************************************
Function:
- PAL_vsscanf
+ PAL_wvsscanf
-Parameters:
Buffer
- buffer to parse values from
Format
ap
- stdarg parameter list
*******************************************************************************/
-int PAL_vsscanf(LPCSTR Buffer, LPCSTR Format, va_list ap)
-{
- INT Length = 0;
- LPCSTR Buff = Buffer;
- LPCSTR Fmt = Format;
- CHAR TempBuff[1024]; /* used to hold a single %<foo> format string */
- BOOL Store;
- INT Width;
- INT Prefix;
- INT Type = -1;
-
- while (*Fmt)
- {
- if (!*Buff && Length == 0)
- {
- Length = EOF;
- break;
- }
- /* remove any number of blanks */
- else if (isspace((unsigned char) *Fmt))
- {
- while (isspace((unsigned char) *Buff))
- {
- ++Buff;
- }
- ++Fmt;
- }
- else if (*Fmt == '%' &&
- Internal_ScanfExtractFormatA(&Fmt, TempBuff, sizeof(TempBuff), &Store,
- &Width, &Prefix, &Type))
- {
- if (Prefix == SCANF_PREFIX_LONG &&
- (Type == SCANF_TYPE_STRING || Type == SCANF_TYPE_CHAR))
- {
- int len = 0;
- int res;
- WCHAR *charPtr = 0;
-
- /* a single character */
- if (Type == SCANF_TYPE_CHAR && Width == -1)
- {
- len = Width = 1;
- }
-
- /* calculate length of string to copy */
- while (Buff[len] && !isspace((unsigned char) Buff[len]))
- {
- if (Width != -1 && len >= Width)
- {
- break;
- }
- ++len;
- }
-
- if (Store)
- {
- charPtr = va_arg(ap, WCHAR *);
-
- res = MultiByteToWideChar(CP_ACP, 0, Buff, len,
- charPtr, len);
- if (!res)
- {
- ASSERT("MultiByteToWideChar failed. Error is %d\n",
- GetLastError());
- return -1;
- }
- if (Type == SCANF_TYPE_STRING)
- {
- /* end string */
- charPtr[res] = 0;
- }
- ++Length;
- }
- Buff += len;
- }
- /* this places the number of bytes stored into the next arg */
- else if (Type == SCANF_TYPE_N)
- {
- if (Prefix == SCANF_PREFIX_SHORT)
- {
- *(va_arg(ap, short *)) = Buff - Buffer;
- }
- else
- {
- *(va_arg(ap, LPLONG)) = Buff - Buffer;
- }
- }
- /* types that sscanf can handle */
- else
- {
- int ret;
- int n;
- LPVOID voidPtr = NULL;
-
- if (Store)
- {
- // sscanf_s requires that if we are trying to read "%s" or "%c" or “%[“, then
- // the size of the buffer must follow the buffer we are trying to read into.
- voidPtr = va_arg(ap, LPVOID);
- unsigned typeLen = 0;
- if ((Type == SCANF_TYPE_STRING) || (Type == SCANF_TYPE_BRACKETS))
- {
- // Since this is not a Safe CRT API we don’t really know the size of the destination
- // buffer provided by the caller. So we have to assume that the caller has allocated
- // enough space to hold either the width specified in the format or the entire input
- // string plus ‘\0’.
- typeLen = ((Width > 0) ? Width : strlen(Buffer)) + 1;
- }
- else if (Type == SCANF_TYPE_CHAR)
- {
- // Check whether the format string contains number of characters
- // that should be read from the input string.
- // Note: ‘\0’ does not get appended in the “%c” case.
- typeLen = (Width > 0) ? Width : 1;
- }
-
- if (typeLen > 0)
- {
- ret = sscanf_s(Buff, TempBuff, voidPtr, typeLen, &n);
- }
- else
- {
- ret = sscanf_s(Buff, TempBuff, voidPtr, &n);
- }
- }
- else
- {
- ret = sscanf_s(Buff, TempBuff, &n);
- }
-
-#if SSCANF_CANNOT_HANDLE_MISSING_EXPONENT
- if ((ret == 0) && (Type == SCANF_TYPE_FLOAT))
- {
- ret = SscanfFloatCheckExponent(Buff, TempBuff, voidPtr, &n);
- }
-#endif // SSCANF_CANNOT_HANDLE_MISSING_EXPONENT
-
- if (ret > 0)
- {
- Length += ret;
- }
- else
- {
- /* no match, break scan */
- break;
- }
- Buff += n;
- }
- }
- else
- {
- /* grab, but not store */
- if (*Fmt == *Buff && Type != SCANF_TYPE_SPACE)
- {
- ++Fmt;
- ++Buff;
- }
- /* doesn't match, break scan */
- else
- {
- break;
- }
- }
- }
-
- return Length;
-}
-
-/*******************************************************************************
-Function:
- PAL_wvsscanf
-
- -- see PAL_vsscanf above
-*******************************************************************************/
int PAL_wvsscanf(LPCWSTR Buffer, LPCWSTR Format, va_list ap)
{
INT Length = 0;
/*++
Function:
- _strlwr
-
-Convert a string to lowercase.
-
-
-This function returns a pointer to the converted string. Because the
-modification is done in place, the pointer returned is the same as the
-pointer passed as the input argument. No return value is reserved to
-indicate an error.
-
-Parameter
-
-string Null-terminated string to convert to lowercase
-
-Remarks
-
-The _strlwr function converts any uppercase letters in string to
-lowercase as determined by the LC_CTYPE category setting of the
-current locale. Other characters are not affected. For more
-information on LC_CTYPE, see setlocale.
-
---*/
-char *
-__cdecl
-_strlwr(
- char *str)
-{
- char *orig = str;
-
- PERF_ENTRY(_strlwr);
- ENTRY("_strlwr (str=%p (%s))\n", str?str:"NULL", str?str:"NULL");
-
- while (*str)
- {
- *str = tolower(*str);
- str++;
- }
-
- LOGEXIT("_strlwr returning char* %p (%s)\n", orig?orig:"NULL", orig?orig:"NULL");
- PERF_EXIT(_strlwr);
- return orig;
-}
-
-/*++
-Function:
PAL_strtoul
Convert string to an unsigned long-integer value.
return (ULONG)ulResult;
}
-
-
-/*++
-Function:
- PAL_atol
-
-Convert string to a long value.
-
-Return Value
-
-atol returns the converted value, if any. In the case of overflow,
-the return value is undefined.
-
-Parameters
-
-szNumber Null-terminated string to convert to a LONG
---*/
-
-/* The use of LONG is by design, to ensure that a 32 bit value is always
-returned from this function. If "long" is used instead of LONG, then a 64 bit
-value could be returned on 64 bit platforms like HP-UX, thus breaking
-Windows behavior. */
-LONG
-__cdecl
-PAL_atol(const char *szNumber)
-{
- long lResult;
-
- PERF_ENTRY(atol);
- ENTRY("atol (szNumber=%p (%s))\n",
- szNumber, szNumber?szNumber:"NULL"
- );
-
- lResult = atol(szNumber);
-
- LOGEXIT("atol returning long %ld\n", (LONG)lResult);
- PERF_EXIT(atol);
- /* This explicit cast to LONG is used to silence any potential warnings
- due to implicitly casting the native long lResult to LONG when returning. */
- return (LONG)lResult;
-
-}
-
/*++
Function:
- PAL_wcstol
-
-Convert string to a long-integer value.
-
-Return Value
-
-wcstol returns the value represented in the string nptr, except when
-the representation would cause an overflow, in which case it returns
-LONG_MAX or LONG_MIN. strtol returns 0 if no conversion can be
-performed. errno is set to ERANGE if overflow or underflow occurs.
-
-Parameters
-
-nptr Null-terminated string to convert
-endptr Pointer to character that stops scan
-base Number base to use
-
-Remarks
-
-The wcstol function converts nptr to a long. It stops reading the
-string nptr at the first character it cannot recognize as part of a
-number. This may be the terminating null character, or it may be the
-first numeric character greater than or equal to base.
-
-Notes :
- MSDN states that only space and tab are accepted as leading whitespace, but
- tests indicate that other whitespace characters (newline, carriage return,
- etc) are also accepted. This matches the behavior on Unix systems.
-
- For wcstol and wcstoul, we need to check if the value to be returned
- is outside the 32 bit range. If so, the returned value needs to be set
- as appropriate, according to the MSDN pages for wcstol and wcstoul,
- and in all instances errno must be set to ERANGE (The one exception
- is converting a string representing a negative value to unsigned long).
- Note that on 64 bit Windows, long's are still 32 bit. Thus, to match
- Windows behavior, we must return long's in the 32 bit range.
---*/
-
-/* The use of LONG is by design, to ensure that a 32 bit value is always
-returned from this function. If "long" is used instead of LONG, then a 64 bit
-value could be returned on 64 bit platforms like HP-UX, thus breaking
-Windows behavior. */
-LONG
-__cdecl
-PAL_wcstol(
- const wchar_16 *nptr,
- wchar_16 **endptr,
- int base)
-{
- char *s_nptr = 0;
- char *s_endptr = 0;
- long res;
- int size;
- DWORD dwLastError = 0;
-
- PERF_ENTRY(wcstol);
- ENTRY("wcstol (nptr=%p (%S), endptr=%p, base=%d)\n", nptr?nptr:W16_NULLSTRING, nptr?nptr:W16_NULLSTRING,
- endptr, base);
-
- size = WideCharToMultiByte(CP_ACP, 0, nptr, -1, NULL, 0, NULL, NULL);
- if (!size)
- {
- dwLastError = GetLastError();
- ASSERT("WideCharToMultiByte failed. Error is %d\n", dwLastError);
- SetLastError(ERROR_INVALID_PARAMETER);
- res = 0;
- goto PAL_wcstolExit;
- }
- s_nptr = (char *)PAL_malloc(size);
- if (!s_nptr)
- {
- ERROR("PAL_malloc failed\n");
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- res = 0;
- goto PAL_wcstolExit;
- }
- size = WideCharToMultiByte(CP_ACP, 0, nptr, -1, s_nptr, size, NULL, NULL);
- if( size==0 )
- {
- dwLastError = GetLastError();
- ASSERT("WideCharToMultiByte failed. Error is %d\n", dwLastError);
- SetLastError(ERROR_INVALID_PARAMETER);
- res = 0;
- goto PAL_wcstolExit;
- }
-
- res = strtol(s_nptr, &s_endptr, base);
-
-#ifdef BIT64
- if (res > _I32_MAX)
- {
- res = _I32_MAX;
- errno = ERANGE;
- }
- else if (res < _I32_MIN)
- {
- res = _I32_MIN;
- errno = ERANGE;
- }
-#endif
-
- /* only ASCII characters will be accepted by strtol, and those always get
- mapped to single-byte characters, so the first rejected character will
- have the same index in the multibyte and widechar strings */
- if( endptr )
- {
- size = s_endptr - s_nptr;
- *endptr = (wchar_16 *)&nptr[size];
- }
-
-PAL_wcstolExit:
- PAL_free(s_nptr);
- LOGEXIT("wcstol returning long %ld\n", res);
- PERF_EXIT(wcstol);
- /* This explicit cast to LONG is used to silence any potential warnings
- due to implicitly casting the native long res to LONG when returning. */
- return (LONG)res;
-}
-
-
-/*++
-Function:
PAL_wcstoul
Convert string to an unsigned long-integer value.
return res;
}
+WCHAR * __cdecl PAL_wcsncat(WCHAR *, const WCHAR *, size_t);
+
/*++
Function:
PAL_wcscat
/*++
Function:
- PAL_wcsspn
-
-See MSDN or man page for wcspbrk.
---*/
-size_t
-__cdecl
-PAL_wcsspn (const wchar_16 *string, const wchar_16 *stringCharSet)
-{
- ASSERT(0);
- return 0;
-}
-
-
-/*++
-Function:
PAL_wcspbrk
See MSDN or man page for wcspbrk.
}
-/*++
-Function:
- FILEFileTimeToUnixTime
-
-See FILEUnixTimeToFileTime above.
-
-This function takes a win32 FILETIME structures, returns the equivalent
-time_t value, and, if the nsec parameter is non-null, also returns the
-nanoseconds.
-
-NOTE: a 32-bit time_t is only capable of representing dates between
-13 December 1901 and 19 January 2038. This function will calculate the
-number of seconds (positive or negative) since the Unix epoch, however if
-this value is outside of the range of 32-bit numbers, the result will be
-truncated on systems with a 32-bit time_t.
---*/
-time_t FILEFileTimeToUnixTime( FILETIME FileTime, long *nsec )
-{
- __int64 UnixTime;
-
- /* get the full win32 value, in 100ns */
- UnixTime = ((__int64)FileTime.dwHighDateTime << 32) +
- FileTime.dwLowDateTime;
-
- /* convert to the Unix epoch */
- UnixTime -= (SECS_BETWEEN_1601_AND_1970_EPOCHS * SECS_TO_100NS);
-
- TRACE("nsec=%p\n", nsec);
-
- if ( nsec )
- {
- /* get the number of 100ns, convert to ns */
- *nsec = (UnixTime % SECS_TO_100NS) * 100;
- }
-
- UnixTime /= SECS_TO_100NS; /* now convert to seconds */
-
- if ( (time_t)UnixTime != UnixTime )
- {
- WARN("Resulting value is too big for a time_t value\n");
- }
-
- TRACE("Win32 FILETIME = [%#x:%#x] converts to Unix time = [%ld.%09ld]\n",
- FileTime.dwHighDateTime, FileTime.dwLowDateTime ,(long) UnixTime,
- nsec?*nsec:0L);
-
- return (time_t)UnixTime;
-}
-
-
-
/**
Function
}
-/*++
-Function:
- FileDosToUnixPathW
-
-Abstract:
- Change a DOS path to a Unix path.
-
- Replaces '\' by '/', removes any trailing dots on directory/filenames,
- and changes '*.*' to be equal to '*'
-
-Parameter:
- IN/OUT lpPath: path to be modified
---*/
-void
-FILEDosToUnixPathW(
- LPWSTR lpPath)
-{
- LPWSTR p;
- LPWSTR pPointAtDot=NULL;
- WCHAR charBeforeFirstDot='\0';
-
- TRACE("Original DOS path = [%S]\n", lpPath);
-
- if (!lpPath)
- {
- return;
- }
-
- for (p = lpPath; *p; p++)
- {
- /* Make the \\ to / switch first */
- if (*p == '\\')
- {
- /* Replace \ with / */
- *p = '/';
- }
-
- if (pPointAtDot)
- {
- /* If pPointAtDot is not NULL, it is pointing at the first encountered
- dot. If we encountered a \, that means it could be a trailing dot */
- if (*p == '/')
- {
- /* If char before the first dot is a '\' or '.' (special case if the
- dot is the first char in the path) , then we leave it alone,
- because it is either . or .., otherwise it is a trailing dot
- pattern and will be truncated */
- if (charBeforeFirstDot != '.' && charBeforeFirstDot != '/')
- {
- memmove(pPointAtDot,p,((PAL_wcslen(p)+1)*sizeof(WCHAR)));
- p = pPointAtDot;
- }
- pPointAtDot = NULL; /* Need to reset this */
- }
- else if (*p == '*')
- {
- /* Check our size before doing anything with our pointers */
- if ((p - lpPath) >= 3)
- {
- /* At this point, we know that there is 1 or more dots and
- then a star. AND we know the size of our string at this
- point is at least 3 (so we can go backwards from our pointer
- safely AND there could possilby be two characters back)
- So lets check if there is a '*' and a '.' before, if there
- is, replace just a '*'. Otherwise, reset pPointAtDot to NULL
- and do nothing */
- if (p[-2] == '*' &&
- p[-1] == '.' &&
- p[0] == '*')
- {
- memmove(&(p[-2]),p,(PAL_wcslen(p)*sizeof(WCHAR)));
- }
-
- pPointAtDot = NULL;
- }
- }
- else if (*p != '.')
- {
- /* If we are here, that means that this is NOT a trailing dot,
- some other character is here, so forget our pointer */
- pPointAtDot = NULL;
- }
- }
- else
- {
- if (*p == '.')
- {
- /* If pPointAtDot is NULL, and we encounter a dot, save the pointer */
- pPointAtDot = p;
- if (pPointAtDot != lpPath)
- {
- charBeforeFirstDot = p[-1];
- }
- else
- {
- charBeforeFirstDot = lpPath[0];
- }
- }
- }
- }
-
- /* If pPointAtDot still points at anything, then we still have trailing dots.
- Truncate at pPointAtDot, unless the dots are path specifiers (. or ..) */
- if (pPointAtDot)
- {
- /* make sure the trailing dots don't follow a '/', and that they aren't
- the only thing in the name */
- if(pPointAtDot != lpPath && *(pPointAtDot-1) != '/')
- {
- *pPointAtDot = '\0';
- }
- }
-
- TRACE("Resulting Unix path = [%S]\n", lpPath);
-}
-
-
-/*++
-Function:
- FileUnixToDosPathA
-
-Abstract:
- Change a Unix path to a DOS path. Replace '/' by '\'.
-
-Parameter:
- IN/OUT lpPath: path to be modified
---*/
-void
-FILEUnixToDosPathA(
- LPSTR lpPath)
-{
- LPSTR p;
-
- TRACE("Original Unix path = [%s]\n", lpPath);
-
- if (!lpPath)
- return;
-
- for (p = lpPath; *p; p++)
- {
- if (*p == '/')
- *p = '\\';
- }
-
- TRACE("Resulting DOS path = [%s]\n", lpPath);
-}
-
/*++
Function:
}
/*++
-Function:
- FILEGetFileNameFromFullPath
-
-Given a full path, return a pointer to the first char of the filename part.
---*/
-LPCSTR FILEGetFileNameFromFullPathA( LPCSTR lpFullPath )
-{
- int DirLen = FILEGetDirectoryFromFullPathA( lpFullPath, 0, NULL );
-
- if ( DirLen > 0 )
- {
- return lpFullPath + DirLen - 1;
- }
- else
- {
- return lpFullPath;
- }
-}
-
-/*++
FILECanonicalizePath
Removes all instances of '/./', '/../' and '//' from an absolute path.
/*++
Function:
- FileDosToUnixPathW
-
-Abstract:
- Change a DOS path to a Unix path. Replace '\' by '/'.
-
-Parameter:
- IN/OUT lpPath: path to be modified
- --*/
-void
-FILEDosToUnixPathW(LPWSTR lpPath);
-
-/*++
-Function:
- FileUnixToDosPathA
-
-Abstract:
- Change a Unix path to a DOS path. Replace '/' by '\'.
-
-Parameter:
- IN/OUT lpPath: path to be modified
---*/
-void
-FILEUnixToDosPathA(LPSTR lpPath);
-
-/*++
-Function:
FILEGetDirectoryFromFullPathA
Parse the given path. If it contains a directory part and a file part,
/*++
Function:
- FILEGetFileNameFromFullPath
-
-Given a full path, return a pointer to the first char of the filename part.
---*/
-LPCSTR FILEGetFileNameFromFullPathA( LPCSTR lpFullPath );
-
-/*++
-Function:
FILEGetLastErrorFromErrno
Convert errno into the appropriate win32 error and return it.
int _cdecl PAL_fflush( PAL_FILE *stream );
/*++
-PAL_mkstemp
-
-Calls InternalMkstemp to call mkstemp
-
-Input parameters:
-
-char *szNameTemplate = the pattern to follow when creating a new file.
-
-Return value:
- file descriptor of opened file on success, -1 on failure.
---*/
-int __cdecl PAL_mkstemp(char *szNameTemplate);
-
-/*++
-PAL_rename
-
-Calls rename
-
-Input parameters:
-
-szOldName = pointer to the pathname of the file to be renamed
-szNewName = pointer to the new pathname of the file
-
-Return value:
- Returns 0 on success and -1 on failure
---*/
-int __cdecl PAL_rename(const char *szOldName, const char *szNewName);
-
-/*++
PAL_fgets
Wrapper function for InternalFgets.
);
/*++
- InternalMkstemp
- Wraps mkstemp
- --*/
- int
- InternalMkstemp(
- char *szNameTemplate
- );
-
- /*++
InternalFgets
Wraps fgets
--*/
/*++
Function:
- FileDosToUnixPathW
-
-Abstract:
- Change a DOS path to a Unix path. Replace '\' by '/'.
-
-Parameter:
- IN/OUT lpPath: path to be modified
- --*/
-void
-FILEDosToUnixPathW(LPWSTR lpPath);
-
-/*++
-Function:
- FileUnixToDosPathA
-
-Abstract:
- Change a Unix path to a DOS path. Replace '/' by '\'.
-
-Parameter:
- IN/OUT lpPath: path to be modified
---*/
-void
-FILEUnixToDosPathA(LPSTR lpPath);
-
-
-/*++
-Function:
FILEGetDirectoryFromFullPathA
Parse the given path. If it contains a directory part and a file part,
/*++
Function:
- FILEGetFileNameFromFullPath
-
-Given a full path, return a pointer to the first char of the filename part.
---*/
-LPCSTR FILEGetFileNameFromFullPathA( LPCSTR lpFullPath );
-
-/*++
-Function:
FILEGetLastErrorFromErrno
Convert errno into the appropriate win32 error and return it.
#endif /* HAVE_STAT_TIMESPEC */
FILETIME FILEUnixTimeToFileTime( time_t sec, long nsec );
-time_t FILEFileTimeToUnixTime( FILETIME FileTime, long *nsec );
#ifdef __APPLE__
#include <CoreFoundation/CFDate.h>
#undef towlower
#undef wint_t
#undef atoi
-#undef atol
#undef atof
#undef malloc
#undef realloc
#undef tm
#undef FILE
#undef fclose
-#undef setbuf
#undef fopen
#undef fread
-#undef feof
#undef ferror
#undef ftell
#undef fflush
#undef fwrite
#undef fgets
-#undef fgetws
-#undef fputc
-#undef putchar
#undef fputs
#undef fseek
#undef fgetpos
#undef fsetpos
#undef getcwd
-#undef getc
-#undef fgetc
-#undef ungetc
#undef _flushall
#undef setvbuf
-#undef mkstemp
-#undef rename
#undef unlink
#undef size_t
#undef time_t
#undef stdout
#undef stderr
#undef abs
-#undef labs
#undef llabs
#undef acos
#undef acosh
#undef srand
#undef errno
#undef getenv
-#undef wcsspn
#undef open
#undef glob
#undef vprintf
#undef wprintf
#undef wcstod
-#undef wcstol
#undef wcstoul
#undef _wcstoui64
#undef wcscat
#undef wcspbrk
#undef wcsstr
#undef wcscmp
-#undef wcsncat
#undef wcsncpy
#undef wcstok
#undef wcscspn
int _woutput_s( miniFILE* outfile, const wchar_t* _Format, va_list _ArgList);
int _output( miniFILE *outfile, const char* _Format, va_list _ArgList);
-int _soutput_s( char *_Dst, size_t _Size, const char *_Format, va_list _ArgList );
-int _swoutput_s( wchar_t *_Dst, size_t _Size, const wchar_t *_Format, va_list _ArgList );
-
int __tinput_s( miniFILE* inFile, const unsigned char * inFormat, va_list inArgList );
int __twinput_s( miniFILE* inFile, const wchar_t * inFormat, va_list inArgList );
#undef _free_crt
#define _free_crt free
-/* Wrapper for _output_s so that we do not expose FILE in the _output_s signature.
- * Always ensure null-termination. Returns the number of written chars, not including the terminating null.
- * Returns -1 if something went wrong during the formatting (in _output_s), e.g. mbcs conversions.
- * Returns -2 if the string has been truncated.
- * _output_s calls _invalid_parameter (and returns -1, possibly) if the format string is malformed.
- */
-#ifndef _UNICODE
-int __cdecl _soutput_s(char *_Dst, size_t _Size, const char *_Format, va_list _ArgList)
-#else /* _UNICODE */
-int __cdecl _swoutput_s(wchar_t *_Dst, size_t _Size, const wchar_t *_Format, va_list _ArgList)
-#endif /* _UNICODE */
-{
- miniFILE stream;
- miniFILE *outfile = &stream;
- int written = -1;
-
- /* validation section */
-#ifndef _UNICODE
- if(_Size==SIZE_MAX)
- {
- /* user is attempting to make us unbounded, but we don't fit that much */
- outfile->_cnt = INT_MAX;
- }
- else
- {
- _VALIDATE_RETURN(_Size <= INT_MAX, EINVAL, -1);
- outfile->_cnt = (int)_Size;
- }
- outfile->_ptr = outfile->_base = _Dst;
-#else /* _UNICODE */
- if(_Size==SIZE_MAX)
- {
- /* user is attempting to make us unbounded, but we don't fit that much */
- outfile->_cnt = INT_MAX;
- }
- else if(_Size>(INT_MAX/sizeof(wchar_t)))
- {
- /* we can't represent the amount of output the user asked for */
- _VALIDATE_RETURN( 0 /* FALSE */, EINVAL, -1 );
- }
- else
- {
- outfile->_cnt = (int)(_Size*sizeof(wchar_t));
- }
- outfile->_ptr = outfile->_base = (char*)_Dst;
-#endif /* _UNICODE */
- outfile->_flag = _IOWRT | _IOSTRG;
-
-#ifndef _UNICODE
- written = _output_s(outfile, _Format, _ArgList);
-#else /* _UNICODE */
- written = _woutput_s(outfile, _Format, _ArgList);
-#endif /* _UNICODE */
- _Dst[_Size - 1] = 0;
- if (written < 0)
- {
- if (outfile->_cnt < 0)
- {
- /* the buffer was too small; we return -2 to indicate truncation */
- return -2;
- }
- /* otherwise, something else failed: we reset the string and we return */
- if (_Dst != NULL && _Size > 0)
- {
- *_Dst = 0;
- }
- return written;
- }
-
-#ifndef _UNICODE
- if ((_putc_nolock('\0', outfile) != EOF))
-#else /* _UNICODE */
- if ((_putc_nolock('\0', outfile) != EOF) && (_putc_nolock('\0', outfile) != EOF))
-#endif /* _UNICODE */
- {
- return written;
- }
- /* the last putc failed, so it means there is not enough space in the buffer */
- return -2;
-}
-
-
#ifndef _CFLTCVT
#define _CFLTCVT _cfltcvt
#endif /* _CFLTCVT */
return ret;
}
-int __cdecl _snscanf_s (
- const char *string,
- size_t count,
- const char *format,
- ...
- )
-{
- int ret;
- va_list arglist;
- va_start(arglist, format);
- ret = vnscan_fn(__tinput_s, string, count, format, arglist);
- va_end(arglist);
- return ret;
-}
-
int __cdecl swscanf_s (
const wchar_t *string,
const wchar_t *format,
va_end(arglist);
return ret;
}
-
-int __cdecl _snwscanf_s (
- const wchar_t *string,
- size_t count,
- const wchar_t *format,
- ...
- )
-{
- int ret;
- va_list arglist;
- va_start(arglist, format);
- ret = vnwscan_fn(__twinput_s, string, count, format, arglist);
- va_end(arglist);
- return ret;
-}
-
#define _itox_s _itow_s
#define _ltox_s _ltow_s
#define _ultox_s _ultow_s
-#define x64tox_s x64tow_s
#define _i64tox_s _i64tow_s
-#define _ui64tox_s _ui64tow_s
#define xtox xtow
#define _ltox _ltow
#define _ultox _ultow
-#define x64tox x64tow
#else /* _UNICODE */
#define xtox_s xtoa_s
#define _itox_s _itoa_s
#define _ltox_s _ltoa_s
#define _ultox_s _ultoa_s
-#define x64tox_s x64toa_s
#define _i64tox_s _i64toa_s
-#define _ui64tox_s _ui64toa_s
#define xtox xtoa
#define _ltox _ltoa
#define _ultox _ultoa
-#define x64tox x64toa
#endif /* _UNICODE */
/***
add_subdirectory(atanhf)
add_subdirectory(atof)
add_subdirectory(atoi)
-add_subdirectory(atol)
add_subdirectory(bsearch)
add_subdirectory(cbrt)
add_subdirectory(cbrtf)
add_subdirectory(fabs)
add_subdirectory(fabsf)
add_subdirectory(fclose)
-add_subdirectory(feof)
add_subdirectory(ferror)
add_subdirectory(fflush)
add_subdirectory(fgets)
add_subdirectory(ftell)
add_subdirectory(fwprintf)
add_subdirectory(fwrite)
-add_subdirectory(getc)
add_subdirectory(getenv)
add_subdirectory(ilogb)
add_subdirectory(ilogbf)
add_subdirectory(iswspace)
add_subdirectory(iswupper)
add_subdirectory(isxdigit)
-add_subdirectory(labs)
add_subdirectory(llabs)
add_subdirectory(log)
add_subdirectory(log2)
add_subdirectory(toupper)
add_subdirectory(towlower)
add_subdirectory(towupper)
-add_subdirectory(ungetc)
add_subdirectory(vfprintf)
add_subdirectory(vprintf)
add_subdirectory(vsprintf)
add_subdirectory(wcscmp)
add_subdirectory(wcscpy)
add_subdirectory(wcslen)
-add_subdirectory(wcsncat)
add_subdirectory(wcsncmp)
add_subdirectory(wcsncpy)
add_subdirectory(wcspbrk)
add_subdirectory(wcsstr)
add_subdirectory(wcstod)
add_subdirectory(wcstok)
-add_subdirectory(wcstol)
add_subdirectory(wcstoul)
add_subdirectory(wprintf)
add_subdirectory(_alloca)
add_subdirectory(_snprintf_s)
add_subdirectory(_snwprintf_s)
add_subdirectory(_stricmp)
-add_subdirectory(_strlwr)
add_subdirectory(_strnicmp)
add_subdirectory(_vsnprintf_s)
add_subdirectory(_vsnwprintf_s)
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test1.cpp
-)
-
-add_executable(paltest_strlwr_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_strlwr_test1 coreclrpal)
-
-target_link_libraries(paltest_strlwr_test1
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================================
-**
-** Source: test1.c
-**
-** Purpose:
-** Using memcmp, check to see that after changing a string into all lowercase
-** that it is the lowercase string that was expected.
-**
-**
-**==========================================================================*/
-
-#include <palsuite.h>
-
-int __cdecl main(int argc, char *argv[])
-{
- char string[] = "aASdff";
- char checkstr[] = "aasdff";
- char *ret=NULL;
-
- /*
- * Initialize the PAL and return FAIL if this fails
- */
- if (0 != (PAL_Initialize(argc, argv)))
- {
- return FAIL;
- }
-
- ret = _strlwr(string);
-
- if (memcmp(ret, checkstr, sizeof(checkstr)) != 0)
- {
- Fail ("ERROR: _strlwr returning incorrect value\n"
- "Expected %s, got %s\n", checkstr, ret);
- }
-
- PAL_Terminate();
- return PASS;
-}
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = _strlwr
-Name = Positive Test for _strlwr
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Using memcmp, check to see that after changing a string into all lowercase
-= that it is the lowercase string that was expected.
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test1.cpp
-)
-
-add_executable(paltest_atol_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_atol_test1 coreclrpal)
-
-target_link_libraries(paltest_atol_test1
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=====================================================================
-**
-** Source: test1.c
-**
-** Purpose: Tests the PAL implementation of the atol function.
-** Check to ensure that the different ints (normal,
-** negative, decimal,exponent), all work as expected with
-** this function.
-**
-**
-**===================================================================*/
-
-#include <palsuite.h>
-
-struct testCase
-{
- LONG LongValue;
- char avalue[20];
-};
-
-int __cdecl main(int argc, char **argv)
-{
-
- LONG result=0;
- int i=0;
-
- struct testCase testCases[] =
- {
- {1234, "1234"},
- {-1234, "-1234"},
- {1234, "1234.44"},
- {1234, "1234e-5"},
- {1234, "1234e+5"},
- {1234, "1234E5"},
- {1234, "1234.657e-8"},
- {1234, "1234d-5"},
- {1234, "1234d+5"},
- {1234, "1234D5"},
- {1234567, " 1234567e-8 foo"},
- {0, "aaa 32 test"}
- };
-
- /*
- * Initialize the PAL and return FAIL if this fails
- */
- if (0 != (PAL_Initialize(argc, argv)))
- {
- return FAIL;
- }
-
- /* Loop through each case. Convert the string to a LONG
- and then compare to ensure that it is the correct value.
- */
-
- for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
- {
- /*Convert the string to a LONG.*/
- result = atol(testCases[i].avalue);
-
- if (testCases[i].LongValue != result)
- {
- Fail("ERROR: atol misinterpreted \"%s\" as %d instead of %d.\n"
- , testCases[i].avalue, result, testCases[i].LongValue);
- }
-
- }
-
-
- PAL_Terminate();
- return PASS;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = atol
-Name = Positive Test for atol
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Tests the PAL implementation of the atol function.
-= Check to ensure that the different ints (normal, negative, decimal,
-= exponent), all work as expected with this function.
-
-
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test1.cpp
-)
-
-add_executable(paltest_feof_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_feof_test1 coreclrpal)
-
-target_link_libraries(paltest_feof_test1
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=====================================================================
-**
-** Source: test1.c
-**
-** Purpose: Tests the PAL implementation of the feof function.
-** Open a file, and read some characters. Check that
-** feof states that it hasn't gone by the EOF. Then
-** read enough characters to go beyond the EOF, and check
-** that feof states this is so.
-**
-** Depends:
-** fopen
-** fread
-**
-**
-**
-**===================================================================*/
-
-/* The file 'testfile' should exist with 15 characters in it. If not,
- something has been lost ...
-*/
-
-#include <palsuite.h>
-
-int __cdecl main(int argc, char **argv)
-{
- const char filename[] = "testfile";
- char buffer[128];
- FILE * fp = NULL;
- int result;
-
- if (PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
-
- /* Open a file in READ mode */
-
- if((fp = fopen(filename, "r")) == NULL)
- {
- Fail("Unable to open a file for reading. Is the file "
- "in the directory? It should be.");
- }
-
- /* Read 10 characters from the file. The file has 15
- characters in it.
- */
-
- if((result = fread(buffer,1,10,fp)) == 0)
- {
- Fail("ERROR: Zero characters read from the file. It should have "
- "read 10 character in it.");
- }
-
- if(feof(fp))
- {
- Fail("ERROR: feof returned a value greater than 0. No read "
- "operation has gone beyond the EOF yet, and feof should "
- "return 0 still.");
- }
-
- /* Read 10 characters from the file. The file has 15
- characters in it. The file pointer should have no passed
- the end of file.
- */
-
- if((result = fread(buffer,1,10,fp)) == 0)
- {
- Fail("ERROR: Zero characters read from the file. It should have "
- "read 5 character in it.");
- }
-
- if(feof(fp) == 0)
- {
- Fail("ERROR: feof returned 0. The file pointer has gone beyond "
- "the EOF and this function should return positive now.");
- }
-
- PAL_Terminate();
- return PASS;
-}
-
-
+++ /dev/null
-This is a test.
\ No newline at end of file
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = feof
-Name = Positive Test for feof
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Tests the PAL implementation of the feof function.
-= Open a file, and read some characters. Check that feof states that
-= it hasn't gone by the EOF. Then read enough characters to go beyond
-= the EOF, and check that feof states this is so.
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- getc.cpp
-)
-
-add_executable(paltest_getc_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_getc_test1 coreclrpal)
-
-target_link_libraries(paltest_getc_test1
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=====================================================================
-**
-** Source: getc.c (test 1)
-**
-** Purpose: Tests the PAL implementation of the getc function.
-**
-**
-**===================================================================*/
-
-#include <palsuite.h>
-
-
-int __cdecl main(int argc, char *argv[])
-{
- const char szFileName[] = {"testfile.tmp"};
- const char szTestString[] =
- {"The quick brown fox jumped over the lazy dog's back."};
- FILE* pFile = NULL;
- int nCount = 0;
- int nChar = 0;
- char szBuiltString[256];
-
-
- if (0 != PAL_Initialize(argc,argv))
- {
- return FAIL;
- }
-
- memset(szBuiltString, 0, 256);
-
-
- /* create/open a file for read and write */
- pFile = fopen(szFileName, "w+");
- if (pFile == NULL)
- {
- Fail("getc: ERROR -> fopen failed to create the file %s with the "
- "error code %ld\n",
- szFileName,
- GetLastError());
- }
-
- /* try reading from an empty file */
- if ((nChar = getc(pFile)) != EOF)
- {
- Trace("getc: ERROR -> getc returned \"%c\" when run on "
- "an empty file.\n", nChar);
- if (fclose(pFile) != 0)
- {
- Trace("getc: ERROR -> fclose failed to close the file. "
- "GetLastError returned %ld\n",
- GetLastError());
- }
- Fail("");
- }
-
- // Move the file pointer back to the beginning of the file. Some
- // platforms require an fseek() between a getc() that returns EOF
- // and any subsequent output to the file.
- if (fseek(pFile, 0, SEEK_SET) != 0)
- {
- Trace("getc: ERROR -> fseek failed to move the file pointer to the "
- "beginning of the file. GetLastError returned %ld\n",
- GetLastError());
- if (fclose(pFile) != 0)
- {
- Trace("getc: ERROR -> fclose failed to close the file. "
- "GetLastError returned %ld\n",
- GetLastError());
- }
- Fail("");
- }
-
- /* populate the file with a known string */
- nCount = fprintf(pFile, szTestString);
- if (nCount != strlen(szTestString))
- {
- Fail("getc: ERROR -> fprintf failed to write %s. The string is %d "
- "characters long but fprintf apparently only wrote %d characters."
- " GetLastError returned %ld\n",
- szTestString,
- strlen(szTestString),
- nCount,
- GetLastError());
- }
-
- /* move the file pointer back to the beginning of the file */
- if (fseek(pFile, 0, SEEK_SET) != 0)
- {
- Trace("getc: ERROR -> fseek failed to move the file pointer to the "
- "beginning of the file. GetLastError returned %ld\n",
- GetLastError());
- if (fclose(pFile) != 0)
- {
- Trace("getc: ERROR -> fclose failed to close the file. "
- "GetLastError returned %ld\n",
- GetLastError());
- }
- Fail("");
- }
-
- /* now get the characters one at a time */
- nCount = 0;
- while ((nChar = getc(pFile)) != EOF)
- {
- szBuiltString[nCount++] = nChar;
- }
-
- /* now, let's see if it worked */
- if (strcmp(szBuiltString, szTestString) != 0)
- {
- Trace("getc: ERROR -> Reading one char at a time, getc built \"%s\" "
- "however it should have built \"%s\".\n",
- szBuiltString,
- szTestString);
- if (fclose(pFile) != 0)
- {
- Trace("getc: ERROR -> fclose failed to close the file. "
- "GetLastError returned %ld\n",
- GetLastError());
- }
- Fail("");
- }
-
- /* with the file pointer at EOF, try reading past EOF*/
- if ((nChar = getc(pFile)) != EOF)
- {
- Trace("getc: ERROR -> getc returned \"%c\" when reading past "
- "the end of the file.\n", nChar);
- if (fclose(pFile) != 0)
- {
- Trace("getc: ERROR -> fclose failed to close the file. "
- "GetLastError returned %ld\n",
- GetLastError());
- }
- Fail("");
- }
-
- if (fclose(pFile) != 0)
- {
- Fail("getc: ERROR -> fclose failed to close the file. "
- "GetLastError returned %ld\n",
- GetLastError());
- }
-
-
- PAL_Terminate();
- return PASS;
-}
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = file_io
-Function = getc
-Name = test for getc (test 1)
-Type = DEFAULT
-EXE1 = getc
-Description
-= Write a string to a file, read it in one character
-= at a time with getc and compare with the original string.
-= It also verifies that getc can't read past EOF.
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test1.cpp
-)
-
-add_executable(paltest_labs_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_labs_test1 coreclrpal)
-
-target_link_libraries(paltest_labs_test1
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=====================================================================
-**
-** Source: test1.c
-**
-** Purpose: Call labs on a series of values -- negative, positive, zero,
-** and the largest negative value of a LONG. Ensure that they are all
-** changed properly to their absoulte value.
-**
-**
-**===================================================================*/
-
-#include <palsuite.h>
-
-struct testCase
-{
- LONG LongValue;
- LONG AbsoluteLongValue;
-};
-
-int __cdecl main(int argc, char **argv)
-{
-
- LONG result=0;
- int i=0;
-
- struct testCase testCases[] =
- {
- {1234, 1234},
- {-1234, 1234},
- {0, 0},
- {-2147483647, 2147483647}, /* Max value to abs */
- {2147483647, 2147483647}
- };
-
- if (0 != (PAL_Initialize(argc, argv)))
- {
- return FAIL;
- }
-
- /* Loop through each case. Call labs on each LONG and ensure that
- the resulting value is correct.
- */
-
- for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
- {
- /* Absolute value on a LONG */
- result = labs(testCases[i].LongValue);
-
- if (testCases[i].AbsoluteLongValue != result)
- {
- Fail("ERROR: labs took the absoulte value of '%d' to be '%d' "
- "instead of %d.\n",
- testCases[i].LongValue,
- result,
- testCases[i].AbsoluteLongValue);
- }
- }
-
- PAL_Terminate();
- return PASS;
-}
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = labs
-Name = Series of tests for labs: positive, negative, zero, maximum long value.
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Call labs on a series of values -- negative, positive, zero,
-= and the largest negative value of a long. Ensure that they are all
-= changed properly to their absoulte value.
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-add_subdirectory(test2)
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- ungetc.cpp
-)
-
-add_executable(paltest_ungetc_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_ungetc_test1 coreclrpal)
-
-target_link_libraries(paltest_ungetc_test1
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = c_runtime
-Function = ungetc
-Name = test for ungetc (test 1)
-Type = DEFAULT
-EXE1 = ungetc
-Description
-= Test how ungetc handles a write-only file (should fail)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=====================================================================
-**
-** Source: ungetc.c (test 1)
-**
-** Purpose: Tests the PAL implementation of the ungetc function by calling
-** the function on a write-only file.
-**
-** Dependencies:
-** fopen
-** fclose
-** fseek
-**
-**
-**===================================================================*/
-
-#include <palsuite.h>
-
-
-int __cdecl main(int argc, char *argv[])
-{
- char szFileName[] = {"test1.tmp"};
- const char text[] =
- {"The quick brown fox jumped over the lazy dog's back."};
- FILE* pFile = NULL;
- int nChar = 65; /* 'A' */
- int nRc = 0;
- int itemsExpected;
- int itemsWritten;
-
- if (0 != PAL_Initialize(argc,argv))
- {
- return FAIL;
- }
-
- /* create the file */
- pFile = fopen(szFileName, "w");
- if (pFile == NULL)
- {
- Fail("ungetc: ERROR -> fopen failed to create the file \"%s\""
- " as write-only.\n",
- szFileName);
- }
-
- /* write to the file */
- itemsExpected = sizeof(text);
- itemsWritten = fwrite(text, sizeof(text[0]), sizeof(text), pFile);
- if (itemsWritten == 0)
- {
- Trace("ungetc: ERROR -> fwrite failed to write to the file \"%s\"\n",
- szFileName);
-
- if (fclose(pFile) != 0)
- {
- Fail("ungetc: ERROR -> fclose failed to close the file.\n");
- }
- Fail("");
-
- }
- else if (itemsWritten != itemsExpected)
- {
- Trace("ungetc: ERROR -> fwrite failed to write the correct number "
- "of characters to the file \"%s\"\n",
- szFileName);
-
- if (fclose(pFile) != 0)
- {
- Fail("ungetc: ERROR -> fclose failed to close the file.\n");
- }
- Fail("");
- }
-
- /* Close the file */
- if (fclose(pFile) != 0)
- {
- Fail("ungetc: ERROR -> fclose failed to close the file.\n");
- }
-
- /*
- ** open the file in write only mode and
- ** attempt to push an unread character back on the stream
- */
-
-
- /* open the file write-only */
- pFile = fopen(szFileName, "a");
- if (pFile == NULL)
- {
- Fail("ungetc: ERROR -> fopen failed to open the file \"%s\""
- " as write-only.\n",
- szFileName);
- }
-
- /* move the file pointer back to the beginning of the file */
- if (fseek(pFile, 1, SEEK_SET) != 0)
- {
-
- Trace("ungetc: ERROR -> fseek failed to move the file pointer to the "
- "beginning of the file.\n");
- if (fclose(pFile) != 0)
- {
- Trace("ungetc: ERROR -> fclose failed to close the file.\n");
- }
- Fail("");
- }
-
- /* call ungetc on a write-only file which should fail */
- if ((nRc = ungetc(nChar, pFile)) != EOF)
- {
- Trace("ungetc: ERROR -> ungetc returned \"%c\" when run on "
- "an write-only file.\n", nChar);
- if (fclose(pFile) != 0)
- {
- Trace("ungetc: ERROR -> fclose failed to close the file.\n");
- }
- Fail("");
- }
-
- if (fclose(pFile) != 0)
- {
- Fail("ungetc: ERROR -> fclose failed to close the file.\n");
- }
-
-
- PAL_Terminate();
- return PASS;
-}
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- ungetc.cpp
-)
-
-add_executable(paltest_ungetc_test2
- ${SOURCES}
-)
-
-add_dependencies(paltest_ungetc_test2 coreclrpal)
-
-target_link_libraries(paltest_ungetc_test2
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-foo bar
\ No newline at end of file
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = c_runtime
-Function = ungetc
-Name = test for ungetc (test 2)
-Type = DEFAULT
-EXE1 = ungetc
-Description
-= Push characters back onto the stream and verify
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=====================================================================
-**
-** Source: ungetc.c (test 2)
-**
-** Purpose: Tests the PAL implementation of the ungetc function
-**
-** Dependencies:
-** fopen
-** fread
-** fclose
-** fseek
-** getc
-**
-**
-**===================================================================*/
-
-#include <palsuite.h>
-
-
-int __cdecl main(int argc, char *argv[])
-{
- const char szFileName[] = {"test2.txt"};
- const char szNewString[] = {"bar bar"};
- char szBuffer[MAX_PATH];
- FILE* pFile = NULL;
- int nChar = 32; /* space */
- int i = 0;
- int nRc = 0;
- size_t nCount = 0;
-
-
- if (0 != PAL_Initialize(argc,argv))
- {
- return FAIL;
- }
-
-
- memset(szBuffer, 0, MAX_PATH);
-
- /*
- ** open the file in write only mode, populate it and
- ** attempt to push an unread character back on the stream
- */
-
-
- /* open the file for read */
- pFile = fopen(szFileName, "r");
- if (pFile == NULL)
- {
- Fail("ungetc: ERROR -> fopen failed to open the file \"%s\""
- " as read-only.n",
- szFileName);
- }
-
-
- /*
- ** Call getc to get the first char and ungetc to put
- ** it back. getc should read it again.
- */
-
- /* read a character */
- if ((nChar = getc(pFile)) == EOF)
- {
- Trace("ungetc: ERROR -> getc encountered an error reading.\n");
- if (fclose(pFile) != 0)
- {
- Trace("ungetc: ERROR -> fclose failed to close the file.\n");
- }
- Fail("");
- }
-
- /* put it back */
- if ((nRc = ungetc(nChar, pFile)) == EOF)
- {
- Trace("ungetc: ERROR -> ungetc failed to push '%c' back onto the"
- " stream.\n");
- if (fclose(pFile) != 0)
- {
- Trace("ungetc: ERROR -> fclose failed to close the file.\n");
- }
- Fail("");
- }
-
- /* read it again... hopefully */
- if (((nChar = getc(pFile)) == EOF) || (nChar != nRc))
- {
- Trace("ungetc: ERROR -> getc encountered an error reading.\n");
- if (fclose(pFile) != 0)
- {
- Trace("ungetc: ERROR -> fclose failed to close the file.\n");
- }
- Fail("");
- }
-
- /*
- ** test multiple ungetcs by replacing "foo" in the stream with "bar"
- */
-
- /* move the file pointer back to the beginning of the file */
- if (fseek(pFile, 0, SEEK_SET) != 0)
- {
- Trace("ungetc: ERROR -> fseek failed to move the file pointer to the "
- "beginning of the file. GetLastError returned %ld\n",
- GetLastError());
- if (fclose(pFile) != 0)
- {
- Trace("ungetc: ERROR -> fclose failed to close the file.\n");
- }
- Fail("");
- }
-
- /* read a few characters */
- for (i = 0; i < 3; i++)
- {
- if (getc(pFile) == EOF)
- {
- Trace("ungetc: ERROR -> getc encountered an error reading. "
- "GetLastError returned %ld\n",
- GetLastError());
- if (fclose(pFile) != 0)
- {
- Trace("ungetc: ERROR -> fclose failed to close the file.\n");
- }
- Fail("");
- }
- }
-
- /* we just read "foo" so push "bar" back on the stream */
- for (i = 2; i >= 0; i--)
- {
- if ((nRc = ungetc(szNewString[i], pFile)) == EOF)
- {
- Trace("ungetc: ERROR -> ungetc failed to push '%c' back onto the"
- " stream.\n");
- if (fclose(pFile) != 0)
- {
- Trace("ungetc: ERROR -> fclose failed to close the file.\n");
- }
- Fail("");
- }
- }
-
-
- /* read the new and improved stream - I use szNewString because it
- is correct length */
- nCount = fread(szBuffer, sizeof(char), strlen(szNewString), pFile);
-
- /* did we get the right number of characters?*/
- if (nCount != strlen(szNewString))
- {
- Trace("ungetc: ERROR -> fread read %d characters from the stream but"
- " %d characters were expected\n",
- nRc,
- strlen(szNewString));
- if (fclose(pFile) != 0)
- {
- Trace("ungetc: ERROR -> fclose failed to close the file.\n");
- }
- Fail("");
- }
-
- /* did we get the right string? */
- if (strcmp(szBuffer, szNewString) != 0)
- {
- Trace("ungetc: ERROR -> fread returned \"%s\" but \"%s\" was "
- "expected\n",
- szBuffer,
- szNewString);
- if (fclose(pFile) != 0)
- {
- Trace("ungetc: ERROR -> fclose failed to close the file.\n");
- }
- Fail("");
- }
-
- if (fclose(pFile) != 0)
- {
- Fail("ungetc: ERROR -> fclose failed to close the file.\n");
- }
-
-
- PAL_Terminate();
- return PASS;
-}
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test1.cpp
-)
-
-add_executable(paltest_wcsncat_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_wcsncat_test1 coreclrpal)
-
-target_link_libraries(paltest_wcsncat_test1
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================================
-**
-** Source: test1.c
-**
-** Purpose:
-** Tests that wcsncat correctly appends wide strings, making sure it handles
-** count argument correctly (appending no more than count characters, always
-** placing a null, and padding the string if necessary).
-**
-**
-**==========================================================================*/
-
-#include <palsuite.h>
-
-
-int __cdecl main(int argc, char *argv[])
-{
- WCHAR dest[80];
- WCHAR test[] = {'f','o','o',' ','b','a','r','b','a','z',0};
- WCHAR str1[] = {'f','o','o',' ',0};
- WCHAR str2[] = {'b','a','r',' ',0};
- WCHAR str3[] = {'b','a','z',0};
- WCHAR *ptr;
- int i;
-
-
- if (PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
-
- dest[0] = 0;
- for (i=1; i<80; i++)
- {
- dest[i] = (WCHAR)'x';
- }
-
- ptr = wcsncat(dest, str1, wcslen(str1));
- if (ptr != dest)
- {
- Fail("ERROR: Expected wcsncat to return ptr to %p, got %p", dest, ptr);
- }
-
- ptr = wcsncat(dest, str2, 3);
- if (ptr != dest)
- {
- Fail("ERROR: Expected wcsncat to return ptr to %p, got %p", dest, ptr);
- }
- if (dest[7] != 0)
- {
- Fail("ERROR: wcsncat did not place a terminating NULL!");
- }
-
- ptr = wcsncat(dest, str3, 20);
- if (ptr != dest)
- {
- Fail("ERROR: Expected wcsncat to return ptr to %p, got %p", dest, ptr);
- }
- if (wcscmp(dest, test) != 0)
- {
- Fail("ERROR: Expected wcsncat to give \"%S\", got \"%S\"\n",
- test, dest);
- }
- if (dest[wcslen(test)+1] != (WCHAR)'x')
- {
- Fail("wcsncat went out of bounds!\n");
- }
-
- PAL_Terminate();
-
- return PASS;
-}
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = wcsncat
-Name = Test #1 for wcsncat
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Tests that wcsncat correctly appends wide strings, making sure it handles
-= count argument correctly (appending no more than count characters, always
-= placing a null, and padding the string if necessary).
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-add_subdirectory(test2)
-add_subdirectory(test3)
-add_subdirectory(test4)
-add_subdirectory(test5)
-add_subdirectory(test6)
-
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test1.cpp
-)
-
-add_executable(paltest_wcstol_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_wcstol_test1 coreclrpal)
-
-target_link_libraries(paltest_wcstol_test1
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================================
-**
-** Source: test1.c
-**
-** Purpose: Test #1 for the wcstol function. Does a simple test with radix 4.
-**
-**
-**==========================================================================*/
-
-
-
-#include <palsuite.h>
-
-
-/*
- * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
- * this is not currently tested.
- */
-
-
-int __cdecl main(int argc, char *argv[])
-{
- WCHAR *end;
- WCHAR teststr[] = {'1','2','3','4','5',0};
- LONG result = 27;
- LONG l;
-
- if ( 0 != PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
-
- l = wcstol(teststr, &end, 4);
-
- if (l != result)
- {
- Fail("ERROR: Expected wcstol to return %d, got %d\n", result, l);
- }
-
- if (end != teststr + 3)
- {
- Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
- teststr + 3, end);
- }
-
- PAL_Terminate();
- return PASS;
-}
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = wcstol
-Name = Positive Test for wcstol
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Tests wcstol with base 4 and a string that includes some invalid characters.
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test2.cpp
-)
-
-add_executable(paltest_wcstol_test2
- ${SOURCES}
-)
-
-add_dependencies(paltest_wcstol_test2 coreclrpal)
-
-target_link_libraries(paltest_wcstol_test2
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================================
-**
-** Source: test2.c
-**
-** Purpose: Test #2 for the wcstol function. Does a simple test with radix
-** 10.
-**
-**
-**==========================================================================*/
-
-
-
-#include <palsuite.h>
-
-
-/*
- * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
- * this is not currently tested.
- */
-
-int __cdecl main(int argc, char *argv[])
-{
- WCHAR *end;
- WCHAR teststr[] = {'1','2','3','4','5',0};
- LONG result = 12345;
- LONG l;
-
- if (0 != PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
-
- l = wcstol(teststr, &end, 10);
-
- if (l != result)
- {
- Fail("ERROR: Expected wcstol to return %d, got %d\n", result, l);
- }
-
- if (end != teststr + 5)
- {
- Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
- teststr + 5, end);
- }
-
- PAL_Terminate();
- return PASS;
-}
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = wcstol
-Name = Positive Test for wcstol
-TYPE = DEFAULT
-EXE1 = test2
-Description
-= Tests wcstol with base 10 and a completely valid string.
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test3.cpp
-)
-
-add_executable(paltest_wcstol_test3
- ${SOURCES}
-)
-
-add_dependencies(paltest_wcstol_test3 coreclrpal)
-
-target_link_libraries(paltest_wcstol_test3
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================================
-**
-** Source: test3.c
-**
-** Purpose: Test #3 for the wcstol function. Tests an invalid string
-**
-**
-**==========================================================================*/
-
-
-
-#include <palsuite.h>
-
-
-/*
- * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
- * this is not currently tested.
- */
-
-
-int __cdecl main(int argc, char *argv[])
-{
- WCHAR str[] = {'Z',0};
- WCHAR *end;
- LONG l;
-
- if (0 != PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
-
- l = wcstol(str, &end, 10);
-
- if (l != 0)
- {
- Fail("ERROR: Expected wcstol to return %d, got %d\n", 0, l);
- }
-
- if (end != str)
- {
- Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
- str + 3, end);
- }
-
- PAL_Terminate();
- return PASS;
-}
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = wcstol
-Name = Positive Test for wcstol
-TYPE = DEFAULT
-EXE1 = test3
-Description
-= Tests wcstol with a completely invalid string (base 10).
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test4.cpp
-)
-
-add_executable(paltest_wcstol_test4
- ${SOURCES}
-)
-
-add_dependencies(paltest_wcstol_test4 coreclrpal)
-
-target_link_libraries(paltest_wcstol_test4
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================================
-**
-** Source: test4.c
-**
-** Purpose: Test #4 for the wcstol function. Tests the limits of the
-** conversions.
-**
-**
-**==========================================================================*/
-
-
-
-#include <palsuite.h>
-
-
-/*
- * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
- * this is not currently tested.
- */
-
-int __cdecl main(int argc, char *argv[])
-{
- WCHAR maxstr[] = {'2','1','4','7','4','8','3','6','4','7',0};
- LONG max = 2147483647;
- WCHAR minstr[] = {'-','2','1','4','7','4','8','3','6','4','8',0};
- LONG min = 0x80000000; /* putting -2147483648 gives a warning */
- WCHAR *end;
- LONG l;
-
- if ( 0 != PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
-
- errno = 0;
-
- l = wcstol(maxstr, &end, 10);
-
- if (l != max)
- {
- Fail("ERROR: Expected wcstol to return %d, got %d\n", max, l);
- }
- if (end != maxstr + 10)
- {
- Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
- maxstr + 10, end);
- }
- if (errno != 0)
- {
- Fail("ERROR: wcstol set errno to non-zero (%d)\n", errno);
- }
-
-
- l = wcstol(minstr, &end, 10);
-
- if (l != min)
- {
- Fail("ERROR: Expected wcstol to return %d, got %d\n", min, l);
- }
- if (end != minstr + 11)
- {
- Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
- minstr + 11, end);
- }
- if (errno != 0)
- {
- Fail("ERROR: wcstol set errno to non-zero (%d)\n", errno);
- }
-
- PAL_Terminate();
- return PASS;
-}
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = wcstol
-Name = Positive Test for wcstol
-TYPE = DEFAULT
-EXE1 = test4
-Description
-= Tests wcstol with base 10 and the highest and lowest possible values.
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test5.cpp
-)
-
-add_executable(paltest_wcstol_test5
- ${SOURCES}
-)
-
-add_dependencies(paltest_wcstol_test5 coreclrpal)
-
-target_link_libraries(paltest_wcstol_test5
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================================
-**
-** Source: test5.c
-**
-** Purpose: Test #5 for the wcstol function. Tests over and under flowing.
-**
-**
-**==========================================================================*/
-
-
-
-#include <palsuite.h>
-
-
-/*
- * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
- * this is not currently tested.
- */
-
-
-int __cdecl main(int argc, char *argv[])
-{
- WCHAR overstr[] = {'2','1','4','7','4','8','3','6','4','8',0};
- WCHAR understr[] = {'-','2','1','4','7','4','8','3','6','4','9',0};
- WCHAR *end;
- LONG l;
-
- if (0 != PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
-
- errno = 0;
-
- l = wcstol(overstr, &end, 10);
-
- if (l != LONG_MAX)
- {
- Fail("ERROR: Expected wcstol to return %u, got %u\n", LONG_MAX, l);
- }
- if (end != overstr + 10)
- {
- Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
- overstr + 10, end);
- }
- if (errno != ERANGE)
- {
- Fail("ERROR: wcstol did not set errno to ERANGE (%d)\n", errno);
- }
-
-
- errno = 0;
- l = wcstol(understr, &end, 10);
-
- if (l != LONG_MIN)
- {
- Fail("ERROR: Expected wcstol to return %u, got %u\n", LONG_MIN, l);
- }
- if (end != understr + 11)
- {
- Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
- understr + 11, end);
- }
- if (errno != ERANGE)
- {
- Fail("ERROR: wcstol did not set errno to ERANGE (%d)\n", errno);
- }
-
- PAL_Terminate();
- return PASS;
-}
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = wcstol
-Name = Positive Test for wcstol
-TYPE = DEFAULT
-EXE1 = test5
-Description
-= Tests wcstol (base 10) with underflowing and overflowing.
-= Chesks that errno gets set to ERANGE.
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test6.cpp
-)
-
-add_executable(paltest_wcstol_test6
- ${SOURCES}
-)
-
-add_dependencies(paltest_wcstol_test6 coreclrpal)
-
-target_link_libraries(paltest_wcstol_test6
- ${COMMON_TEST_LIBRARIES}
-)
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================================
-**
-** Source: test6.c
-**
-** Purpose: Test #6 for the wcstol function. Tests strings with octal/hex
-** number specifers
-**
-**
-**==========================================================================*/
-
-
-
-#include <palsuite.h>
-
-
-/*
- * Notes: wcstol should depend on the current locale's LC_NUMERIC category,
- * this is not currently tested.
- */
-
-
-int __cdecl main(int argc, char *argv[])
-{
- WCHAR test1[] = {'0','x','1','2', 0};
- WCHAR test2[] = {'0','1','2',0};
- WCHAR *end;
- LONG l;
-
- if (0 != PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
-
- l = wcstol(test1, &end, 16);
- if (l != 0x12)
- {
- Fail("ERROR: Expected wcstol to return %d, got %d\n", 0x12, l);
- }
- if (end != test1 + 4)
- {
- Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
- test1 + 4, end);
- }
-
- l = wcstol(test1, &end, 10);
- if (l != 0)
- {
- Fail("ERROR: Expected wcstol to return %d, got %d\n", 0, l);
- }
- if (end != test1+1)
- {
- Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
- test1+1, end);
- }
-
- l = wcstol(test2, &end, 8);
- if (l != 10)
- {
- Fail("ERROR: Expected wcstol to return %d, got %d\n", 10, l);
- }
- if (end != test2 + 3)
- {
- Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
- test2 + 3, end);
- }
-
- l = wcstol(test2, &end, 10);
- if (l != 12)
- {
- Fail("ERROR: Expected wcstol to return %d, got %d\n", 12, l);
- }
-
- if (end != test2 + 3)
- {
- Fail("ERROR: Expected wcstol to give an end value of %p, got %p\n",
- test2 + 3, end);
- }
-
- PAL_Terminate();
- return PASS;
-}
+++ /dev/null
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = wcstol
-Name = Positive Test for wcstol
-TYPE = DEFAULT
-EXE1 = test6
-Description
-= Tests wcstol with hex and octal strings, with different bases.
c_runtime/atanhf/test1/paltest_atanhf_test1
c_runtime/atof/test1/paltest_atof_test1
c_runtime/atoi/test1/paltest_atoi_test1
-c_runtime/atol/test1/paltest_atol_test1
c_runtime/bsearch/test1/paltest_bsearch_test1
c_runtime/bsearch/test2/paltest_bsearch_test2
c_runtime/cbrt/test1/paltest_cbrt_test1
c_runtime/fwprintf/test8/paltest_fwprintf_test8
c_runtime/fwprintf/test9/paltest_fwprintf_test9
c_runtime/fwrite/test1/paltest_fwrite_test1
-c_runtime/getc/test1/paltest_getc_test1
c_runtime/getenv/test1/paltest_getenv_test1
c_runtime/getenv/test2/paltest_getenv_test2
c_runtime/getenv/test3/paltest_getenv_test3
c_runtime/iswupper/test1/paltest_iswupper_test1
c_runtime/iswxdigit/test1/paltest_iswxdigit_test1
c_runtime/isxdigit/test1/paltest_isxdigit_test1
-c_runtime/labs/test1/paltest_labs_test1
c_runtime/llabs/test1/paltest_llabs_test1
c_runtime/log/test1/paltest_log_test1
c_runtime/log2/test1/paltest_log2_test1
c_runtime/toupper/test1/paltest_toupper_test1
c_runtime/towlower/test1/paltest_towlower_test1
c_runtime/towupper/test1/paltest_towupper_test1
-c_runtime/ungetc/test1/paltest_ungetc_test1
c_runtime/vfprintf/test1/paltest_vfprintf_test1
c_runtime/vfprintf/test10/paltest_vfprintf_test10
c_runtime/vfprintf/test11/paltest_vfprintf_test11
c_runtime/wcscmp/test1/paltest_wcscmp_test1
c_runtime/wcscpy/test1/paltest_wcscpy_test1
c_runtime/wcslen/test1/paltest_wcslen_test1
-c_runtime/wcsncat/test1/paltest_wcsncat_test1
c_runtime/wcsncmp/test1/paltest_wcsncmp_test1
c_runtime/wcsncpy/test1/paltest_wcsncpy_test1
c_runtime/wcspbrk/test1/paltest_wcspbrk_test1
c_runtime/wcstod/test1/paltest_wcstod_test1
c_runtime/wcstod/test2/paltest_wcstod_test2
c_runtime/wcstok/test1/paltest_wcstok_test1
-c_runtime/wcstol/test1/paltest_wcstol_test1
-c_runtime/wcstol/test2/paltest_wcstol_test2
-c_runtime/wcstol/test3/paltest_wcstol_test3
-c_runtime/wcstol/test4/paltest_wcstol_test4
-c_runtime/wcstol/test5/paltest_wcstol_test5
-c_runtime/wcstol/test6/paltest_wcstol_test6
c_runtime/wcstoul/test1/paltest_wcstoul_test1
c_runtime/wcstoul/test2/paltest_wcstoul_test2
c_runtime/wcstoul/test3/paltest_wcstoul_test3
c_runtime/_snwprintf_s/test8/paltest_snwprintf_test8
c_runtime/_snwprintf_s/test9/paltest_snwprintf_test9
c_runtime/_stricmp/test1/paltest_stricmp_test1
-c_runtime/_strlwr/test1/paltest_strlwr_test1
c_runtime/_strnicmp/test1/paltest_strnicmp_test1
c_runtime/_vsnprintf_s/test1/paltest_vsnprintf_test1
c_runtime/_vsnprintf_s/test10/paltest_vsnprintf_test10
They should either be fixed or deleted if they are no longer applicable.
c_runtime/exit/test2/paltest_exit_test2
-c_runtime/feof/test1/paltest_feof_test1
c_runtime/ferror/test1/paltest_ferror_test1
c_runtime/ferror/test2/paltest_ferror_test2
c_runtime/fputs/test2/paltest_fputs_test2
c_runtime/iswprint/test1/paltest_iswprint_test1
c_runtime/swprintf/test2/paltest_swprintf_test2
c_runtime/swprintf/test7/paltest_swprintf_test7
-c_runtime/ungetc/test2/paltest_ungetc_test2
c_runtime/vprintf/test1/paltest_vprintf_test1
c_runtime/vswprintf/test2/paltest_vswprintf_test2
c_runtime/vswprintf/test7/paltest_vswprintf_test7
Actual += (Time2 - Time1) * 100;
}
- if(labs(Expected - Actual) > Delta)
+ if(llabs(Expected - Actual) > Delta)
{
Fail("ERROR: The measured time (%llu millisecs) was not within Delta %llu "
"of the expected time (%llu millisecs).\n",
- if(labs(Expected - Actual) > Delta)
+ if(llabs(Expected - Actual) > Delta)
{
Fail("ERROR: The measured time (%llu millisecs) was not within Delta %llu "
"of the expected time (%llu millisecs).\n",
MaxNumHelperProcess = MAX_HELPER_PROCESS;
break;
case 2:
- MaxNumHelperProcess = atol(argv[1]);
+ MaxNumHelperProcess = atoi(argv[1]);
break;
default:
Fail("Invalid number of arguments\n");
}
-// Function to parse apart a command line and return the
-// arguments just like argv and argc
-// This function is a little funky because of the pointer work
-// but it is neat because it allows the recipient of the char**
-// to only have to do a single delete []
-LPWSTR* CommandLineToArgvW(__in LPWSTR lpCmdLine, DWORD *pNumArgs)
-{
-
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- INJECT_FAULT(return NULL;);
- }
- CONTRACTL_END
-
- DWORD argcount = 0;
- LPWSTR retval = NULL;
- LPWSTR *pslot;
- // First we need to find out how many strings there are in the command line
- _ASSERTE(lpCmdLine);
- _ASSERTE(pNumArgs);
-
- LPWSTR pdst = NULL;
- argcount = ParseCommandLine(lpCmdLine, &pdst);
-
- // This check is because on WinCE the Application Name is not passed in as an argument to the app!
- if (argcount == 0)
- {
- *pNumArgs = 0;
- return NULL;
- }
-
- // Now we need alloc a buffer the size of the command line + the number of strings * DWORD
- retval = new (nothrow) WCHAR[(argcount*sizeof(WCHAR*))/sizeof(WCHAR) + (pdst - (LPWSTR)NULL)];
- if(!retval)
- return NULL;
-
- pdst = (LPWSTR)( argcount*sizeof(LPWSTR*) + (BYTE*)retval );
- ParseCommandLine(lpCmdLine, &pdst);
- pdst = (LPWSTR)( argcount*sizeof(LPWSTR*) + (BYTE*)retval );
- pslot = (LPWSTR*)retval;
- for (DWORD i = 0; i < argcount; i++)
- {
- *(pslot++) = pdst;
- while (*pdst != W('\0'))
- {
- pdst++;
- }
- pdst++;
- }
-
-
-
- *pNumArgs = argcount;
- return (LPWSTR*)retval;
-
-}
-
-
-
-
//************************************************************************
// CQuickHeap
//