[vlc-commits] [Git][videolan/vlc][master] 4 commits: skins2: remove usage of undefined HAVE_LRINT

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Aug 30 07:31:43 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
8cc0f8be by Steve Lhomme at 2026-08-30T07:18:22+00:00
skins2: remove usage of undefined HAVE_LRINT

We don't test lrint() in configure.ac. It was not even the case [^1] when this
patch was added [^2].

[^2]: https://code.videolan.org/videolan/vlc/-/blob/ab6a48f97c4b23797c16055c0ed52068c3bfbc22/configure.ac
[^1]: https://code.videolan.org/videolan/vlc/-/commit/ab6a48f97c4b23797c16055c0ed52068c3bfbc22

- - - - -
a57e2355 by Steve Lhomme at 2026-08-30T07:18:22+00:00
skins2: remove Windows implementation of lrintf

It is part of Visual Studio 2015 [^1] and mingw-w64 maps it for MSVCRT 1.20 and implements it in msvcrt.dll [^2] and not in UCRT [^3].

[^1]: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/lrint-lrintf-lrintl-llrint-llrintf-llrintl?view=msvc-140
[^2]: https://github.com/mingw-w64/mingw-w64/blob/b0c3cce6a14965dbac1713e619c811a149044dcd/mingw-w64-crt/Makefile.am#L229
[^3]: https://github.com/mingw-w64/mingw-w64/commit/1de2c3cf20e0d020be0cecb51ce36b047847236e

- - - - -
212e2ca8 by Steve Lhomme at 2026-08-30T07:18:22+00:00
skins2: remove odd redefinition of lrint with MSVC

- - - - -
8009e341 by Steve Lhomme at 2026-08-30T07:18:22+00:00
build: assume lrintf() is always there

It's part of C99 and even available in MSVC.

We still link skins2 with libm as it may be needed to have the function.

- - - - -


8 changed files:

- config.h.meson
- configure.ac
- modules/gui/skins2/Makefile.am
- modules/gui/skins2/controls/ctrl_list.cpp
- modules/gui/skins2/controls/ctrl_tree.cpp
- modules/gui/skins2/meson.build
- modules/gui/skins2/utils/bezier.cpp
- modules/gui/skins2/utils/var_tree.cpp


Changes:

=====================================
config.h.meson
=====================================
@@ -230,9 +230,6 @@
 /* Define to 1 if you have the `localtime_r' function. */
 #mesondefine HAVE_LOCALTIME_R
 
-/* Define to 1 if you have the lrintf function */
-#mesondefine HAVE_LRINTF
-
 /* Define to 1 if the system has the type `max_align_t'. */
 #mesondefine HAVE_MAX_ALIGN_T
 


=====================================
configure.ac
=====================================
@@ -980,10 +980,6 @@ AC_CHECK_LIB([m], [cos], [
 ])
 AC_SUBST([LIBM])
 
-AC_CHECK_LIB([m], [lrintf], [
-  AC_DEFINE(HAVE_LRINTF, 1, [Define to 1 if you have the lrintf function])
-  VLC_ADD_LIBS([skins2],[-lm])
-])
 AC_CHECK_LIB([m], [nanf],
   AC_DEFINE(HAVE_NANF, 1, [Define to 1 if you have the NANF function])
 )


=====================================
modules/gui/skins2/Makefile.am
=====================================
@@ -284,7 +284,7 @@ libskins2_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_skins2)
 libskins2_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) -O2 -fno-rtti
 libskins2_plugin_la_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(CPPFLAGS_skins2) -O2 -fno-rtti
 libskins2_plugin_la_LIBTOOLFLAGS = --tag=CXX
-libskins2_plugin_la_LIBADD = $(LIBS_skins2)
+libskins2_plugin_la_LIBADD = $(LIBS_skins2) $(LIBM)
 
 if BUILD_SKINS
 gui_PLUGINS += libskins2_plugin.la


=====================================
modules/gui/skins2/controls/ctrl_list.cpp
=====================================
@@ -93,10 +93,6 @@ void CtrlList::onUpdate( Subject<VarPercent> &rPercent, void *arg  )
     int excessItems = m_rList.size() - maxItems;
     if( excessItems > 0 )
     {
-        // a simple (int)(...) causes rounding errors !
-#ifdef _MSC_VER
-#   define lrint (int)
-#endif
         firstItem = lrint( (1.0 - rVarPos.get()) * (double)excessItems );
     }
     if( m_lastPos != firstItem )
@@ -502,4 +498,3 @@ void CtrlList::makeImage()
 
     }
 }
-


=====================================
modules/gui/skins2/controls/ctrl_tree.cpp
=====================================
@@ -710,10 +710,6 @@ CtrlTree::Iterator CtrlTree::findItemAtPos( int pos )
 
 CtrlTree::Iterator CtrlTree::getFirstFromSlider()
 {
-    // a simple (int)(...) causes rounding errors !
-#ifdef _MSC_VER
-#       define lrint (int)
-#endif
     VarPercent &rVarPos = m_rTree.getPositionVar();
     double percentage = rVarPos.get();
 


=====================================
modules/gui/skins2/meson.build
=====================================
@@ -4,7 +4,7 @@ skins2_enabled = get_option('skins2') \
     .allowed()
 
 skins2_flags = []
-skins2_deps = [ freetype_dep ]
+skins2_deps = [ freetype_dep, m_lib ]
 
 if skins2_enabled
     fribidi_dep = dependency('fribidi', required: get_option('fribidi'))
@@ -20,11 +20,6 @@ if skins2_enabled
     endif
 endif
 
-if cc.has_function('lrintf', dependencies: [m_lib])
-    cdata.set('HAVE_LRINTF', 1)
-    skins2_deps += [ m_lib ]
-endif
-
 skins2_sources = files(
     'commands/async_queue.cpp',
     'commands/cmd_add_item.cpp',


=====================================
modules/gui/skins2/utils/bezier.cpp
=====================================
@@ -29,20 +29,6 @@
 #include "bezier.hpp"
 #include <math.h>
 
-// XXX should be in VLC core
-#ifndef HAVE_LRINTF
-#   ifdef HAVE_LRINT
-#       define lrintf( x ) (int)rint( x )
-#   elif defined _WIN32
-        __inline long int lrintf( float x )
-        {
-            int i;
-            _asm fld x __asm fistp i
-            return i;
-        }
-#   endif
-#endif
-
 Bezier::Bezier( intf_thread_t *p_intf, const std::vector<float> &rAbscissas,
                 const std::vector<float> &rOrdinates, Flag_t flag )
     : SkinObject( p_intf )
@@ -227,4 +213,3 @@ void Bezier::computePoint( float t, int &x, int &y ) const
     x = lrintf(xPos);
     y = lrintf(yPos);
 }
-


=====================================
modules/gui/skins2/utils/var_tree.cpp
=====================================
@@ -433,10 +433,6 @@ int VarTree::getIndex( const Iterator& item )
 
 VarTree::Iterator VarTree::getItemFromSlider()
 {
-    // a simple (int)(...) causes rounding errors !
-#ifdef _MSC_VER
-#       define lrint (int)
-#endif
     VarPercent &rVarPos = getPositionVar();
     double percentage = rVarPos.get();
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/706fe761898e111c97f917b4957e1809497432c1...8009e341c62419c0e4b125dafc0b06b5cbdacf71

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/706fe761898e111c97f917b4957e1809497432c1...8009e341c62419c0e4b125dafc0b06b5cbdacf71
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list