diff options
author | mio <[email protected]> | 2024-08-22 19:34:23 +1000 |
---|---|---|
committer | mio <[email protected]> | 2024-08-22 23:15:20 +1000 |
commit | ed55bf072682ebf73239e74b7e3dd286ed5616a5 (patch) | |
tree | f13875c92a1b0cd5ba8d925ac5f2c6413e9ccc6d /src/app/captureFrame.cpp | |
parent | 5e965846d17f7053dca99f3366ce5d8f21e8f649 (diff) | |
download | codeine-ed55bf072682ebf73239e74b7e3dd286ed5616a5.tar.gz codeine-ed55bf072682ebf73239e74b7e3dd286ed5616a5.zip |
Use nullptr instead of NULL/0 pointer in C++ files
See: https://mirror.git.trinitydesktop.org/gitea/TDE/tde/issues/73
Signed-off-by: mio <[email protected]>
Diffstat (limited to 'src/app/captureFrame.cpp')
-rw-r--r-- | src/app/captureFrame.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/app/captureFrame.cpp b/src/app/captureFrame.cpp index 41796b9..119e729 100644 --- a/src/app/captureFrame.cpp +++ b/src/app/captureFrame.cpp @@ -255,25 +255,30 @@ VideoWindow::captureFrame() const return TQImage(); int yuv_size = ((w + 8) * (h + 1)) * 2; - uint8_t *yuv = new uint8_t[yuv_size]; - if( yuv == 0 ) { + uint8_t *yuv = new(std::nothrow) uint8_t[yuv_size]; + if (yuv == nullptr) { Debug::error() << "Not enough memory to make screenframe!\n"; - return TQImage(); } + return TQImage(); + } xine_get_current_frame_s(*engine(), &w, &h, &ratio, &format, yuv, &yuv_size); // convert to yv12 if necessary - uint8_t *y = 0, *u = 0, *v = 0; + uint8_t *y = nullptr; + uint8_t *u = nullptr; + uint8_t *v = nullptr; + switch( format ) { case XINE_IMGFMT_YUY2: { uint8_t *yuy2 = yuv; - yuv = new uint8_t[(w * h * 2)]; - if( yuv == 0 ) { + yuv = new(std::nothrow) uint8_t[(w * h * 2)]; + if (yuv == nullptr) { Debug::error() << "Not enough memory to make screenframe!\n"; delete [] yuy2; - return TQImage(); } + return TQImage(); + } y = yuv; u = yuv + w * h; @@ -298,7 +303,7 @@ VideoWindow::captureFrame() const // convert to rgb uchar *rgb = yv12ToRgb( y, u, v, w, h ); - TQImage frame( rgb, w, h, 32, 0, 0, TQImage::IgnoreEndian ); + TQImage frame( rgb, w, h, 32, nullptr, 0, TQImage::IgnoreEndian ); delete [] yuv; return frame; |