Revise SAL for "start&length" string parameters
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
2c8fad779c
commit
5d46888dc2
@ -36,6 +36,9 @@
|
|||||||
#ifndef _In_reads_or_z_
|
#ifndef _In_reads_or_z_
|
||||||
#define _In_reads_or_z_(p)
|
#define _In_reads_or_z_(p)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _In_reads_or_z_opt_
|
||||||
|
#define _In_reads_or_z_opt_(p)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _Inout_
|
#ifndef _Inout_
|
||||||
#define _Inout_
|
#define _Inout_
|
||||||
|
@ -43,7 +43,7 @@ namespace stdex
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline const T* sgmlend(
|
inline const T* sgmlend(
|
||||||
_In_reads_or_z_(count) const T* str,
|
_In_reads_or_z_opt_(count) const T* str,
|
||||||
_In_ size_t count)
|
_In_ size_t count)
|
||||||
{
|
{
|
||||||
assert(str || !count);
|
assert(str || !count);
|
||||||
@ -93,7 +93,7 @@ namespace stdex
|
|||||||
template <class T>
|
template <class T>
|
||||||
inline void sgml2str(
|
inline void sgml2str(
|
||||||
_Inout_ std::wstring &dst,
|
_Inout_ std::wstring &dst,
|
||||||
_In_reads_or_z_(count_src) const T* src, _In_ size_t count_src,
|
_In_reads_or_z_opt_(count_src) const T* src, _In_ size_t count_src,
|
||||||
_In_ int skip = 0,
|
_In_ int skip = 0,
|
||||||
_In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
|
_In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
|
||||||
_Inout_opt_ mapping_vector<size_t>* map = nullptr)
|
_Inout_opt_ mapping_vector<size_t>* map = nullptr)
|
||||||
@ -185,7 +185,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T>
|
template <class T>
|
||||||
inline std::wstring sgml2str(
|
inline std::wstring sgml2str(
|
||||||
_In_reads_or_z_(count_src) const T* src, _In_ size_t count_src,
|
_In_reads_or_z_opt_(count_src) const T* src, _In_ size_t count_src,
|
||||||
_In_ int skip = 0,
|
_In_ int skip = 0,
|
||||||
_In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
|
_In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
|
||||||
_Inout_opt_ mapping_vector<size_t>* map = nullptr)
|
_Inout_opt_ mapping_vector<size_t>* map = nullptr)
|
||||||
@ -234,7 +234,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
inline void str2sgml(
|
inline void str2sgml(
|
||||||
_Inout_ std::string &dst,
|
_Inout_ std::string &dst,
|
||||||
_In_reads_or_z_(count_src) const wchar_t* src,
|
_In_reads_or_z_opt_(count_src) const wchar_t* src,
|
||||||
_In_ size_t count_src,
|
_In_ size_t count_src,
|
||||||
_In_ size_t what = 0)
|
_In_ size_t what = 0)
|
||||||
{
|
{
|
||||||
@ -337,7 +337,7 @@ namespace stdex
|
|||||||
/// \return SGML string
|
/// \return SGML string
|
||||||
///
|
///
|
||||||
inline std::string str2sgml(
|
inline std::string str2sgml(
|
||||||
_In_reads_or_z_(count_src) const wchar_t* src,
|
_In_reads_or_z_opt_(count_src) const wchar_t* src,
|
||||||
_In_ size_t count_src,
|
_In_ size_t count_src,
|
||||||
_In_ size_t what = 0)
|
_In_ size_t what = 0)
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ namespace stdex
|
|||||||
/// \param[in] count Code unit limit
|
/// \param[in] count Code unit limit
|
||||||
///
|
///
|
||||||
template <class T>
|
template <class T>
|
||||||
inline size_t islbreak(_In_reads_or_z_(count) const T* chr, _In_ size_t count)
|
inline size_t islbreak(_In_reads_or_z_opt_(count) const T* chr, _In_ size_t count)
|
||||||
{
|
{
|
||||||
if (count >= 2 && (chr[0] == '\r' && chr[1] == '\n' || chr[0] == '\n' && chr[1] == '\r'))
|
if (count >= 2 && (chr[0] == '\r' && chr[1] == '\n' || chr[0] == '\n' && chr[1] == '\r'))
|
||||||
return 2;
|
return 2;
|
||||||
@ -126,7 +126,7 @@ namespace stdex
|
|||||||
/// \param[in] glyph Start of a glyph
|
/// \param[in] glyph Start of a glyph
|
||||||
/// \param[in] count Code unit limit
|
/// \param[in] count Code unit limit
|
||||||
///
|
///
|
||||||
inline size_t glyphlen(_In_reads_or_z_(count) const wchar_t* glyph, size_t count)
|
inline size_t glyphlen(_In_reads_or_z_opt_(count) const wchar_t* glyph, size_t count)
|
||||||
{
|
{
|
||||||
if (count) {
|
if (count) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -184,7 +184,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T>
|
template <class T>
|
||||||
inline const T* strnchr(
|
inline const T* strnchr(
|
||||||
_In_reads_or_z_(count) const T* str,
|
_In_reads_or_z_opt_(count) const T* str,
|
||||||
_In_ T chr,
|
_In_ T chr,
|
||||||
_In_ size_t count)
|
_In_ size_t count)
|
||||||
{
|
{
|
||||||
@ -205,7 +205,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T>
|
template <class T>
|
||||||
inline const T* strnichr(
|
inline const T* strnichr(
|
||||||
_In_reads_or_z_(count) const T* str,
|
_In_reads_or_z_opt_(count) const T* str,
|
||||||
_In_ T chr,
|
_In_ T chr,
|
||||||
_In_ size_t count,
|
_In_ size_t count,
|
||||||
_In_ const std::locale& locale)
|
_In_ const std::locale& locale)
|
||||||
@ -230,8 +230,8 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T1, class T2>
|
template <class T1, class T2>
|
||||||
inline int strncmp(
|
inline int strncmp(
|
||||||
_In_reads_or_z_(count1) const T1* str1, _In_ size_t count1,
|
_In_reads_or_z_opt_(count1) const T1* str1, _In_ size_t count1,
|
||||||
_In_reads_or_z_(count2) const T2* str2, _In_ size_t count2)
|
_In_reads_or_z_opt_(count2) const T2* str2, _In_ size_t count2)
|
||||||
{
|
{
|
||||||
assert(str1 || !count1);
|
assert(str1 || !count1);
|
||||||
assert(str2 || !count2);
|
assert(str2 || !count2);
|
||||||
@ -257,8 +257,8 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T1, class T2>
|
template <class T1, class T2>
|
||||||
inline int strnicmp(
|
inline int strnicmp(
|
||||||
_In_reads_or_z_(count1) const T1* str1, _In_ size_t count1,
|
_In_reads_or_z_opt_(count1) const T1* str1, _In_ size_t count1,
|
||||||
_In_reads_or_z_(count2) const T2* str2, _In_ size_t count2,
|
_In_reads_or_z_opt_(count2) const T2* str2, _In_ size_t count2,
|
||||||
_In_ const std::locale& locale)
|
_In_ const std::locale& locale)
|
||||||
{
|
{
|
||||||
assert(str1 || !count1);
|
assert(str1 || !count1);
|
||||||
@ -286,7 +286,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T1, class T2>
|
template <class T1, class T2>
|
||||||
const T1* strnstr(
|
const T1* strnstr(
|
||||||
_In_reads_or_z_(count) const T1* str,
|
_In_reads_or_z_opt_(count) const T1* str,
|
||||||
_In_z_ const T2* sample,
|
_In_z_ const T2* sample,
|
||||||
_In_ size_t count)
|
_In_ size_t count)
|
||||||
{
|
{
|
||||||
@ -315,7 +315,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T1, class T2>
|
template <class T1, class T2>
|
||||||
inline const T1* strnistr(
|
inline const T1* strnistr(
|
||||||
_In_reads_or_z_(count) const T1* str,
|
_In_reads_or_z_opt_(count) const T1* str,
|
||||||
_In_z_ const T2* sample,
|
_In_z_ const T2* sample,
|
||||||
_In_ size_t count,
|
_In_ size_t count,
|
||||||
_In_ const std::locale& locale)
|
_In_ const std::locale& locale)
|
||||||
@ -366,7 +366,7 @@ namespace stdex
|
|||||||
/// \cond internal
|
/// \cond internal
|
||||||
template <class T, class T_bin>
|
template <class T, class T_bin>
|
||||||
inline T_bin strtoint(
|
inline T_bin strtoint(
|
||||||
_In_reads_or_z_(count) const T* str, _In_ size_t count,
|
_In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
|
||||||
_Out_opt_ size_t* end,
|
_Out_opt_ size_t* end,
|
||||||
_In_ int radix,
|
_In_ int radix,
|
||||||
_Out_ uint8_t& flags)
|
_Out_ uint8_t& flags)
|
||||||
@ -469,7 +469,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T, class T_bin>
|
template <class T, class T_bin>
|
||||||
T_bin strtoint(
|
T_bin strtoint(
|
||||||
_In_reads_or_z_(count) const T* str, _In_ size_t count,
|
_In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
|
||||||
_Out_opt_ size_t* end,
|
_Out_opt_ size_t* end,
|
||||||
_In_ int radix)
|
_In_ int radix)
|
||||||
{
|
{
|
||||||
@ -534,7 +534,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T, class T_bin>
|
template <class T, class T_bin>
|
||||||
inline T_bin strtouint(
|
inline T_bin strtouint(
|
||||||
_In_reads_or_z_(count) const T* str,
|
_In_reads_or_z_opt_(count) const T* str,
|
||||||
_In_ size_t count,
|
_In_ size_t count,
|
||||||
_Out_opt_ size_t* end,
|
_Out_opt_ size_t* end,
|
||||||
_In_ int radix)
|
_In_ int radix)
|
||||||
@ -567,7 +567,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T>
|
template <class T>
|
||||||
inline int32_t strto32(
|
inline int32_t strto32(
|
||||||
_In_reads_or_z_(count) const T* str, _In_ size_t count,
|
_In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
|
||||||
_Out_opt_ size_t* end,
|
_Out_opt_ size_t* end,
|
||||||
_In_ int radix)
|
_In_ int radix)
|
||||||
{
|
{
|
||||||
@ -586,7 +586,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T>
|
template <class T>
|
||||||
inline int64_t strto64(
|
inline int64_t strto64(
|
||||||
_In_reads_or_z_(count) const T* str, _In_ size_t count,
|
_In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
|
||||||
_Out_opt_ size_t* end,
|
_Out_opt_ size_t* end,
|
||||||
_In_ int radix)
|
_In_ int radix)
|
||||||
{
|
{
|
||||||
@ -606,7 +606,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T>
|
template <class T>
|
||||||
inline intptr_t strtoi(
|
inline intptr_t strtoi(
|
||||||
_In_reads_or_z_(count) const T* str, _In_ size_t count,
|
_In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
|
||||||
_Out_opt_ size_t* end,
|
_Out_opt_ size_t* end,
|
||||||
_In_ int radix)
|
_In_ int radix)
|
||||||
{
|
{
|
||||||
@ -629,7 +629,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T>
|
template <class T>
|
||||||
inline uint32_t strtou32(
|
inline uint32_t strtou32(
|
||||||
_In_reads_or_z_(count) const T* str, _In_ size_t count,
|
_In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
|
||||||
_Out_opt_ size_t* end,
|
_Out_opt_ size_t* end,
|
||||||
_In_ int radix)
|
_In_ int radix)
|
||||||
{
|
{
|
||||||
@ -648,7 +648,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T>
|
template <class T>
|
||||||
inline uint64_t strtou64(
|
inline uint64_t strtou64(
|
||||||
_In_reads_or_z_(count) const T* str, _In_ size_t count,
|
_In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
|
||||||
_Out_opt_ size_t* end,
|
_Out_opt_ size_t* end,
|
||||||
_In_ int radix)
|
_In_ int radix)
|
||||||
{
|
{
|
||||||
@ -668,7 +668,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
template <class T>
|
template <class T>
|
||||||
inline size_t strtoui(
|
inline size_t strtoui(
|
||||||
_In_reads_or_z_(count) const T* str, _In_ size_t count,
|
_In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
|
||||||
_Out_opt_ size_t* end,
|
_Out_opt_ size_t* end,
|
||||||
_In_ int radix)
|
_In_ int radix)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user