Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
cd1eb55e by Marvin Scholz at 2022-06-15T09:53:17+00:00
access: live555: use std::min/max where applicable

- - - - -
0c0f2422 by Marvin Scholz at 2022-06-15T09:53:17+00:00
codec: mft: use std::max

- - - - -
584fd17a by Marvin Scholz at 2022-06-15T09:53:17+00:00
meta: taglib: use std::min

- - - - -
8ceae31d by Marvin Scholz at 2022-06-15T09:53:17+00:00
demux: mkv: use std::max

- - - - -
0a914ab6 by Marvin Scholz at 2022-06-15T09:53:17+00:00
macosx: use MAX instead of __MAX

MAX is an Foundation provided macro which is generally
expansion-safe on Darwin platforms when using Clang or GCC.

- - - - -
5e1ea20a by Marvin Scholz at 2022-06-15T09:53:17+00:00
access: dcp: use std::max

- - - - -
20213af9 by Marvin Scholz at 2022-06-15T09:53:17+00:00
qt: use std::max

- - - - -
ba746baa by Marvin Scholz at 2022-06-15T09:53:17+00:00
stream_out: blackmagic: use std::max

- - - - -
0db5f7db by Marvin Scholz at 2022-06-15T09:53:17+00:00
skins2: use std::min/max where applicable

- - - - -


10 changed files:

- modules/access/dcp/dcp.cpp
- modules/access/live555.cpp
- modules/codec/mft.cpp
- modules/demux/mkv/matroska_segment_parse.cpp
- modules/gui/macosx/windows/extensions/VLCExtensionsDialogProvider.m
- modules/gui/qt/dialogs/extensions/extensions.cpp
- modules/gui/skins2/controls/ctrl_tree.cpp
- modules/gui/skins2/src/ft2_font.cpp
- modules/meta_engine/taglib.cpp
- modules/stream_out/sdi/DBMSDIOutput.cpp


Changes:

=====================================
modules/access/dcp/dcp.cpp
=====================================
@@ -59,6 +59,7 @@
 #include <AS_DCP.h>
 
 #include <vector>
+#include <algorithm>
 
 #include "dcpparser.h"
 
@@ -818,7 +819,7 @@ static int Control( demux_t *p_demux, int query, va_list 
args )
             break;
 
         case DEMUX_GET_TIME:
-            *va_arg( args, vlc_tick_t * ) = __MAX(p_sys->i_pts, 0);
+            *va_arg( args, vlc_tick_t * ) = std::max<vlc_tick_t>(p_sys->i_pts, 
0);
             break;
 
         case DEMUX_SET_TIME:


=====================================
modules/access/live555.cpp
=====================================
@@ -32,6 +32,7 @@
 #endif
 
 #include <inttypes.h>
+#include <algorithm>
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
@@ -1483,12 +1484,12 @@ static int Demux( demux_t *p_demux )
             }
             if( p_sys->i_pcr != VLC_TICK_INVALID )
                 es_out_SetPCR( p_demux->out, VLC_TICK_0 +
-                               __MAX(0, p_sys->i_pcr - PCR_OFF) );
+                               std::max<vlc_tick_t>(0, p_sys->i_pcr - PCR_OFF) 
);
         }
         else if( p_sys->i_pcr == VLC_TICK_INVALID ||
                  i_minpcr > p_sys->i_pcr + PCR_OBS )
         {
-            p_sys->i_pcr = __MAX(0, i_minpcr - PCR_OFF);
+            p_sys->i_pcr = std::max<vlc_tick_t>(0, i_minpcr - PCR_OFF);
             if( p_sys->i_pcr != VLC_TICK_INVALID )
                 es_out_SetPCR( p_demux->out, VLC_TICK_0 + p_sys->i_pcr );
         }
@@ -1900,7 +1901,7 @@ static block_t *StreamParseAsf( demux_t *p_demux, 
live_track_t *tk,
          */
         unsigned i_payload;
         if( b_length )
-            i_payload = __MIN( i_length_offset, i_size - i_header_size);
+            i_payload = std::min( i_length_offset, i_size - i_header_size);
         else
             i_payload = i_size - i_header_size;
 


=====================================
modules/codec/mft.cpp
=====================================
@@ -50,6 +50,7 @@ extern "C" {
 #define _VIDEOINFOHEADER_
 #include <vlc_codecs.h>
 
+#include <algorithm>
 #include <atomic>
 #include <new>
 
@@ -610,7 +611,7 @@ static int AllocateInputSample(decoder_t *p_dec, DWORD 
stream_id, ComPtr<IMFSamp
     if (FAILED(hr))
         goto error;
 
-    allocation_size = __MAX(input_info.cbSize, size);
+    allocation_size = std::max<DWORD>(input_info.cbSize, size);
     hr = MFCreateMemoryBuffer(allocation_size, &input_media_buffer);
     if (FAILED(hr))
         goto error;


=====================================
modules/demux/mkv/matroska_segment_parse.cpp
=====================================
@@ -732,7 +732,7 @@ void matroska_segment_c::ParseTrackEntry( const 
KaxTrackEntry *m )
         E_CASE( KaxVideoFrameRate, vfps )
         {
             ONLY_FMT(VIDEO);
-            vars.tk->f_fps = __MAX( static_cast<float>( vfps ), 1 );
+            vars.tk->f_fps = std::max( static_cast<float>(vfps) , 1.0f );
             debug( vars, "fps=%f", vars.tk->f_fps );
         }
         E_CASE( KaxVideoColourSpace, colourspace )


=====================================
modules/gui/macosx/windows/extensions/VLCExtensionsDialogProvider.m
=====================================
@@ -427,8 +427,8 @@ static void extensionDialogCallback(extension_dialog_t 
*p_ext_dialog,
 
             int row = widget->i_row - 1;
             int col = widget->i_column - 1;
-            int hsp = __MAX(1, widget->i_horiz_span);
-            int vsp = __MAX(1, widget->i_vert_span);
+            int hsp = MAX(1, widget->i_horiz_span);
+            int vsp = MAX(1, widget->i_vert_span);
             if (row < 0) {
                 row = 4;
                 col = 0;


=====================================
modules/gui/qt/dialogs/extensions/extensions.cpp
=====================================
@@ -39,6 +39,8 @@
 #include <QKeyEvent>
 #include "widgets/native/customwidgets.hpp"
 
+#include <algorithm>
+
 static void DialogCallback( extension_dialog_t *p_ext_dialog,
                             void *p_data );
 
@@ -493,8 +495,8 @@ void ExtensionDialog::UpdateWidgets()
         }
         else if( col < 0 )
             col = layout->columnCount();
-        int hsp = __MAX( 1, p_widget->i_horiz_span );
-        int vsp = __MAX( 1, p_widget->i_vert_span );
+        int hsp = std::max( 1, p_widget->i_horiz_span );
+        int vsp = std::max( 1, p_widget->i_vert_span );
         if( !p_widget->p_sys_intf && !p_widget->b_kill )
         {
             widget = CreateWidget( p_widget );


=====================================
modules/gui/skins2/controls/ctrl_tree.cpp
=====================================
@@ -22,6 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 
USA.
  *****************************************************************************/
 
+#include <algorithm>
 #include <math.h>
 #include "../utils/var_bool.hpp"
 #include "ctrl_tree.hpp"
@@ -87,16 +88,16 @@ int CtrlTree::itemHeight()
     {
         if( m_pClosedBitmap )
         {
-            itemHeight = __MAX( m_pClosedBitmap->getHeight(), itemHeight );
+            itemHeight = std::max( m_pClosedBitmap->getHeight(), itemHeight );
         }
         if( m_pOpenBitmap )
         {
-            itemHeight = __MAX( m_pOpenBitmap->getHeight(), itemHeight );
+            itemHeight = std::max( m_pOpenBitmap->getHeight(), itemHeight );
         }
     }
     if( m_pItemBitmap )
     {
-        itemHeight = __MAX( m_pItemBitmap->getHeight(), itemHeight );
+        itemHeight = std::max( m_pItemBitmap->getHeight(), itemHeight );
     }
     itemHeight += LINE_INTERVAL;
     return itemHeight;
@@ -109,16 +110,16 @@ int CtrlTree::itemImageWidth()
     {
         if( m_pClosedBitmap )
         {
-            bitmapWidth = __MAX( m_pClosedBitmap->getWidth(), bitmapWidth );
+            bitmapWidth = std::max( m_pClosedBitmap->getWidth(), bitmapWidth );
         }
         if( m_pOpenBitmap )
         {
-            bitmapWidth = __MAX( m_pOpenBitmap->getWidth(), bitmapWidth );
+            bitmapWidth = std::max( m_pOpenBitmap->getWidth(), bitmapWidth );
         }
     }
     if( m_pItemBitmap )
     {
-        bitmapWidth = __MAX( m_pItemBitmap->getWidth(), bitmapWidth );
+        bitmapWidth = std::max( m_pItemBitmap->getWidth(), bitmapWidth );
     }
     return bitmapWidth + 2;
 }
@@ -599,7 +600,7 @@ void CtrlTree::makeImage()
         {
             if( it->isSelected() )
             {
-                int rectHeight = __MIN( i_itemHeight, height - yPos );
+                int rectHeight = std::min( i_itemHeight, height - yPos );
                 m_pImage->fillRect( 0, yPos, width, rectHeight, m_selColor );
             }
         }
@@ -612,7 +613,7 @@ void CtrlTree::makeImage()
         // Overwrite with alternate colors (bgColor1, bgColor2)
         for( int yPos = 0; yPos < height; yPos += i_itemHeight )
         {
-            int rectHeight = __MIN( i_itemHeight, height - yPos );
+            int rectHeight = std::min( i_itemHeight, height - yPos );
             if( it == m_rTree.end() )
                 m_pImage->fillRect( 0, yPos, width, rectHeight, bgColor );
             else
@@ -661,7 +662,7 @@ void CtrlTree::makeImage()
                 m_pImage->drawBitmap( *m_pCurBitmap, 0, 0,
                                       bitmapWidth * (depth - 1 ), yPos2,
                                       m_pCurBitmap->getWidth(),
-                                      __MIN( m_pCurBitmap->getHeight(),
+                                      std::min( m_pCurBitmap->getHeight(),
                                              height -  yPos2), true );
             }
             yPos += (i_itemHeight - pText->getHeight());
@@ -677,7 +678,7 @@ void CtrlTree::makeImage()
                 ySrc = - yPos;
                 yPos = 0;
             }
-            int lineHeight = __MIN( pText->getHeight() - ySrc, height - yPos );
+            int lineHeight = std::min( pText->getHeight() - ySrc, height - 
yPos );
             // Draw the text
             m_pImage->drawBitmap( *pText, 0, ySrc, bitmapWidth * depth, yPos,
                                   pText->getWidth(),
@@ -689,7 +690,7 @@ void CtrlTree::makeImage()
                 // Draw the underline bar below the text for drag&drop
                 m_pImage->fillRect(
                     bitmapWidth * (depth - 1 ), yPos - 2,
-                    bitmapWidth + pText->getWidth(), __MAX( lineHeight/5, 3 ),
+                    bitmapWidth + pText->getWidth(), std::max( lineHeight/5, 3 
),
                     m_selColor );
             }
             delete pText;


=====================================
modules/gui/skins2/src/ft2_font.cpp
=====================================
@@ -203,8 +203,8 @@ GenericBitmap *FT2Font::drawString( const UString &rString, 
uint32_t color,
 
         pos[n] = penX;
         width1 = penX + glyph.m_size.xMax - glyph.m_size.xMin;
-        yMin = __MIN( yMin, glyph.m_size.yMin );
-        yMax = __MAX( yMax, glyph.m_size.yMax );
+        yMin = std::min<int>( yMin, glyph.m_size.yMin );
+        yMax = std::max<int>( yMax, glyph.m_size.yMax );
 
         // Next position
         penX += glyph.m_advance;
@@ -254,11 +254,11 @@ GenericBitmap *FT2Font::drawString( const UString 
&rString, uint32_t color,
 #endif
 
     // Adjust the size for vertical padding
-    yMax = __MAX( yMax, m_ascender );
-    yMin = __MIN( yMin, m_descender );
+    yMax = std::max<int>( yMax, m_ascender );
+    yMin = std::min<int>( yMin, m_descender );
 
     // Create the bitmap
-    FT2Bitmap *pBmp = new FT2Bitmap( getIntf(), __MIN( width1, width2 ),
+    FT2Bitmap *pBmp = new FT2Bitmap( getIntf(), std::min( width1, width2 ),
                                      yMax - yMin );
 
     // Draw the glyphs on the bitmap


=====================================
modules/meta_engine/taglib.cpp
=====================================
@@ -643,7 +643,7 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, 
demux_meta_t* p_demux_meta, vlc_
              * but in our case it will be a '\0'
              * terminated string */
             char psz_ufid[64];
-            int max_size = __MIN( p_ufid->identifier().size(), 63);
+            int max_size = std::min<unsigned>( p_ufid->identifier().size(), 
63);
             strncpy( psz_ufid, p_ufid->identifier().data(), max_size );
             psz_ufid[max_size] = '\0';
             vlc_meta_SetTrackID( p_meta, psz_ufid );


=====================================
modules/stream_out/sdi/DBMSDIOutput.cpp
=====================================
@@ -22,6 +22,8 @@
 # include "config.h"
 #endif
 
+#include <algorithm>
+
 #include <vlc_common.h>
 #include <vlc_es.h>
 #include <vlc_picture.h>
@@ -709,7 +711,7 @@ int DBMSDIOutput::ProcessAudio(block_t *p_block)
         msg_Err(p_stream, "Failed to schedule audio sample:0x%" PRIHR, result);
     else
     {
-        lasttimestamp = __MAX(p_block->i_pts, lasttimestamp);
+        lasttimestamp = std::max(p_block->i_pts, lasttimestamp);
         if (sampleFrameCount != written)
             msg_Err(p_stream, "Written only %d samples out of %d", written, 
sampleFrameCount);
     }
@@ -828,7 +830,7 @@ int DBMSDIOutput::doProcessVideo(picture_t *picture, 
block_t *p_cc)
                 picture->date, result);
         goto error;
     }
-    lasttimestamp = __MAX(scheduleTime, lasttimestamp);
+    lasttimestamp = std::max(scheduleTime, lasttimestamp);
 
     if(!b_running) /* preroll */
     {



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/0e448365f6bc41439fd88f05b2e648b1a3d8f3b0...0db5f7dbac49a7278018eeb0fb2a448863745d22

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/0e448365f6bc41439fd88f05b2e648b1a3d8f3b0...0db5f7dbac49a7278018eeb0fb2a448863745d22
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to