[vlc-devel] [PATCH] Revert "android: util: remove redundant strncmp"

Rémi Denis-Courmont remi at remlab.net
Wed Feb 26 16:36:24 CET 2020


Hi,

Looks like replacing broken code with differently broken code to me :/

Le 26 février 2020 16:54:20 GMT+02:00, Romain Vimont <rom1v at videolabs.io> a écrit :
>This reverts commit 77aa424b72d8b6a1e7049c430c90303b9473ed7d.
>
>The replacement was not equivalent:
>
>    strncmp(a, b, strlen(b)) == 0  # test if a starts with b
>    strcmp(a, b) == 0              # test if a equals b
>
>In practice, it breaks OpenGL on Android when the vout_modules contains
>"gles2,none".
>---
> modules/video_output/android/utils.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/modules/video_output/android/utils.c
>b/modules/video_output/android/utils.c
>index 25ac24676f..2010f13976 100644
>--- a/modules/video_output/android/utils.c
>+++ b/modules/video_output/android/utils.c
>@@ -546,8 +546,8 @@ AWindowHandler_new(vout_window_t *wnd, awh_events_t
>*p_events)
>          */
>         char *vout_modules = var_InheritString(wnd, "vout");
>         if (vout_modules
>-         && (strcmp(vout_modules, "gles2") == 0
>-          || strcmp(vout_modules, "opengles2") == 0))
>+         && (strncmp(vout_modules, "gles2", sizeof("gles2") - 1) == 0
>+          || strncmp(vout_modules, "opengles2", sizeof("opengles2") -
>1) == 0))
>             p_awh->b_has_video_layout_listener = false;
>         free(vout_modules);
>     }
>-- 
>2.25.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200226/e2f598ae/attachment.html>


More information about the vlc-devel mailing list