From 4afc049223040a1be12eef55a328d6c2533ef179 Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Mon, 4 Jan 2010 13:36:59 +0000 Subject: [PATCH] Add some of the string safe stuff to the headers. svn path=/trunk/; revision=44926 --- reactos/include/crt/crtdefs.h | 12 +++++++++++- reactos/include/crt/string.h | 21 ++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/reactos/include/crt/crtdefs.h b/reactos/include/crt/crtdefs.h index 136aaab0b54..c941eae87a2 100644 --- a/reactos/include/crt/crtdefs.h +++ b/reactos/include/crt/crtdefs.h @@ -163,7 +163,17 @@ /** Deprecated ***************************************************************/ -#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated) +#ifdef __GNUC__ +#define _CRT_DEPRECATE_TEXT(_Text) __attribute__ ((deprecated)) +#elif defined(_MSC_VER) +#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text)) +#else +#define _CRT_DEPRECATE_TEXT(_Text) +#endif + +#ifndef __STDC_WANT_SECURE_LIB__ +#define __STDC_WANT_SECURE_LIB__ 1 +#endif #ifndef _CRT_INSECURE_DEPRECATE # ifdef _CRT_SECURE_NO_DEPRECATE diff --git a/reactos/include/crt/string.h b/reactos/include/crt/string.h index c69a48f6a30..08dd479808c 100644 --- a/reactos/include/crt/string.h +++ b/reactos/include/crt/string.h @@ -101,16 +101,27 @@ extern "C" { #define _WSTRING_DEFINED _CRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *_Str); - _CRTIMP wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source); + _CRTIMP _CRT_INSECURE_DEPRECATE(wcsat_s) wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source); +#if __STDC_WANT_SECURE_LIB__ + _CRTIMP errno_t __cdecl wcsat_s(wchar_t * Dest, size_t SizeInWords, const wchar_t * _Source); +#endif _CRTIMP _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch); _CRTIMP int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2); - _CRTIMP wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source); + _CRTIMP _CRT_INSECURE_DEPRECATE(wcscpy_s) wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source); +#if __STDC_WANT_SECURE_LIB__ + _CRTIMP errno_t __cdecl wcscpy_s(wchar_t * Dest, size_t SizeInWords, const wchar_t * _Source); +#endif _CRTIMP size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control); _CRTIMP size_t __cdecl wcslen(const wchar_t *_Str); - _CRTIMP size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount); - _CRTIMP wchar_t *wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + _CRTIMP _CRT_INSECURE_DEPRECATE(wcsnlen_s) size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount); +#if __STDC_WANT_SECURE_LIB__ + _CRTIMP errno_t __cdecl wcsnlen_s(wchar_t **_Src, size_t _MaxCount); +#endif _CRTIMP int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); - _CRTIMP wchar_t *wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + _CRTIMP _CRT_INSECURE_DEPRECATE(wcsncpy_s) wchar_t *wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); +#if __STDC_WANT_SECURE_LIB__ + _CRTIMP errno_t __cdecl wcsncpy_s(wchar_t *_Dest, size_t SizeInWords, const wchar_t *_Source ,size_t _Count); +#endif _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control); _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch); _CRTIMP size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control);