mbusafecrt.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // Copyright (c) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
  4. //
  5. /***
  6. * mbusafecrt.h - public declarations for SafeCRT lib
  7. *
  8. *
  9. * Purpose:
  10. * This file contains the public declarations SafeCRT
  11. * functions ported to MacOS. These are the safe versions of
  12. * functions standard functions banned by SWI
  13. *
  14. ****/
  15. /* shields! */
  16. #ifndef MBUSAFECRT_H
  17. #define MBUSAFECRT_H
  18. #include <string.h>
  19. #include <stdarg.h>
  20. #include <wchar.h>
  21. typedef wchar_t WCHAR;
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. extern errno_t strcat_s( char* ioDest, size_t inDestBufferSize, const char* inSrc );
  26. extern errno_t wcscat_s( WCHAR* ioDest, size_t inDestBufferSize, const WCHAR* inSrc );
  27. extern errno_t strncat_s( char* ioDest, size_t inDestBufferSize, const char* inSrc, size_t inCount );
  28. extern errno_t wcsncat_s( WCHAR* ioDest, size_t inDestBufferSize, const WCHAR* inSrc, size_t inCount );
  29. extern errno_t strcpy_s( char* outDest, size_t inDestBufferSize, const char* inSrc );
  30. extern errno_t wcscpy_s( WCHAR* outDest, size_t inDestBufferSize, const WCHAR* inSrc );
  31. extern errno_t strncpy_s( char* outDest, size_t inDestBufferSize, const char* inSrc, size_t inCount );
  32. extern errno_t wcsncpy_s( WCHAR* outDest, size_t inDestBufferSize, const WCHAR* inSrc, size_t inCount );
  33. extern char* strtok_s( char* inString, const char* inControl, char** ioContext );
  34. extern WCHAR* wcstok_s( WCHAR* inString, const WCHAR* inControl, WCHAR** ioContext );
  35. extern size_t wcsnlen( const WCHAR* inString, size_t inMaxSize );
  36. extern errno_t _itoa_s( int inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
  37. extern errno_t _itow_s( int inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
  38. extern errno_t _ltoa_s( long inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
  39. extern errno_t _ltow_s( long inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
  40. extern errno_t _ultoa_s( unsigned long inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
  41. extern errno_t _ultow_s( unsigned long inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
  42. extern errno_t _i64toa_s( long long inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
  43. extern errno_t _i64tow_s( long long inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
  44. extern errno_t _ui64toa_s( unsigned long long inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
  45. extern errno_t _ui64tow_s( unsigned long long inValue, WCHAR* outBuffer, size_t inDestBufferSize, int inRadix );
  46. extern int sprintf_s( char *string, size_t sizeInBytes, const char *format, ... );
  47. extern int swprintf_s( WCHAR *string, size_t sizeInWords, const WCHAR *format, ... );
  48. extern int _snprintf_s( char *string, size_t sizeInBytes, size_t count, const char *format, ... );
  49. extern int _snwprintf_s( WCHAR *string, size_t sizeInWords, size_t count, const WCHAR *format, ... );
  50. extern int _vsprintf_s( char* string, size_t sizeInBytes, const char* format, va_list arglist );
  51. extern int _vsnprintf_s( char* string, size_t sizeInBytes, size_t count, const char* format, va_list arglist );
  52. extern int _vswprintf_s( WCHAR* string, size_t sizeInWords, const WCHAR* format, va_list arglist );
  53. extern int _vsnwprintf_s( WCHAR* string, size_t sizeInWords, size_t count, const WCHAR* format, va_list arglist );
  54. extern errno_t memcpy_s( void * dst, size_t sizeInBytes, const void * src, size_t count );
  55. extern errno_t memmove_s( void * dst, size_t sizeInBytes, const void * src, size_t count );
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* MBUSAFECRT_H */