string: switch from intptr_t to ptrdiff_t at strtoi()
strtoi() is complementary to strtoui() returning size_t. But, intptr_t is complementary to uintptr_t, and ptrdiff_t is complementary to size_t. I know it doesn't matter on flat-memory platforms, but nevertheless, we try to keep things organized in a portable way. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
ba38dad49d
commit
61bf25ac6a
@ -2020,15 +2020,15 @@ namespace stdex
|
|||||||
/// \return Binary integer value
|
/// \return Binary integer value
|
||||||
///
|
///
|
||||||
template <class T>
|
template <class T>
|
||||||
inline intptr_t strtoi(
|
inline ptrdiff_t strtoi(
|
||||||
_In_reads_or_z_opt_(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)
|
||||||
{
|
{
|
||||||
#if defined(_WIN64) || defined(__LP64__)
|
#if defined(_WIN64) || defined(__LP64__)
|
||||||
return static_cast<intptr_t>(strto64(str, count, end, radix));
|
return static_cast<ptrdiff_t>(strto64(str, count, end, radix));
|
||||||
#else
|
#else
|
||||||
return static_cast<intptr_t>(strto32(str, count, end, radix));
|
return static_cast<ptrdiff_t>(strto32(str, count, end, radix));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2043,7 +2043,7 @@ namespace stdex
|
|||||||
/// \return Binary integer value
|
/// \return Binary integer value
|
||||||
///
|
///
|
||||||
template <class T, size_t N>
|
template <class T, size_t N>
|
||||||
inline intptr_t strtoi(
|
inline ptrdiff_t strtoi(
|
||||||
_In_ const T (&str)[N],
|
_In_ const T (&str)[N],
|
||||||
_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