This change removes some unused PAL functions and the corresponding PAL tests.
#ifndef _TARGET_WIN64_
#define itoa_s_ptr _itoa_s
#define itow_s_ptr _itow_s
-#define itoa_ptr _itoa
-#define itow_ptr _itow
#else
#define itoa_s_ptr _i64toa_s
#define itow_s_ptr _i64tow_s
-#define itoa_ptr _i64toa
-#define itow_ptr _i64tow
#endif
#ifdef FEATURE_PAL
// define the return value for success
#define SAFECRT_SUCCESS 0
-/*
- * Sizes for buffers used by the _makepath() and _splitpath() functions.
- * note that the sizes include space for 0-terminator
- */
-//#define _MAX_PATH 260 /* max. length of full pathname */
-//#define _MAX_DRIVE 3 /* max. length of drive component */
-//#define _MAX_DIR 256 /* max. length of path component */
-//#define _MAX_FNAME 256 /* max. length of file name component */
-//#define _MAX_EXT 256 /* max. length of extension component */
-
#ifdef __cplusplus
extern "C" {
#endif
PALIMPORT char * __cdecl _gcvt_s(char *, int, double, int);
PALIMPORT char * __cdecl _ecvt(double, int, int *, int *);
PALIMPORT int __cdecl __iscsym(int);
-PALIMPORT size_t __cdecl _mbslen(const unsigned char *);
PALIMPORT unsigned char * __cdecl _mbsinc(const unsigned char *);
PALIMPORT unsigned char * __cdecl _mbsninc(const unsigned char *, size_t);
PALIMPORT unsigned char * __cdecl _mbsdec(const unsigned char *, const unsigned char *);
PALIMPORT WCHAR * __cdecl _wcslwr(WCHAR *);
PALIMPORT ULONGLONG _wcstoui64(const WCHAR *, WCHAR **, int);
PALIMPORT WCHAR * __cdecl _i64tow(__int64, WCHAR *, int);
-PALIMPORT WCHAR * __cdecl _ui64tow(unsigned __int64, WCHAR *, int);
PALIMPORT int __cdecl _wtoi(const WCHAR *);
#ifdef __cplusplus
PALIMPORT void * __cdecl bsearch(const void *, const void *, size_t, size_t,
int (__cdecl *)(const void *, const void *));
-PALIMPORT void __cdecl _splitpath(const char *, char *, char *, char *, char *);
-PALIMPORT void __cdecl _wsplitpath(const WCHAR *, WCHAR *, WCHAR *, WCHAR *, WCHAR *);
-PALIMPORT void __cdecl _makepath(char *, const char *, const char *, const char *, const char *);
-PALIMPORT void __cdecl _wmakepath(WCHAR *, const WCHAR *, const WCHAR *, const WCHAR *, const WCHAR *);
PALIMPORT char * __cdecl _fullpath(char *, const char *, size_t);
-PALIMPORT void __cdecl _swab(char *, char *, int);
-
#ifndef PAL_STDCPP_COMPAT
PALIMPORT time_t __cdecl time(time_t *);
return 0;
}
-#endif
-
-/* getenv_s */
-/*
- * _ReturnValue indicates if the variable has been found and size needed
- */
-_SAFECRT__EXTERN_C
-errno_t __cdecl getenv_s(size_t *_ReturnValue, char *_Dst, size_t _SizeInWords, const char *_Name);
-
-#if defined(__cplusplus) && _SAFECRT_USE_CPP_OVERLOADS
-extern "C++"
-template <size_t _SizeInWords>
-inline
-errno_t __cdecl getenv_s(size_t *_ReturnValue, char *_Dst, size_t _SizeInWords, const char *_Name)
-{
- return getenv_s(_ReturnValue, _Dst, _SizeInWords, _Name);
-}
-#endif
-
-#if _SAFECRT_USE_INLINES
-
-__inline
-errno_t __cdecl getenv_s(size_t *_ReturnValue, char *_Dst, size_t _SizeInWords, const char *_Name)
-{
- char *szFound;
-
- /* validation section */
- _SAFECRT__VALIDATE_STRING(_Dst, _SizeInWords);
-
- szFound = getenv(_Name);
- if (szFound == nullptr)
- {
- *_ReturnValue = 0;
- return 0;
- }
- *_ReturnValue = strlen(szFound) + 1;
- return strcpy_s(_Dst, _SizeInWords, szFound);
-}
-
#endif
}
SET_DEFAULT_DEBUG_CHANNEL(CRT);
-/*++
-Function:
- _mbslen
-
-Determines the number of characters (code points) in a multibyte
-character string.
-
-Parameters
-
-string Points to a multibyte character string.
-
-Return Values
-
-The mbslen subroutine returns the number of multibyte characters in a
-multibyte character string. It returns 0 if the string parameter
-points to a null character or if a character cannot be formed from the
-string pointed to by this parameter.
-
---*/
-size_t
-__cdecl
-_mbslen(
- const unsigned char *string)
-{
- size_t ret = 0;
- CPINFO cpinfo;
- PERF_ENTRY(_mbslen);
- ENTRY("_mbslen (string=%p (%s))\n", string, string);
-
- if (string)
- {
- if (GetCPInfo(CP_ACP, &cpinfo) && cpinfo.MaxCharSize == 1)
- {
- ret = strlen((const char*)string);
- }
- else
- {
- while (*string)
- {
- if (IsDBCSLeadByteEx(CP_ACP, *string))
- {
- ++string;
- }
- ++string;
- ++ret;
- }
- }
- }
-
- LOGEXIT("_mbslen returning size_t %u\n", ret);
- PERF_EXIT(_mbslen);
- return ret;
-}
-
/*++
Function:
_mbsinc
SET_DEFAULT_DEBUG_CHANNEL(CRT);
-
-/* ON_ERROR. A Helper macro for _?splitpath functions. */
-#define ON_ERROR if ( drive ) \
- {\
- drive[0] = 0;\
- }\
- if(dir)\
- {\
- dir[0] = 0;\
- }\
- if(fname)\
- {\
- fname[0] = 0;\
- }\
- if(ext)\
- {\
- ext[0] = 0;\
- }\
- goto done;\
-
-/*++
-Function:
- _wsplitpath
-
-See MSDN doc.
-
-Notes :
- This implementation ignores drive letters as they should not be
- present. If the drive argument is non-NULL, it always returns an empty
- string.
- File names in which the only period is at the beginning (like .bashrc, but
- not .bashrc.bak), the file is treated as having no extension
- (fname is ".bashrc", ext is "")
-
---*/
-void
-__cdecl
-_wsplitpath(
- const wchar_16 *dospath,
- wchar_16 *drive,
- wchar_16 *dir,
- wchar_16 *fname,
- wchar_16 *ext)
-{
- WCHAR path[_MAX_PATH+1];
- LPCWSTR slash_ptr = NULL;
- LPCWSTR period_ptr = NULL;
- INT size = 0;
-
- PERF_ENTRY(_wsplitpath);
- ENTRY("_wsplitpath (path=%p (%S), drive=%p, dir=%p, fname=%p, ext=%p)\n",
- dospath?dospath:W16_NULLSTRING,
- dospath?dospath:W16_NULLSTRING, drive, dir, fname, ext);
-
- /* Do performance intensive error checking only in debug builds.
-
- NOTE: This function must fail predictably across all platforms.
- Under Windows this function throw an access violation if NULL
- was passed in as the value for path.
-
- */
-#if _DEBUG
- if ( !dospath )
- {
- ERROR( "path cannot be NULL!\n" );
- }
-#endif
-
- if( lstrlenW( dospath ) >= _MAX_PATH )
- {
- ERROR("Path length is > _MAX_PATH (%d)!\n", _MAX_PATH);
- ON_ERROR;
- }
-
-
- PAL_wcscpy(path, dospath);
- FILEDosToUnixPathW(path);
-
- /* no drive letters in the PAL */
- if( drive != NULL )
- {
- drive[0] = 0;
- }
-
- /* find last path separator char */
- slash_ptr = PAL_wcsrchr(path, '/');
-
- if( slash_ptr == NULL )
- {
- TRACE("No path separator in path\n");
- slash_ptr = path - 1;
- }
- /* find extension separator, if any */
- period_ptr = PAL_wcsrchr(path, '.');
-
- /* make sure we only consider periods after the last path separator */
- if( period_ptr < slash_ptr )
- {
- period_ptr = NULL;
- }
-
- /* if the only period in the file is a leading period (denoting a hidden
- file), don't treat what follows as an extension */
- if( period_ptr == slash_ptr+1 )
- {
- period_ptr = NULL;
- }
-
- if( period_ptr == NULL )
- {
- TRACE("No extension in path\n");
- period_ptr = path + lstrlenW(path);
- }
-
- size = slash_ptr - path + 1;
- if( dir != NULL )
- {
- INT i;
-
- if( (size + 1 ) > _MAX_DIR )
- {
- ERROR("Directory component needs %d characters, _MAX_DIR is %d\n",
- size+1, _MAX_DIR);
- ON_ERROR;
- }
-
- memcpy(dir, path, size*sizeof(WCHAR));
- dir[size] = 0;
-
- /* only allow / separators in returned path */
- i = 0;
- while( dir[ i ] )
- {
- if( dir[ i ] == '\\' )
- {
- dir[i]='/';
- }
- i++;
- }
- }
-
- size = period_ptr-slash_ptr-1;
- if( fname != NULL )
- {
- if( (size+1) > _MAX_FNAME )
- {
- ERROR("Filename component needs %d characters, _MAX_FNAME is %d\n",
- size+1, _MAX_FNAME);
- ON_ERROR;
- }
- memcpy(fname, slash_ptr+1, size*sizeof(WCHAR));
- fname[size] = 0;
- }
-
- size = 1 + lstrlenW( period_ptr );
- if( ext != NULL )
- {
- if( size > _MAX_EXT )
- {
- ERROR("Extension component needs %d characters, _MAX_EXT is %d\n",
- size, _MAX_EXT);
- ON_ERROR;
- }
- memcpy(ext, period_ptr, size*sizeof(WCHAR));
- ext[size-1] = 0;
- }
-
- TRACE("Path components are '%S' '%S' '%S'\n", dir, fname, ext);
-
-done:
-
- LOGEXIT("_wsplitpath returns.\n");
- PERF_EXIT(_wsplitpath);
-}
-
-
-/*++
-Function:
- _splitpath
-
-See description above for _wsplitpath.
-
---*/
-void
-__cdecl
-_splitpath(
- const char *path,
- char *drive,
- char *dir,
- char *fname,
- char *ext)
-{
- WCHAR w_path[_MAX_PATH];
- WCHAR w_dir[_MAX_DIR];
- WCHAR w_fname[_MAX_FNAME];
- WCHAR w_ext[_MAX_EXT];
-
- PERF_ENTRY(_splitpath);
- ENTRY("_splitpath (path=%p (%s), drive=%p, dir=%p, fname=%p, ext=%p)\n",
- path?path:"NULL",
- path?path:"NULL", drive, dir, fname, ext);
-
- /* Do performance intensive error checking only in debug builds.
-
- NOTE: This function must fail predictably across all platforms.
- Under Windows this function throw an access violation if NULL
- was passed in as the value for path.
-
- */
-#if _DEBUG
- if ( !path )
- {
- ERROR( "path cannot be NULL!\n" );
- }
-
- if( strlen( path ) >= _MAX_PATH )
- {
- ERROR( "Path length is > _MAX_PATH (%d)!\n", _MAX_PATH);
- }
-#endif
-
- /* no drive letters in the PAL */
- if(drive)
- {
- drive[0] = '\0';
- }
-
- if(0 == MultiByteToWideChar(CP_ACP, 0, path, -1, w_path, _MAX_PATH))
- {
- ASSERT("MultiByteToWideChar failed!\n");
- ON_ERROR;
- }
-
- /* Call up to Unicode version; pass NULL for parameters the caller doesn't
- care about */
- _wsplitpath(w_path, NULL, dir?w_dir:NULL,
- fname?w_fname:NULL, ext?w_ext:NULL);
-
- /* Convert result back to MultiByte; report conversion errors but don't
- stop because of them */
-
- if(dir)
- {
- if(0 == WideCharToMultiByte(CP_ACP, 0, w_dir, -1, dir, _MAX_DIR,
- NULL, NULL))
- {
- ASSERT("WideCharToMultiByte failed!\n");
- ON_ERROR;
- }
- }
- if(fname)
- {
- if(0 == WideCharToMultiByte(CP_ACP, 0, w_fname, -1, fname, _MAX_FNAME,
- NULL, NULL))
- {
- ASSERT("WideCharToMultiByte failed!\n");
- ON_ERROR;
- }
- }
- if(ext)
- {
- if(0 == WideCharToMultiByte(CP_ACP, 0, w_ext, -1, ext, _MAX_EXT,
- NULL, NULL))
- {
- ASSERT("WideCharToMultiByte failed!\n");
- ON_ERROR;
- }
- }
-
-done:
- LOGEXIT("_splitpath returns.\n");
- PERF_EXIT(_splitpath);
-}
-
-
-
-/*++
-Function:
- _makepath
-
-See MSDN doc.
-
---*/
-void
-__cdecl
-_makepath(
- char *path,
- const char *drive,
- const char *dir,
- const char *fname,
- const char *ext)
-{
- UINT Length = 0;
-
- PERF_ENTRY(_makepath);
- ENTRY( "_makepath (path=%p, drive=%p (%s), dir=%p (%s), fname=%p (%s), ext=%p (%s))\n",
- path, drive ? drive:"NULL", drive ? drive:"NULL", dir ? dir:"NULL", dir ? dir:"NULL", fname ? fname:"NULL", fname ? fname:"NULL",
- ext ? ext:"NULL",
- ext ? ext:"NULL");
-
- path[ 0 ] = '\0';
-
- /* According to the pal documentation, host operating systems that
- don't support drive letters, the "drive" parameter must always be null. */
- if ( drive != NULL && drive[0] != '\0' )
- {
- ASSERT( "The drive parameter must always be NULL on systems that don't"
- "support drive letters. drive is being ignored!.\n" );
- }
-
- if ( dir != NULL && dir[ 0 ] != '\0' )
- {
- UINT DirLength = strlen( dir );
- Length += DirLength ;
-
- if ( Length < _MAX_PATH )
- {
- strncat( path, dir, DirLength );
- if ( dir[ DirLength - 1 ] != '/' && dir[ DirLength - 1 ] != '\\' )
- {
- if ( Length + 1 < _MAX_PATH )
- {
- path[ Length ] = '/';
- Length++;
- path[ Length ] = '\0';
- }
- else
- {
- goto Max_Path_Error;
- }
- }
- }
- else
- {
- goto Max_Path_Error;
- }
- }
-
- if ( fname != NULL && fname[ 0 ] != '\0' )
- {
- UINT fNameLength = strlen( fname );
- Length += fNameLength;
-
- if ( Length < _MAX_PATH )
- {
- strncat( path, fname, fNameLength );
- }
- else
- {
- goto Max_Path_Error;
- }
- }
-
- if ( ext != NULL && ext[ 0 ] != '\0' )
- {
- UINT ExtLength = strlen( ext );
- Length += ExtLength;
-
- if ( ext[ 0 ] != '.' )
- {
- /* Add a '.' */
- if ( Length + 1 < _MAX_PATH )
- {
- path[ Length - ExtLength ] = '.';
- Length++;
- path[ Length - ExtLength ] = '\0';
- strncat( path, ext, ExtLength );
- }
- else
- {
- goto Max_Path_Error;
- }
- }
- else
- {
- /* Already has a '.' */
- if ( Length < _MAX_PATH )
- {
- strncat( path, ext, ExtLength );
- }
- else
- {
- goto Max_Path_Error;
- }
- }
- }
-
- FILEDosToUnixPathA( path );
- LOGEXIT( "_makepath returning void.\n" );
- PERF_EXIT(_makepath);
- return;
-
-Max_Path_Error:
-
- ERROR( "path cannot be greater then _MAX_PATH\n" );
- path[ 0 ] = '\0';
- LOGEXIT( "_makepath returning void \n" );
- PERF_EXIT(_makepath);
- return;
-}
-
-/*++
-Function:
- _wmakepath
-
-See MSDN doc.
-
---*/
-void
-__cdecl
-_wmakepath(
- wchar_16 *path,
- const wchar_16 *drive,
- const wchar_16 *dir,
- const wchar_16 *fname,
- const wchar_16 *ext)
-{
- CHAR Dir[ _MAX_DIR ]={0};
- CHAR FileName[ _MAX_FNAME ]={0};
- CHAR Ext[ _MAX_EXT ]={0};
- CHAR Path[ _MAX_PATH ]={0};
-
- PERF_ENTRY(_wmakepath);
- ENTRY("_wmakepath (path=%p, drive=%p (%S), dir=%p (%S), fname=%p (%S), ext=%p (%S))\n",
- path, drive ? drive:W16_NULLSTRING, drive ? drive:W16_NULLSTRING, dir ? dir:W16_NULLSTRING, dir ? dir:W16_NULLSTRING,
- fname ? fname:W16_NULLSTRING,
- fname ? fname:W16_NULLSTRING, ext ? ext:W16_NULLSTRING, ext ? ext:W16_NULLSTRING);
-
- /* According to the pal documentation, host operating systems that
- don't support drive letters, the "drive" parameter must always be null. */
- if ( drive != NULL && drive[0] != '\0' )
- {
- ASSERT( "The drive parameter must always be NULL on systems that don't"
- "support drive letters. drive is being ignored!.\n" );
- }
-
- if ((dir != NULL) && WideCharToMultiByte( CP_ACP, 0, dir, -1, Dir,
- _MAX_DIR, NULL, NULL ) == 0 )
- {
- ASSERT( "An error occurred while converting dir to multibyte."
- "Possible error: Length of dir is greater than _MAX_DIR.\n" );
- goto error;
- }
-
- if ((fname != NULL) && WideCharToMultiByte( CP_ACP, 0, fname, -1, FileName,
- _MAX_FNAME, NULL, NULL ) == 0 )
- {
- ASSERT( "An error occurred while converting fname to multibyte."
- "Possible error: Length of fname is greater than _MAX_FNAME.\n" );
- goto error;
- }
-
- if ((ext != NULL) && WideCharToMultiByte( CP_ACP, 0, ext, -1, Ext,
- _MAX_EXT, NULL, NULL ) == 0 )
- {
- ASSERT( "An error occurred while converting ext to multibyte."
- "Possible error: Length of ext is greater than _MAX_EXT.\n" );
- goto error;
- }
-
- /* Call up to the ANSI _makepath. */
- _makepath_s( Path, sizeof(Path), NULL, Dir, FileName, Ext );
-
- if ( MultiByteToWideChar( CP_ACP, 0, Path, -1, path, _MAX_PATH ) == 0 )
- {
- ASSERT( "An error occurred while converting the back wide char."
- "Possible error: The length of combined path is greater "
- "than _MAX_PATH.\n" );
- goto error;
- }
-
- LOGEXIT("_wmakepath returns void\n");
- PERF_EXIT(_wmakepath);
- return;
-
-error:
- *path = '\0';
- LOGEXIT("_wmakepath returns void\n");
- PERF_EXIT(_wmakepath);
-}
-
-
/*++
Function:
_fullpath
return orig;
}
-
-/*++
-Function:
- _swab
-
-Swaps bytes.
-
-Return Value
-
-None
-
-Parameters
-
-src Data to be copied and swapped
-dest Storage location for swapped data
-n Number of bytes to be copied and swapped
-
-Remarks
-
-The _swab function copies n bytes from src, swaps each pair of
-adjacent bytes, and stores the result at dest. The integer n should be
-an even number to allow for swapping. _swab is typically used to
-prepare binary data for transfer to a machine that uses a different
-byte order.
-
-Example
-
-char from[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-char to[] = "..........................";
-
-printf("Before:\n%s\n%s\n\n", from, to);
-_swab(from, to, strlen(from));
-printf("After:\n%s\n%s\n\n", from, to);
-
-Before:
-ABCDEFGHIJKLMNOPQRSTUVWXYZ
-..........................
-
-After:
-ABCDEFGHIJKLMNOPQRSTUVWXYZ
-BADCFEHGJILKNMPORQTSVUXWZY
-
---*/
-void
-__cdecl
-_swab(char *src, char *dest, int n)
-{
- PERF_ENTRY(_swab);
- ENTRY("_swab (src=%p (%s), dest=%p (%s), n=%d)\n", src?src:"NULL", src?src:"NULL", dest?dest:"NULL", dest?dest:"NULL", n);
- swab(src, dest, n);
- LOGEXIT("_swab returning\n");
- PERF_EXIT(_swab);
-}
-
-
/*++
Function:
PAL_strtoul
return RetVal;
}
-/*++
-Function :
-
- _ui64tow
-
-See MSDN for more details.
---*/
-wchar_16 *
-__cdecl
-_ui64tow( unsigned __int64 value , wchar_16 * string , int radix )
-{
- UINT ReversedIndex = 0;
- WCHAR ReversedString[ 65 ];
- LPWSTR lpString = string;
- UINT Index = 0;
-
- PERF_ENTRY(_ui64tow);
- ENTRY( "_ui64tow( value=%I64d, string=%p (%S), radix=%d )\n",
- value, string, string, radix );
-
- if ( !string )
- {
- ERROR( "string has to be a valid pointer.\n" );
- LOGEXIT( "_ui64tow returning NULL.\n" );
- PERF_EXIT(_ui64tow);
- return NULL;
- }
- if ( radix < 2 || radix > 36 )
- {
- ERROR( "radix has to be between 2 and 36.\n" );
- LOGEXIT( "_ui64tow returning NULL.\n" );
- PERF_EXIT(_ui64tow);
- return NULL;
- }
-
- if(0 == value)
- {
- ReversedString[0] = '0';
- Index++;
- }
- else while ( value )
- {
- int temp = value % radix;
- value /= radix;
-
- if ( temp < 10 )
- {
- ReversedString[ Index ] = temp + '0';
- Index++;
- }
- else
- {
- ReversedString[ Index ] = temp - 10 + 'a';
- Index++;
- }
- }
-
- /* Reverse the string. */
- ReversedIndex = Index;
- for ( Index = 0; ReversedIndex > 0; ReversedIndex--, Index++ )
- {
- string[ Index ] = ReversedString[ ReversedIndex - 1 ];
- }
-
- string[ Index ] = '\0';
- LOGEXIT( "_ui64tow returning %p (%S).\n", lpString , lpString );
- PERF_EXIT(_ui64tow);
- return lpString;
-}
-
-
/*++
Function:
// Split the path into a dir and filename.
if (_splitpath_s(path, NULL, 0, find_data->dir, _MAX_DIR, find_data->fname, _MAX_PATH, ext, _MAX_EXT) != 0)
{
- ASSERT("_splitpath failed on %s\n", path);
+ ASSERT("_splitpath_s failed on %s\n", path);
dwLastError = ERROR_INTERNAL_ERROR;
goto done;
}
to prevent glob from using them as wildcards.
note: this functions assumes all backslashes have previously been
- converted into forwardslashes by _splitpath.
+ converted into forwardslashes by _splitpath_s.
--*/
static void FILEEscapeSquareBrackets(char *pattern, char *escaped_pattern)
{
FILEGlobFromSplitPath
Simple wrapper function around glob(3), except that the pattern is accepted
-in broken-down form like _splitpath produces.
+in broken-down form like _splitpath_s produces.
ie. calling splitpath on a pattern then calling this function should
produce the same result as just calling glob() on the pattern.
_splitpath_s( pattern, NULL, 0, Dir, _MAX_DIR, Filename, _MAX_FNAME+1, Ext, _MAX_EXT);
- /* check to see if _splitpath failed */
+ /* check to see if _splitpath_s failed */
if ( Filename[0] == 0 )
{
if ( Dir[0] == 0 )
{
- ERROR("_splitpath failed on path [%s]\n", pattern);
+ ERROR("_splitpath_s failed on path [%s]\n", pattern);
}
else
{
#define _ultox _ultow
#define x64tox x64tow
#define _i64tox _i64tow
-#define _ui64tox _ui64tow
#else /* _UNICODE */
#define xtox_s xtoa_s
#define _itox_s _itoa_s
#define _ultox _ultoa
#define x64tox x64toa
#define _i64tox _i64toa
-#define _ui64tox _ui64toa
#endif /* _UNICODE */
/***
add_subdirectory(_isnan)
add_subdirectory(_isnanf)
add_subdirectory(_itow)
-add_subdirectory(_makepath)
add_subdirectory(_mbsdec)
add_subdirectory(_mbsinc)
-add_subdirectory(_mbslen)
add_subdirectory(_mbsninc)
add_subdirectory(_open_osfhandle)
add_subdirectory(_putenv)
add_subdirectory(_rotr)
add_subdirectory(_snprintf)
add_subdirectory(_snwprintf)
-add_subdirectory(_splitpath)
add_subdirectory(_stricmp)
add_subdirectory(_strlwr)
add_subdirectory(_strnicmp)
-add_subdirectory(_swab)
add_subdirectory(_vsnprintf)
add_subdirectory(_vsnwprintf)
add_subdirectory(_wcsicmp)
add_subdirectory(_wcslwr)
add_subdirectory(_wcsnicmp)
add_subdirectory(_wfopen)
-add_subdirectory(_wmakepath)
-add_subdirectory(_wsplitpath)
add_subdirectory(_wtoi)
add_subdirectory(__iscsym)
+++ /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_makepath_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_makepath_test1 coreclrpal)
-
-target_link_libraries(paltest_makepath_test1
- pthread
- m
- coreclrpal
-)
+++ /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 _makepath function.
-** Create a path, and ensure that it builds how it is
-** supposed to.
-**
-**
-**
-**===================================================================*/
-
-#if WIN32
-#define PATHNAME "C:\\test\\test.txt"
-#else
-#define PATHNAME "/test/test.txt"
-#endif
-
-#include <palsuite.h>
-
-int __cdecl main(int argc, char **argv)
-{
- char FullPath[128];
-
- /*
- * Initialize the PAL and return FAIL if this fails
- */
- if (0 != (PAL_Initialize(argc,argv)))
- {
- return FAIL;
- }
-
-#if WIN32
- _makepath(FullPath,"C","\\test","test","txt");
-#else
- _makepath(FullPath,NULL,"/test","test","txt");
-#endif
-
- if(strcmp(FullPath,PATHNAME) != 0)
- {
- Fail("ERROR: The pathname which was created turned out to be %s "
- "when it was supposed to be %s.\n",FullPath,PATHNAME);
- }
-
-
- 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 = _makepath
-Name = Positive Test for _makepath
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Purpose: Tests the PAL implementation of the _makepath function.
-= Create a path, and ensure that it builds how it is supposed to.
-
+++ /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_mbslen_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_mbslen_test1 coreclrpal)
-
-target_link_libraries(paltest_mbslen_test1
- pthread
- m
- coreclrpal
-)
+++ /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:
-** Check the length of a number of arrays. The first is a normal string
-** which should return its length. The second has two bytes and a null
-** character, which only returns a size of 2, and the last is just a NULL
-** array which should return 0.
-**
-**
-**========================================================================*/
-
-#include <palsuite.h>
-
-/*
- * Note: it seems like these functions would only be useful if they
- * didn't assume a character was equivalent to a single byte. Be that
- * as it may, I haven't seen a way to get it to behave otherwise
- * (eg locale)
- */
-
-int __cdecl main(int argc, char *argv[])
-{
- unsigned char *str1 = (unsigned char*) "foo";
- unsigned char str2[] = {0xC0, 0x80, 0}; /* the char U+0080 */
- unsigned char str3[] = {0};
- int ret=0;
-
- /*
- * Initialize the PAL and return FAIL if this fails
- */
- if (0 != (PAL_Initialize(argc, argv)))
- {
- return FAIL;
- }
-
- ret = _mbslen(str1);
- if (ret != 3)
- {
- Fail ("ERROR: _mbslen(\"%s\") returned %d. Expected %d\n",
- str1, ret, 3);
- }
-
- ret = _mbslen(str2);
- if (ret != 2)
- {
- Fail ("ERROR: _mbslen(\"%s\") returned %d. Expected %d\n",
- str2, ret, 2);
- }
-
- ret = _mbslen(str3);
- if (ret != 0)
- {
- Fail ("ERROR: _mbslen(\"%s\") returned %d. Expected %d\n",
- str3, ret, 0);
- }
-
- 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 = _mbsinc
-Name = Positive Test for _mbslen
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Check the length of a number of arrays. The first is a normal string
-= which should return its length. The second has two bytes and a null
-= character, which only returns a size of 2, and the last is just a NULL
-= array which should return 0.
+++ /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_splitpath_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_splitpath_test1 coreclrpal)
-
-target_link_libraries(paltest_splitpath_test1
- pthread
- m
- coreclrpal
-)
+++ /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: Passes _splitpath() a series of sample paths and checks that it
-** parses them as expected.
-**
-**
-**==========================================================================*/
-
-
-#include <palsuite.h>
-
-struct testCase
-{
- const char path[_MAX_PATH]; /* The path to parse. */
- const char drive[_MAX_DRIVE]; /* The expected values... */
- const char dir[_MAX_DIR];
- const char fname[_MAX_FNAME];
- const char ext[_MAX_EXT];
-};
-
-
-int __cdecl main(int argc, char **argv)
-{
- struct testCase testCases[] =
- {
-#if WIN32
- {"c:\\foo\\bar\\foo.bar", "c:", "\\foo\\bar\\", "foo", ".bar"},
- {"c:/foo/bar/foo.bar", "c:", "/foo/bar/", "foo", ".bar"},
- {"c:/foo/bar/foo", "c:", "/foo/bar/", "foo", ""},
- {"c:/foo/bar/.bar", "c:", "/foo/bar/", "", ".bar"},
- {"c:/foo/bar/", "c:", "/foo/bar/", "", ""},
- {"/foo/bar/foo.bar", "", "/foo/bar/", "foo", ".bar"},
- {"c:foo.bar", "c:", "", "foo", ".bar"}
-#else
- {"c:\\foo\\bar\\foo.bar", "","c:/foo/bar/", "foo", ".bar"},
- {"c:/foo/bar/foo.bar", "", "c:/foo/bar/", "foo", ".bar"},
- {"c:/foo/bar/foo", "", "c:/foo/bar/", "foo", ""},
- {"c:/foo/bar/.bar", "", "c:/foo/bar/", ".bar", ""},
- {"c:/foo/bar/", "", "c:/foo/bar/", "", ""},
- {"/foo/bar/foo.bar", "", "/foo/bar/", "foo", ".bar"},
- {"c:foo.bar", "", "", "c:foo", ".bar"}
-#endif
- };
- char drive[_MAX_DRIVE];
- char dir[_MAX_DIR];
- char fname[_MAX_FNAME];
- char ext[_MAX_EXT];
-
- int i=0;
-
- /*
- * Initialize the PAL and return FAIL if this fails
- */
- if (0 != (PAL_Initialize(argc, argv)))
- {
- return FAIL;
- }
-
- for (i = 0; i < sizeof(testCases)/sizeof(struct testCase); i++)
- {
- _splitpath(testCases[i].path, drive, dir, fname, ext);
-
-
- /*on platforms that don't support drive letters, the drive
- returned should always be "" */
- if (strcmp(drive, testCases[i].drive) != 0)
- {
- Fail("_splitpath read the path \"%s\" and thought the drive was "
- "\"%s\" instead of \"%s\"\n"
- , testCases[i].path, drive, testCases[i].drive);
- }
-
- if (strcmp(dir, testCases[i].dir) != 0)
- {
- Fail("_splitpath read the path \"%s\" and thought the directory "
- "was \"%s\" instead of \"%s\"\n"
- , testCases[i].path, dir, testCases[i].dir);
- }
-
- if (strcmp(fname, testCases[i].fname) != 0)
- {
- Fail("_splitpath read the path \"%s\" and thought the filename "
- "was \"%s\" instead of \"%s\"\n"
- , testCases[i].path, fname, testCases[i].fname);
- }
-
- if (strcmp(ext, testCases[i].ext) != 0)
- {
- Fail("_splitpath read the path \"%s\" and thought the file "
- "extension was \"%s\" instead of \"%s\"\n"
- , testCases[i].path, ext, testCases[i].ext);
- }
- }
- 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 = _splitpath
-Name = Positive Test for _splitpath
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Passes _splitpath() a series of sample paths and checks that it
-= parses them as 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_swab_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_swab_test1 coreclrpal)
-
-target_link_libraries(paltest_swab_test1
- pthread
- m
- coreclrpal
-)
+++ /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: Calls _swab on a buffer, and checks that it has correctly
-** swapped adjacent bytes
-**
-**
-**==========================================================================*/
-
-#include <palsuite.h>
-
-int __cdecl main(int argc, char **argv)
-{
- char before[] = "abcdefghijklmn";
- char after[] = "--------------";
- const char check[] = "badcfehgjilknm";
-
- /*
- * Initialize the PAL and return FAIL if this fails
- */
- if (0 != (PAL_Initialize(argc, argv)))
- {
- return FAIL;
- }
-
- _swab(before, after, sizeof(before));
- if (memcmp(after, check, sizeof(after)) != 0)
- {
- Fail ("_swab did not correctly swap adjacent bytes in a buffer.\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 = _swab
-Name = Positive Test for _swab
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Calls _swab on a buffer, and checks that it has correctly swapped
-= adjacent bytes
-
+++ /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_wmakepath_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_wmakepath_test1 coreclrpal)
-
-target_link_libraries(paltest_wmakepath_test1
- pthread
- m
- coreclrpal
-)
+++ /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 _wmakepath function.
-** Create a path, and ensure that it builds how it is
-** supposed to.
-**
-**
-**===================================================================*/
-
-#define UNICODE
-
-#include <palsuite.h>
-
-int __cdecl main(int argc, char **argv)
-{
- WCHAR FullPath[128];
- WCHAR File[] = {'t','e','s','t','\0'};
- WCHAR Ext[] = {'t','x','t','\0'};
- char * PrintResult=NULL; /* Used for printing out errors */
- char * PrintCorrect=NULL;
-
-#if WIN32
- WCHAR Drive[] = {'C','\0'};
- WCHAR Dir[] = {'\\','t','e','s','t','\0'};
- WCHAR PathName[] =
- {'C',':','\\','t','e','s','t','\\','t','e',
- 's','t','.','t','x','t','\0'};
-#else
- WCHAR *Drive = NULL;
- WCHAR Dir[] = {'/','t','e','s','t','\0'};
- WCHAR PathName[] =
- {'/','t','e','s','t','/','t','e','s','t','.','t','x','t','\0'};
-#endif
-
- /*
- * Initialize the PAL and return FAIL if this fails
- */
- if (0 != (PAL_Initialize(argc,argv)))
- {
- return FAIL;
- }
-
- _wmakepath(FullPath, Drive, Dir, File, Ext);
-
- if(wcscmp(FullPath,PathName) != 0)
- {
- PrintResult = convertC(FullPath);
- PrintCorrect = convertC(PathName);
-
- Fail("ERROR: The pathname which was created turned out to be %s "
- "when it was supposed to be %s.\n",PrintResult,PrintCorrect);
- }
-
-
- 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 = _wmakepath
-Name = Positive Test for _wmakepath
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Purpose: Tests the PAL implementation of the _wmakepath function.
-= Create a path, and ensure that it builds how it is supposed to.
+++ /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_wsplitpath_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_wsplitpath_test1 coreclrpal)
-
-target_link_libraries(paltest_wsplitpath_test1
- pthread
- m
- coreclrpal
-)
+++ /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: Passes _wsplitpath() a series of sample paths and checks
-** that it parses them as expected.
-**
-**
-**==========================================================================*/
-
-
-#include <palsuite.h>
-
-struct testCase
-{
- char path[_MAX_PATH]; /* The path to parse. */
- char drive[_MAX_DRIVE]; /* The expected values... */
- char dir[_MAX_DIR];
- char fname[_MAX_FNAME];
- char ext[_MAX_EXT];
-};
-
-struct wTestCase
-{
- WCHAR *path; /* The path to parse. */
- WCHAR *drive; /* The expected values... */
- WCHAR *dir;
- WCHAR *fname;
- WCHAR *ext;
-};
-
-
-
-int __cdecl main(int argc, char **argv)
-{
- struct testCase testCases[] =
- {
-#if WIN32
- {"c:\\foo\\bar\\foo.bar", "c:", "\\foo\\bar\\", "foo", ".bar"},
- {"c:/foo/bar/foo.bar", "c:", "/foo/bar/", "foo", ".bar"},
- {"c:/foo/bar/foo", "c:", "/foo/bar/", "foo", ""},
- {"c:/foo/bar/.bar", "c:", "/foo/bar/", "", ".bar"},
- {"c:/foo/bar/", "c:", "/foo/bar/", "", ""},
- {"/foo/bar/foo.bar", "", "/foo/bar/", "foo", ".bar"},
- {"c:foo.bar", "c:", "", "foo", ".bar"}
-#else
- {"c:\\foo\\bar\\foo.bar", "","c:/foo/bar/", "foo", ".bar"},
- {"c:/foo/bar/foo.bar", "", "c:/foo/bar/", "foo", ".bar"},
- {"c:/foo/bar/foo", "", "c:/foo/bar/", "foo", ""},
- {"c:/foo/bar/.bar", "", "c:/foo/bar/", ".bar", ""},
- {"c:/foo/bar/", "", "c:/foo/bar/", "", ""},
- {"/foo/bar/foo.bar", "", "/foo/bar/", "foo", ".bar"},
- {"c:foo.bar", "", "", "c:foo", ".bar"}
-#endif
- };
-
- struct wTestCase wTestCases[sizeof(testCases)/sizeof(struct testCase)];
-
- wchar_t wDrive[_MAX_DRIVE];
- wchar_t wDir[_MAX_DIR];
- wchar_t wFname[_MAX_FNAME];
- wchar_t wExt[_MAX_EXT];
-
- char *drive;
- char *dir;
- char *fname;
- char *ext;
-
- int i;
-
- if (PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
-
- /*create wide character versions of the test cases*/
- for(i = 0; i < sizeof(testCases)/sizeof(struct testCase); i ++)
- {
- wTestCases[i].path = convert(testCases[i].path);
- wTestCases[i].drive = convert(testCases[i].drive);
- wTestCases[i].dir = convert(testCases[i].dir);
- wTestCases[i].fname = convert(testCases[i].fname);
- wTestCases[i].ext = convert(testCases[i].ext);
- }
-
-
- for (i = 0; i < sizeof(wTestCases)/sizeof(struct wTestCase); i++)
- {
- _wsplitpath(wTestCases[i].path, wDrive, wDir, wFname, wExt);
-
- /*Convert the results to regular ANSI strings.*/
- drive = convertC(wDrive);
- dir = convertC(wDir);
- fname = convertC(wFname);
- ext = convertC(wExt);
-
-
- /*on platforms that don't support drive letters, the drive
- returned should always be "" */
- if (wcscmp(wDrive, wTestCases[i].drive) != 0)
- {
- Fail("_wsplitpath read the path \"%s\" and thought the drive was "
- "\"%s\" instead of \"%s\""
- , testCases[i].path, drive, testCases[i].drive);
- }
-
- if (wcscmp(wDir, wTestCases[i].dir) != 0)
- {
- Fail("_wsplitpath read the path \"%s\" and thought the directory "
- "was \"%s\" instead of \"%s\""
- , testCases[i].path, dir, testCases[i].dir);
- }
-
- if (wcscmp(wFname, wTestCases[i].fname) != 0)
- {
- Fail("_wsplitpath read the path \"%s\" and thought the filename "
- "was \"%s\" instead of \"%s\""
- , testCases[i].path, fname, testCases[i].fname);
- }
-
- if (wcscmp(wExt, wTestCases[i].ext) != 0)
- {
- Fail("_wsplitpath read the path \"%s\" and thought the file "
- "extension was \"%s\" instead of \"%s\""
- , testCases[i].path, ext, testCases[i].ext);
- }
-
- free(drive);
- free(dir);
- free(fname);
- free(ext);
- }
-
- for(i = 0; i < sizeof(testCases)/sizeof(struct testCase); i++)
- {
- free(wTestCases[i].path);
- free(wTestCases[i].drive);
- free(wTestCases[i].dir);
- free(wTestCases[i].fname);
- free(wTestCases[i].ext);
- }
-
- 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 = _wsplitpath
-Name = Positive Test for _wsplitpath
-TYPE = DEFAULT
-EXE1 = test1
-Description
-= Passes _wsplitpath() a series of sample paths and checks that it
-= parses them as expected.
-
-
*/
memset(fullPath, 0, _MAX_DIR);
- /* Get the full path to the library (DLL).
- */
-
- if ( NULL != _fullpath( fullPath, argv[0], _MAX_DIR )) {
- _splitpath(fullPath,drive,dir,fname,ext);
- _makepath(fullPath,drive,dir,"","");
- } else {
- Fail("ERROR: conversion from relative path \" %s \" to absolute path failed. _fullpath returned NULL\n",argv[0]);
+ if (GetTempPathA(_MAX_DIR, fullPath) == 0)
+ {
+ Fail("ERROR: GetTempPathA failed to get a path\n");
}
memset(fileloc, 0, _MAX_PATH);
*/
memset(fullPath, 0, _MAX_DIR);
- /* Get the full path to the library (DLL).
- */
-
- if ( NULL != _fullpath( fullPath, argv[0], _MAX_DIR )) {
- _splitpath(fullPath,drive,dir,fname,ext);
- _makepath(fullPath,drive,dir,"","");
- } else {
- Fail("ERROR: conversion from relative path \" %s \" to absolute path failed. _fullpath returned NULL\n",argv[0]);
- }
+ if (GetTempPathA(_MAX_DIR, fullPath) == 0)
+ {
+ Fail("ERROR: GetTempPathA failed to get a path\n");
+ }
memset(fileloc, 0, _MAX_PATH);
sprintf(fileloc, "%s%s", fullPath, szFileNameExistsWithExt);
add_subdirectory(wsprintfA)
add_subdirectory(wsprintfW)
add_subdirectory(_i64tow)
-add_subdirectory(_ui64tow)
+++ /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
- _ui64tow.cpp
-)
-
-add_executable(paltest_ui64tow_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_ui64tow_test1 coreclrpal)
-
-target_link_libraries(paltest_ui64tow_test1
- pthread
- m
- coreclrpal
-)
+++ /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: _ui64tow.c
-**
-** Purpose: Positive test the _ui64tow API.
-** convert an integer to a wide character string
-**
-**
-**============================================================*/
-#define UNICODE
-#include <palsuite.h>
-
-int __cdecl main(int argc, char *argv[])
-{
- int err;
- WCHAR *wpBuffer = NULL;
- char *pChar = NULL;
- unsigned long ul = 1234567890UL;
- char *pChar10 = "1234567890";
- char *pChar2 = "1001001100101100000001011010010";
- char *pChar16 = "499602d2";
-
- /*Initialize the PAL environment*/
- err = PAL_Initialize(argc, argv);
- if(0 != err)
- {
- return FAIL;
- }
-
- wpBuffer = (WCHAR*)malloc(64 * sizeof(WCHAR));
- if(NULL == wpBuffer)
- {
- Fail("\nFail to allocate the buffer to save a converted "
- "wide character string, error code=%d!\n",
- GetLastError());
- }
-
- /*convert to a 10 base string*/
- _ui64tow(ul, wpBuffer, 10);
- pChar = convertC(wpBuffer);
- if(strcmp(pChar10, pChar))
- {
- free(wpBuffer);
- free(pChar);
- Fail("\nFailed to call _ui64tow API to convert an interger "
- "to a 10 base wide character string, error code=%d\n",
- GetLastError());
- }
- free(pChar);
- free(wpBuffer);
-
- wpBuffer = (WCHAR*)malloc(64 * sizeof(WCHAR));
- if(NULL == wpBuffer)
- {
- Fail("\nFail to allocate the buffer to save a converted "
- "wide character string, error code=%d!\n",
- GetLastError());
- }
-
- /*convert to a 16 base string*/
- _ui64tow(ul, wpBuffer, 16);
- pChar = convertC(wpBuffer);
- if(strcmp(pChar16, pChar))
- {
- free(wpBuffer);
- free(pChar);
- Fail("\nFailed to call _ui64tow API to convert an interger "
- "to a 16 base wide character string, error code = %d\n",
- GetLastError());
- }
- free(pChar);
- free(wpBuffer);
-
- wpBuffer = (WCHAR*)malloc(64 * sizeof(WCHAR));
- if(NULL == wpBuffer)
- {
- Fail("\nFail to allocate the buffer to save a converted "
- "wide character string, error code=%d!\n",
- GetLastError());
- }
- /*convert to a 2 base string*/
- _ui64tow(ul, wpBuffer, 2);
- pChar = convertC(wpBuffer);
- if(strcmp(pChar2, pChar))
- {
- free(wpBuffer);
- free(pChar);
- Fail("\nFailed to call _ui64tow API to convert an interger "
- "to a 2 base wide character string, error code=%d\n",
- GetLastError());
- }
- free(pChar);
- free(wpBuffer);
-
- 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 = miscellaneous
-Function = _ui64tow
-Name = Positive test _ui64tow to convert an integer to a wide character string
-TYPE = DEFAULT
-EXE1 = _ui64tow
-Description
-=Test the _ui64tow API to convert an integer to a wide character string
+++ /dev/null
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- _ui64tow.cpp
-)
-
-add_executable(paltest_ui64tow_test2
- ${SOURCES}
-)
-
-add_dependencies(paltest_ui64tow_test2 coreclrpal)
-
-target_link_libraries(paltest_ui64tow_test2
- pthread
- m
- coreclrpal
-)
+++ /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: _ui64tow.c
-**
-** Purpose: Tests _ui64tow with normal values and different
-** radices,highest and lowest values.
-**
-**
-**============================================================*/
-
-#include <palsuite.h>
-
-typedef struct
-{
- unsigned __int64 value;
- int radix;
- char* result;
-} testCase;
-
-
-int __cdecl main(int argc, char *argv[])
-{
- WCHAR buffer[256];
- WCHAR *testStr;
- WCHAR *ret;
- int i;
- testCase testCases[] =
- {
- /* test limits */
- {UI64(0xFFFFFFFFFFFFFFFF), 2,
- "1111111111111111111111111111111111111111111111111111111111111111"},
- {UI64(0xFFFFFFFFFFFFFFFF), 8, "1777777777777777777777"},
- {UI64(0xFFFFFFFFFFFFFFFF), 10, "18446744073709551615"},
- {UI64(0xFFFFFFFFFFFFFFFF), 16, "ffffffffffffffff"},
- {47, 2, "101111"},
- {47, 8, "57"},
- {47, 10, "47"},
- {47, 16, "2f"},
- {12, 2, "1100"},
- {12, 8, "14"},
- {12, 10, "12"},
- {12, 16, "c"},
-
- /* test with 0. */
- {0, 2, "0"},
- {0, 8, "0"},
- {0, 10, "0"},
- {0, 16, "0"}
- };
-
- if (0 != (PAL_Initialize(argc, argv)))
- {
- return FAIL;
- }
-
- for (i=0; i<sizeof(testCases) / sizeof(testCase); i++)
- {
- ret = _ui64tow(testCases[i].value, buffer, testCases[i].radix);
-
- if (ret != buffer)
- {
- Fail("Failed to call _ui64tow API: did not return a pointer "
- "to string. Expected %p, got %p\n", buffer, ret);
- }
-
- testStr = convert(testCases[i].result);
-
- if (wcscmp(testStr, buffer) != 0)
- {
- Trace("ERROR: _ui64tow test#%d. Expected <%S>, got <%S>.\n",
- i,testStr, buffer);
- free(testStr);
- Fail("");
- }
-
- free(testStr);
- }
-
- 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 = miscellaneous
-Function = _ui64tow
-Name = Positive test _ui64tow to convert an integer to a wide character string
-TYPE = DEFAULT
-EXE1 = _ui64tow
-Description
-=Test the _ui64tow API to convert an integer to a wide character string
-=Test the limits. and 0.
c_runtime/_isnan/test1/paltest_isnan_test1
c_runtime/_isnanf/test1/paltest_isnanf_test1
c_runtime/_itow/test1/paltest_itow_test1
-c_runtime/_makepath/test1/paltest_makepath_test1
c_runtime/_mbsdec/test1/paltest_mbsdec_test1
c_runtime/_mbsinc/test1/paltest_mbsinc_test1
-c_runtime/_mbslen/test1/paltest_mbslen_test1
c_runtime/_mbsninc/test1/paltest_mbsninc_test1
c_runtime/_open_osfhandle/test1/paltest_open_osfhandle_test1
c_runtime/_open_osfhandle/test2/paltest_open_osfhandle_test2
c_runtime/_snwprintf/test6/paltest_snwprintf_test6
c_runtime/_snwprintf/test8/paltest_snwprintf_test8
c_runtime/_snwprintf/test9/paltest_snwprintf_test9
-c_runtime/_splitpath/test1/paltest_splitpath_test1
c_runtime/_stricmp/test1/paltest_stricmp_test1
c_runtime/_strlwr/test1/paltest_strlwr_test1
c_runtime/_strnicmp/test1/paltest_strnicmp_test1
-c_runtime/_swab/test1/paltest_swab_test1
c_runtime/_vsnprintf/test1/paltest_vsnprintf_test1
c_runtime/_vsnprintf/test10/paltest_vsnprintf_test10
c_runtime/_vsnprintf/test11/paltest_vsnprintf_test11
c_runtime/_wfopen/test5/paltest_wfopen_test5
c_runtime/_wfopen/test6/paltest_wfopen_test6
c_runtime/_wfopen/test7/paltest_wfopen_test7
-c_runtime/_wsplitpath/test1/paltest_wsplitpath_test1
c_runtime/_wtoi/test1/paltest_wtoi_test1
c_runtime/__iscsym/test1/paltest_iscsym_test1
debug_api/OutputDebugStringW/test1/paltest_outputdebugstringw_test1
miscellaneous/wsprintfW/test8/paltest_wsprintfw_test8
miscellaneous/wsprintfW/test9/paltest_wsprintfw_test9
miscellaneous/_i64tow/test1/paltest_i64tow_test1
-miscellaneous/_ui64tow/test1/paltest_ui64tow_test1
-miscellaneous/_ui64tow/test2/paltest_ui64tow_test2
pal_specific/pal_entrypoint/test1/paltest_pal_entrypoint_test1
pal_specific/PAL_errno/test1/paltest_pal_errno_test1
pal_specific/pal_initializedebug/test1/paltest_pal_initializedebug_test1
c_runtime/_snwprintf/test7/paltest_snwprintf_test7
c_runtime/_vsnwprintf/test2/paltest_vsnwprintf_test2
c_runtime/_vsnwprintf/test7/paltest_vsnwprintf_test7
-c_runtime/_wmakepath/test1/paltest_wmakepath_test1
debug_api/DebugBreak/test1/paltest_debugbreak_test1
debug_api/OutputDebugStringA/test1/paltest_outputdebugstringa_test1
debug_api/WriteProcessMemory/test1/paltest_writeprocessmemory_test1
c_runtime/_isnan/test1,1
c_runtime/_isnanf/test1,1
c_runtime/_itow/test1,1
-c_runtime/_makepath/test1,1
c_runtime/_mbsdec/test1,1
c_runtime/_mbsinc/test1,1
-c_runtime/_mbslen/test1,1
c_runtime/_mbsninc/test1,1
c_runtime/_open_osfhandle/test1,1
c_runtime/_open_osfhandle/test2,1
c_runtime/_snwprintf/test17,1
c_runtime/_snwprintf/test18,1
c_runtime/_snwprintf/test19,1
-c_runtime/_splitpath/test1,1
c_runtime/_stricmp/test1,1
c_runtime/_strlwr/test1,1
c_runtime/_strnicmp/test1,1
-c_runtime/_swab/test1,1
c_runtime/_vsnprintf/test1,1
c_runtime/_vsnprintf/test2,1
c_runtime/_vsnprintf/test3,1
c_runtime/_wfopen/test5,1
c_runtime/_wfopen/test6,1
c_runtime/_wfopen/test7,1
-c_runtime/_wmakepath/test1,1
-c_runtime/_wsplitpath/test1,1
c_runtime/_wtoi/test1,1
c_runtime/abs/test1,1
c_runtime/acos/test1,1
locale_info/widechartomultibyte/test2,1
locale_info/widechartomultibyte/test3,1
miscellaneous/_i64tow/test1,1
-miscellaneous/_ui64tow/test1,1
-miscellaneous/_ui64tow/test2,1
miscellaneous/charnexta/test1,1
miscellaneous/charnexta/test2,1
miscellaneous/charnextexa/test1,1
#ifndef FEATURE_CORECLR
/***
-*void _makepath() - build path name from components
+*void MakePath() - build path name from components
*
*Purpose:
* create a path name from its individual components
/***
-*_splitpath() - split a path name into its individual components
+*SplitPath() - split a path name into its individual components
*
*Purpose:
* to split a path name into its individual components
}
/***
-*_splitpath() - split a path name into its individual components
+*SplitPath() - split a path name into its individual components
*
*Purpose:
* to split a path name into its individual components