|
|
|
1 |
|
/*** |
2 |
|
*string.h - declarations for string manipulation functions |
3 |
|
* |
4 |
|
* Copyright (c) Microsoft Corporation. All rights reserved. |
5 |
|
* |
6 |
|
*Purpose: |
7 |
|
* This file contains the function declarations for the string |
8 |
|
* manipulation functions. |
9 |
|
* [ANSI/System V] |
10 |
|
* |
11 |
|
* [Public] |
12 |
|
* |
13 |
|
****/ |
14 |
|
|
15 |
|
#if _MSC_VER > 1000 |
16 |
|
#pragma once |
17 |
|
#endif |
18 |
|
|
19 |
|
#ifndef _INC_STRING |
20 |
|
#define _INC_STRING |
21 |
|
|
22 |
|
#include <crtdefs.h> |
23 |
|
|
24 |
|
#ifdef __cplusplus |
25 |
|
extern "C" { |
26 |
|
#endif |
27 |
|
|
28 |
|
#ifndef _NLSCMP_DEFINED |
29 |
|
#define _NLSCMPERROR 2147483647 /* currently == INT_MAX */ |
30 |
|
#define _NLSCMP_DEFINED |
31 |
|
#endif |
32 |
|
|
33 |
|
/* Define NULL pointer value */ |
34 |
|
#ifndef NULL |
35 |
|
#ifdef __cplusplus |
36 |
|
#define NULL 0 |
37 |
|
#else |
38 |
|
#define NULL ((void *)0) |
39 |
|
#endif |
40 |
|
#endif |
41 |
|
|
42 |
|
/* For backwards compatibility */ |
43 |
|
#define _WConst_return _CONST_RETURN |
44 |
|
|
45 |
|
/* Function prototypes */ |
46 |
|
#ifndef _CRT_MEMORY_DEFINED |
47 |
|
#define _CRT_MEMORY_DEFINED |
48 |
|
_CRTIMP void * __cdecl _memccpy( _Out_opt_bytecap_(_MaxCount) void * _Dst, _In_ const void * _Src, _In_ int _Val, _In_ size_t _MaxCount); |
49 |
|
_Check_return_ _CRTIMP _CONST_RETURN void * __cdecl memchr( _In_opt_bytecount_(_MaxCount) const void * _Buf , _In_ int _Val, _In_ size_t _MaxCount); |
50 |
|
_Check_return_ _CRTIMP int __cdecl _memicmp(_In_opt_bytecount_(_Size) const void * _Buf1, _In_opt_bytecount_(_Size) const void * _Buf2, _In_ size_t _Size); |
51 |
|
_Check_return_ _CRTIMP int __cdecl _memicmp_l(_In_opt_bytecount_(_Size) const void * _Buf1, _In_opt_bytecount_(_Size) const void * _Buf2, _In_ size_t _Size, _In_opt_ _locale_t _Locale); |
52 |
|
_Check_return_ int __cdecl memcmp(_In_opt_bytecount_(_Size) const void * _Buf1, _In_opt_bytecount_(_Size) const void * _Buf2, _In_ size_t _Size); |
53 |
|
_CRT_INSECURE_DEPRECATE_MEMORY(memcpy_s) void * __cdecl memcpy(_Out_opt_bytecapcount_(_Size) void * _Dst, _In_opt_bytecount_(_Size) const void * _Src, _In_ size_t _Size); |
54 |
|
#if __STDC_WANT_SECURE_LIB__ |
55 |
|
_CRTIMP errno_t __cdecl memcpy_s(_Out_opt_bytecap_post_bytecount_(_DstSize, _MaxCount) void * _Dst, _In_ rsize_t _DstSize, _In_opt_bytecount_(_MaxCount) const void * _Src, _In_ rsize_t _MaxCount); |
56 |
|
#endif |
57 |
|
void * __cdecl memset(_Out_opt_bytecapcount_(_Size) void * _Dst, _In_ int _Val, _In_ size_t _Size); |
58 |
|
|
59 |
|
#if !__STDC__ |
60 |
|
/* Non-ANSI names for compatibility */ |
61 |
|
_CRT_NONSTDC_DEPRECATE(_memccpy) _CRTIMP void * __cdecl memccpy(_Out_opt_bytecap_(_Size) void * _Dst, _In_opt_bytecount_(_Size) const void * _Src, _In_ int _Val, _In_ size_t _Size); |
62 |
|
_Check_return_ _CRT_NONSTDC_DEPRECATE(_memicmp) _CRTIMP int __cdecl memicmp(_In_opt_bytecount_(_Size) const void * _Buf1, _In_opt_bytecount_(_Size) const void * _Buf2, _In_ size_t _Size); |
63 |
|
#endif /* __STDC__ */ |
64 |
|
|
65 |
|
#endif |
66 |
|
|
67 |
|
_Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl _strset_s(_Inout_z_cap_(_DstSize) char * _Dst, _In_ size_t _DstSize, _In_ int _Value); |
68 |
|
__DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _strset_s, _Deref_prepost_z_ char, _Dest, _In_ int, _Value) |
69 |
|
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(char *, __RETURN_POLICY_DST, __EMPTY_DECLSPEC, _strset, _Inout_z_, char, _Dest, _In_ int, _Value) |
70 |
|
#if __STDC_WANT_SECURE_LIB__ |
71 |
|
_Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl strcpy_s(_Out_z_cap_(_SizeInBytes) char * _Dst, _In_ rsize_t _SizeInBytes, _In_z_ const char * _Src); |
72 |
|
#endif |
73 |
|
__DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, strcpy_s, _Deref_post_z_ char, _Dest, _In_z_ const char *, _Source) |
74 |
|
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(char *, __RETURN_POLICY_DST, __EMPTY_DECLSPEC, strcpy, _Pre_cap_for_(_Source) _Post_z_, char, _Dest, _In_z_ const char *, _Source) |
75 |
|
#if __STDC_WANT_SECURE_LIB__ |
76 |
|
_Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl strcat_s(_Inout_z_cap_(_SizeInBytes) char * _Dst, _In_ rsize_t _SizeInBytes, _In_z_ const char * _Src); |
77 |
|
#endif |
78 |
|
__DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, strcat_s, _Deref_prepost_z_ char, _Dest, _In_z_ const char *, _Source) |
79 |
|
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(char *, __RETURN_POLICY_DST, __EMPTY_DECLSPEC, strcat, _Pre_cap_for_(_Source) _Prepost_z_, char, _Dest, _In_z_ const char *, _Source) |
80 |
|
_Check_return_ int __cdecl strcmp(_In_z_ const char * _Str1, _In_z_ const char * _Str2); |
81 |
|
_Check_return_ size_t __cdecl strlen(_In_z_ const char * _Str); |
82 |
|
_Check_return_ _CRTIMP size_t __cdecl strnlen(_In_z_ const char * _Str, _In_ size_t _MaxCount); |
83 |
|
#if __STDC_WANT_SECURE_LIB__ && !defined (__midl) |
84 |
|
_Check_return_ static __inline size_t __CRTDECL strnlen_s(_In_z_ const char * _Str, _In_ size_t _MaxCount) |
85 |
|
{ |
86 |
|
return (_Str==0) ? 0 : strnlen(_Str, _MaxCount); |
87 |
|
} |
88 |
|
#endif |
331 |
|
{return ((wchar_t *)wcschr((const wchar_t *)_Str, _Ch)); } |
332 |
|
_Check_return_ inline wchar_t * __CRTDECL wcspbrk(_In_z_ wchar_t *_Str, _In_z_ const wchar_t *_Control) |
333 |
|
{return ((wchar_t *)wcspbrk((const wchar_t *)_Str, _Control)); } |
334 |
|
_Check_return_ inline wchar_t * __CRTDECL wcsrchr(_In_z_ wchar_t *_Str, _In_ wchar_t _Ch) |
335 |
|
{return ((wchar_t *)wcsrchr((const wchar_t *)_Str, _Ch)); } |
336 |
|
_Check_return_ inline wchar_t * __CRTDECL wcsstr(_In_z_ wchar_t *_Str, _In_z_ const wchar_t *_SubStr) |
337 |
|
{return ((wchar_t *)wcsstr((const wchar_t *)_Str, _SubStr)); } |
338 |
|
} |
339 |
|
#endif |
340 |
|
#endif |
341 |
|
|
342 |
|
#if !__STDC__ |
343 |
|
|
344 |
|
#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) |
345 |
|
#pragma push_macro("wcsdup") |
346 |
|
#undef wcsdup |
347 |
|
#endif |
348 |
|
|
349 |
|
_Check_return_ _CRT_NONSTDC_DEPRECATE(_wcsdup) _CRTIMP wchar_t * __cdecl wcsdup(_In_z_ const wchar_t * _Str); |
350 |
|
|
351 |
|
#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) |
352 |
|
#pragma pop_macro("wcsdup") |
353 |
|
#endif |
354 |
|
|
355 |
|
/* old names */ |
356 |
|
#define wcswcs wcsstr |
357 |
|
|
358 |
|
/* prototypes for oldnames.lib functions */ |
359 |
|
_Check_return_ _CRT_NONSTDC_DEPRECATE(_wcsicmp) _CRTIMP int __cdecl wcsicmp(_In_z_ const wchar_t * _Str1, _In_z_ const wchar_t * _Str2); |
360 |
|
_Check_return_ _CRT_NONSTDC_DEPRECATE(_wcsnicmp) _CRTIMP int __cdecl wcsnicmp(_In_z_ const wchar_t * _Str1, _In_z_ const wchar_t * _Str2, _In_ size_t _MaxCount); |
361 |
|
_CRT_NONSTDC_DEPRECATE(_wcsnset) _CRTIMP wchar_t * __cdecl wcsnset(_Inout_z_cap_(_MaxCount) wchar_t * _Str, _In_ wchar_t _Val, _In_ size_t _MaxCount); |
362 |
|
_CRT_NONSTDC_DEPRECATE(_wcsrev) _CRTIMP wchar_t * __cdecl wcsrev(_Inout_z_ wchar_t * _Str); |
363 |
|
_CRT_NONSTDC_DEPRECATE(_wcsset) _CRTIMP wchar_t * __cdecl wcsset(_Inout_z_ wchar_t * _Str, wchar_t _Val); |
364 |
|
_CRT_NONSTDC_DEPRECATE(_wcslwr) _CRTIMP wchar_t * __cdecl wcslwr(_Inout_z_ wchar_t * _Str); |
365 |
|
_CRT_NONSTDC_DEPRECATE(_wcsupr) _CRTIMP wchar_t * __cdecl wcsupr(_Inout_z_ wchar_t * _Str); |
366 |
|
_Check_return_ _CRT_NONSTDC_DEPRECATE(_wcsicoll) _CRTIMP int __cdecl wcsicoll(_In_z_ const wchar_t * _Str1, _In_z_ const wchar_t * _Str2); |
367 |
|
|
368 |
|
#endif /* !__STDC__ */ |
369 |
|
|
370 |
|
#define _WSTRING_DEFINED |
371 |
|
#endif |
372 |
|
|
373 |
|
|
374 |
|
#ifdef __cplusplus |
375 |
|
} |
376 |
|
#endif |
377 |
|
|
378 |
|
#endif /* _INC_STRING */ |
379 |
|
|
|
|
|