Merge pull request #27976 from asmorkalov:as/size_t_fix_win32

Fixed ptrdiff_t cast on windows 32-bit #27976

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Alexander Smorkalov
2025-11-08 17:07:36 +03:00
committed by GitHub
parent 6862afb2c1
commit 9921531fa4
3 changed files with 1 additions and 9 deletions

View File

@@ -153,7 +153,7 @@ void RBaseStream::setPos( int64_t pos )
int64_t RBaseStream::getPos()
{
CV_Assert(isOpened());
int64_t pos = validateToInt64((m_current - m_start) + m_block_pos);
int64_t pos = static_cast<int64_t>((m_current - m_start) + m_block_pos);
CV_Assert(pos >= m_block_pos); // overflow check
CV_Assert(pos >= 0); // overflow check
return pos;

View File

@@ -51,13 +51,6 @@ int validateToInt(size_t sz)
return valueInt;
}
int64_t validateToInt64(ptrdiff_t sz)
{
int64_t valueInt = static_cast<int64_t>(sz);
CV_Assert((ptrdiff_t)valueInt == sz);
return valueInt;
}
#define SCALE 14
#define cR (int)(0.299*(1 << SCALE) + 0.5)
#define cG (int)(0.587*(1 << SCALE) + 0.5)

View File

@@ -45,7 +45,6 @@
namespace cv {
int validateToInt(size_t step);
int64_t validateToInt64(ptrdiff_t step);
template <typename _Tp> static inline
size_t safeCastToSizeT(const _Tp v_origin, const char* msg)