mirror of
https://github.com/opencv/opencv.git
synced 2025-06-11 11:45:30 +08:00
core: use explicit for cv::AutoBuffer
To avoid compilation of this code: - buf = 0; This code can be received after refactoring of 1D cv::Mat to cv::AutoBuffer. - "cv_mat = 0" calls setTo(). - cv::AutoBuffer calls "allocate(0)" - this is wrong.
This commit is contained in:
parent
0792ef8789
commit
ee1ac1140d
@ -472,7 +472,7 @@ class IppAutoBuffer
|
||||
{
|
||||
public:
|
||||
IppAutoBuffer() { m_size = 0; m_pBuffer = NULL; }
|
||||
IppAutoBuffer(size_t size) { m_size = 0; m_pBuffer = NULL; allocate(size); }
|
||||
explicit IppAutoBuffer(size_t size) { m_size = 0; m_pBuffer = NULL; allocate(size); }
|
||||
~IppAutoBuffer() { deallocate(); }
|
||||
T* allocate(size_t size) { if(m_size < size) { deallocate(); m_pBuffer = (T*)CV_IPP_MALLOC(size); m_size = size; } return m_pBuffer; }
|
||||
void deallocate() { if(m_pBuffer) { ippFree(m_pBuffer); m_pBuffer = NULL; } m_size = 0; }
|
||||
|
@ -124,7 +124,7 @@ public:
|
||||
//! the default constructor
|
||||
AutoBuffer();
|
||||
//! constructor taking the real buffer size
|
||||
AutoBuffer(size_t _size);
|
||||
explicit AutoBuffer(size_t _size);
|
||||
|
||||
//! the copy constructor
|
||||
AutoBuffer(const AutoBuffer<_Tp, fixed_size>& buf);
|
||||
|
Loading…
Reference in New Issue
Block a user