Skip to content
Snippets Groups Projects

plugins: add type strictness to plugin descriptor macros

Merged Lyndon Brown requested to merge jnqnfe/vlc:plugins_tsm into master
  1. Feb 03, 2022
    • Lyndon Brown's avatar
      plugins: use helper to workaround missing c++ language feature support · 17604330
      Lyndon Brown authored and Rémi Denis-Courmont's avatar Rémi Denis-Courmont committed
      The previous commit made use of compound literals. MSVC was identified
      as not yet having support for compound literals in C++ though, which is
      considered a blocking problem to their use. This work around was
      suggested by Alexandre Janniaux.
      17604330
    • Lyndon Brown's avatar
      plugins: add type strictness to plugin descriptor macros · e8f6a595
      Lyndon Brown authored and Rémi Denis-Courmont's avatar Rémi Denis-Courmont committed
      I.e. check the type of the values provided, rather than just blindly
      casting, and thus allow mistakes to get caught with compilation errors.
      
      I once lost some hours tracking down the cause of a crash that this type
      strictness would have prevented.
      
      Note, now that `change_string_list()` and `change_integer_list()` use type
      strictness for the value and label arrays to help make sure they're the
      right types, we can more safely make use of `ARRAY_SIZE()` to more cleanly
      get the length.
      
      `set_callback[s]()` is excluded from this for obvious reasons.
      
      I've taken the opportunity to ditch remaining use of Hungarian notation
      and to fix a param name that should be singular rather than plural
      (psz_caps on `add_module[_list]()`.
      
      Re-implemented using compound literals upon excellent suggestion by
      Alexandre Janniaux.
      e8f6a595
Loading