[vlc-commits] [Git][videolan/vlc][master] 2 commits: libvlc: ensure that vlc_threadvar_set() is set on a proper thread var
Rémi Denis-Courmont (@Courmisch)
gitlab at videolan.org
Sat Mar 12 09:16:18 UTC 2022
Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC
Commits:
1c613896 by Steve Lhomme at 2022-03-12T09:00:25+00:00
libvlc: ensure that vlc_threadvar_set() is set on a proper thread var
If there's an error, the value we set is not actually set. Maybe an old value
is still in there or the variable is gone or something else is blocking.
We can't use the new value in the future and we don't know if the old value is
still in there.
- - - - -
4c73518d by Steve Lhomme at 2022-03-12T09:00:25+00:00
libvlc: don't make VLC error reporting public anymore
There's no reason for an app to mix its error messages with ours.
Applications that may have used this will fail to link so will quickly notice
the change.
- - - - -
3 changed files:
- include/vlc/libvlc.h
- lib/error.c
- lib/libvlc.sym
Changes:
=====================================
include/vlc/libvlc.h
=====================================
@@ -98,15 +98,6 @@ LIBVLC_API const char *libvlc_errmsg (void);
*/
LIBVLC_API void libvlc_clearerr (void);
-/**
- * Sets the LibVLC error status and message for the current thread.
- * Any previous error is overridden.
- * \param fmt the format string
- * \param ap the arguments
- * \return a nul terminated string in any case
- */
-LIBVLC_API const char *libvlc_vprinterr (const char *fmt, va_list ap);
-
/**
* Sets the LibVLC error status and message for the current thread.
* Any previous error is overridden.
@@ -114,7 +105,7 @@ LIBVLC_API const char *libvlc_vprinterr (const char *fmt, va_list ap);
* \param ... the arguments for the format string
* \return a nul terminated string in any case
*/
-LIBVLC_API const char *libvlc_printerr (const char *fmt, ...);
+const char *libvlc_printerr (const char *fmt, ...);
/**@} */
=====================================
lib/error.c
=====================================
@@ -89,15 +89,19 @@ const char *libvlc_errmsg (void)
void libvlc_clearerr (void)
{
free_error ();
- vlc_threadvar_set (context, NULL);
+ int ret = vlc_threadvar_set (context, NULL);
+ if(unlikely(ret != 0))
+ abort();
}
/**
* Sets the LibVLC error status and message for the current thread.
* Any previous error is overridden.
- * @return a nul terminated string (always)
+ * \param fmt the format string
+ * \param ap the arguments
+ * \return a nul terminated string in any case
*/
-const char *libvlc_vprinterr (const char *fmt, va_list ap)
+static const char *libvlc_vprinterr (const char *fmt, va_list ap)
{
char *msg;
@@ -106,7 +110,9 @@ const char *libvlc_vprinterr (const char *fmt, va_list ap)
msg = (char *)oom;
free_error ();
- vlc_threadvar_set (context, msg);
+ int ret = vlc_threadvar_set (context, msg);
+ if(unlikely(ret != 0))
+ abort();
return msg;
}
=====================================
lib/libvlc.sym
=====================================
@@ -1,7 +1,5 @@
libvlc_errmsg
libvlc_clearerr
-libvlc_printerr
-libvlc_vprinterr
libvlc_add_intf
libvlc_audio_equalizer_get_amp_at_index
libvlc_audio_equalizer_get_band_count
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8a88f1005cef73a066f8aafce1a66b95a2c7257b...4c73518d6efce66c2d05e94dd6f517f68a506d2e
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8a88f1005cef73a066f8aafce1a66b95a2c7257b...4c73518d6efce66c2d05e94dd6f517f68a506d2e
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list