[vlc-devel] [PATCH 2/3] core: respect ODR for services_discovery_sys_t

Romain Vimont rom1v at videolabs.io
Sun Apr 22 17:03:37 CEST 2018


See #17078 and #18033
---
 include/vlc_common.h                   |  1 -
 include/vlc_services_discovery.h       |  2 +-
 modules/access/dsm/sd.c                |  4 +--
 modules/lua/services_discovery.c       |  4 +--
 modules/services_discovery/avahi.c     |  4 +--
 modules/services_discovery/mediadirs.c |  4 +--
 modules/services_discovery/microdns.c  | 25 +++++++++------
 modules/services_discovery/mtp.c       | 43 ++++++++++++++------------
 modules/services_discovery/podcast.c   | 16 +++++-----
 modules/services_discovery/pulse.c     |  4 +--
 modules/services_discovery/sap.c       | 37 ++++++++++++----------
 modules/services_discovery/udev.c      |  4 +--
 modules/services_discovery/upnp.cpp    |  6 ++--
 modules/services_discovery/xcb_apps.c  |  4 +--
 14 files changed, 86 insertions(+), 72 deletions(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 5669e1f0d6..d58a3c073b 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -338,7 +338,6 @@ typedef struct date_t date_t;
 typedef struct playlist_t playlist_t;
 typedef struct playlist_item_t playlist_item_t;
 typedef struct services_discovery_t services_discovery_t;
-typedef struct services_discovery_sys_t services_discovery_sys_t;
 typedef struct vlc_renderer_discovery_t vlc_renderer_discovery_t;
 typedef struct vlc_renderer_item_t vlc_renderer_item_t;
 
diff --git a/include/vlc_services_discovery.h b/include/vlc_services_discovery.h
index 1011d6b630..682a3654cf 100644
--- a/include/vlc_services_discovery.h
+++ b/include/vlc_services_discovery.h
@@ -66,7 +66,7 @@ struct services_discovery_t
      */
     int ( *pf_control ) ( services_discovery_t *, int, va_list );
 
-    services_discovery_sys_t *p_sys;          /**< Custom private data */
+    void *p_sys;                              /**< Custom private data */
 
     struct services_discovery_owner_t owner; /**< Owner callbacks */
 };
diff --git a/modules/access/dsm/sd.c b/modules/access/dsm/sd.c
index 276e01fe9a..2c006b8fda 100644
--- a/modules/access/dsm/sd.c
+++ b/modules/access/dsm/sd.c
@@ -51,11 +51,11 @@ struct entry_item
     input_item_t *p_item;
 };
 
-struct services_discovery_sys_t
+typedef struct
 {
     netbios_ns      *p_ns;
     vlc_array_t      entry_item_list;
-};
+} services_discovery_sys_t;
 
 static void entry_item_append( services_discovery_t *p_sd,
                                netbios_ns_entry *p_entry,
diff --git a/modules/lua/services_discovery.c b/modules/lua/services_discovery.c
index 6d847dc212..2bbffe203e 100644
--- a/modules/lua/services_discovery.c
+++ b/modules/lua/services_discovery.c
@@ -135,7 +135,7 @@ static const char * const ppsz_sd_options[] = { "sd", NULL };
 /*****************************************************************************
  * Local structures
  *****************************************************************************/
-struct services_discovery_sys_t
+typedef struct
 {
     lua_State *L;
     char *psz_filename;
@@ -146,7 +146,7 @@ struct services_discovery_sys_t
 
     char **ppsz_query;
     int i_query;
-};
+} services_discovery_sys_t;
 static const luaL_Reg p_reg[] = { { NULL, NULL } };
 
 /*****************************************************************************
diff --git a/modules/services_discovery/avahi.c b/modules/services_discovery/avahi.c
index dbfac40809..956835dbc1 100644
--- a/modules/services_discovery/avahi.c
+++ b/modules/services_discovery/avahi.c
@@ -67,12 +67,12 @@ vlc_module_end ()
  * Local structures
  *****************************************************************************/
 
-struct services_discovery_sys_t
+typedef struct
 {
     AvahiThreadedPoll   *poll;
     AvahiClient         *client;
     vlc_dictionary_t    services_name_to_input_item;
-};
+} services_discovery_sys_t;
 
 static const struct
 {
diff --git a/modules/services_discovery/mediadirs.c b/modules/services_discovery/mediadirs.c
index 3b681c9661..65ddb129c8 100644
--- a/modules/services_discovery/mediadirs.c
+++ b/modules/services_discovery/mediadirs.c
@@ -104,14 +104,14 @@ static int onNewFileAdded( vlc_object_t*, char const *,
 static enum type_e fileType( services_discovery_t *p_sd, const char* psz_file );
 static void formatSnapshotItem( input_item_t* );
 
-struct services_discovery_sys_t
+typedef struct
 {
     vlc_thread_t thread;
     enum type_e i_type;
 
     char* psz_dir[2];
     const char* psz_var;
-};
+} services_discovery_sys_t;
 
 /*****************************************************************************
  * Open: initialize module
diff --git a/modules/services_discovery/microdns.c b/modules/services_discovery/microdns.c
index 8dc28a26a5..97f250e65b 100644
--- a/modules/services_discovery/microdns.c
+++ b/modules/services_discovery/microdns.c
@@ -97,10 +97,10 @@ struct discovery_sys
     vlc_array_t         items;
 };
 
-struct services_discovery_sys_t
+typedef struct
 {
     struct discovery_sys s;
-};
+} services_discovery_sys_t;
 
 struct vlc_renderer_discovery_sys
 {
@@ -391,7 +391,8 @@ static void
 new_entries_sd_cb( void *p_this, int i_status, const struct rr_entry *p_entries )
 {
     services_discovery_t *p_sd = (services_discovery_t *)p_this;
-    struct discovery_sys *p_sys = &p_sd->p_sys->s;
+    services_discovery_sys_t *p_sdsys = p_sd->p_sys;
+    struct discovery_sys *p_sys = &p_sdsys->s;
     if( i_status < 0 )
     {
         print_error( VLC_OBJECT( p_sd ), "entry callback", i_status );
@@ -434,7 +435,8 @@ static bool
 stop_sd_cb( void *p_this )
 {
     services_discovery_t *p_sd = ( services_discovery_t* )p_this;
-    struct discovery_sys *p_sys = &p_sd->p_sys->s;
+    services_discovery_sys_t *p_sdsys = p_sd->p_sys;
+    struct discovery_sys *p_sys = &p_sdsys->s;
 
     if( atomic_load( &p_sys->stop ) )
         return true;
@@ -449,7 +451,8 @@ static void *
 RunSD( void *p_this )
 {
     services_discovery_t *p_sd = ( services_discovery_t* )p_this;
-    struct discovery_sys *p_sys = &p_sd->p_sys->s;
+    services_discovery_sys_t *p_sdsys = p_sd->p_sys;
+    struct discovery_sys *p_sys = &p_sdsys->s;
 
     int i_status = mdns_listen( p_sys->p_microdns,
                                 p_sys->ppsz_service_names,
@@ -637,23 +640,25 @@ OpenSD( vlc_object_t *p_obj )
 {
     services_discovery_t *p_sd = (services_discovery_t *)p_obj;
 
-    p_sd->p_sys = calloc( 1, sizeof(services_discovery_sys_t) );
-    if( !p_sd->p_sys )
+    services_discovery_sys_t *p_sys = calloc( 1, sizeof(services_discovery_sys_t) );
+    if( !p_sys )
         return VLC_ENOMEM;
+    p_sd->p_sys = p_sys;
 
     p_sd->description = _("mDNS Network Discovery");
     config_ChainParse( p_sd, CFG_PREFIX, ppsz_options, p_sd->p_cfg );
 
-    return OpenCommon( p_obj, &p_sd->p_sys->s, false );
+    return OpenCommon( p_obj, &p_sys->s, false );
 }
 
 static void
 CloseSD( vlc_object_t *p_this )
 {
     services_discovery_t *p_sd = (services_discovery_t *) p_this;
+    services_discovery_sys_t *p_sys = p_sd->p_sys;
 
-    CleanCommon( &p_sd->p_sys->s );
-    free( p_sd->p_sys );
+    CleanCommon( &p_sys->s );
+    free( p_sys );
 }
 
 static int
diff --git a/modules/services_discovery/mtp.c b/modules/services_discovery/mtp.c
index b64f84e3e2..e56ea3f7ae 100644
--- a/modules/services_discovery/mtp.c
+++ b/modules/services_discovery/mtp.c
@@ -67,7 +67,7 @@ static int CountTracks( uint64_t const, uint64_t const, void const * const );
  * Local structures
  *****************************************************************************/
 
-struct services_discovery_sys_t
+typedef struct
 {
     int i_tracks_num;
     input_item_t **pp_items;
@@ -77,7 +77,7 @@ struct services_discovery_sys_t
     uint8_t i_dev;
     uint16_t i_product_id;
     vlc_thread_t thread;
-};
+} services_discovery_sys_t;
 
 static vlc_mutex_t mtp_lock = VLC_STATIC_MUTEX;
 static bool b_mtp_initialized = false;
@@ -118,11 +118,12 @@ static int Open( vlc_object_t *p_this )
 static void Close( vlc_object_t *p_this )
 {
     services_discovery_t *p_sd = ( services_discovery_t * )p_this;
+    services_discovery_sys_t *p_sys = p_sd->p_sys;
 
-    free( p_sd->p_sys->psz_name );
-    vlc_cancel( p_sd->p_sys->thread );
-    vlc_join( p_sd->p_sys->thread, NULL );
-    free( p_sd->p_sys );
+    free( p_sys->psz_name );
+    vlc_cancel( p_sys->thread );
+    vlc_join( p_sys->thread, NULL );
+    free( p_sys );
 }
 
 /*****************************************************************************
@@ -180,6 +181,7 @@ static void *Run( void *data )
 static int AddDevice( services_discovery_t *p_sd,
                       LIBMTP_raw_device_t *p_raw_device )
 {
+    services_discovery_sys_t *p_sys = p_sd->p_sys;
     char *psz_name = NULL;
     LIBMTP_mtpdevice_t *p_device;
     LIBMTP_track_t *p_track, *p_tmp;
@@ -191,24 +193,24 @@ static int AddDevice( services_discovery_t *p_sd,
                 if( !( psz_name = strdup( N_( "MTP Device" ) ) ) )
                     return VLC_ENOMEM;
         msg_Info( p_sd, "Found device: %s", psz_name );
-        p_sd->p_sys->i_bus = p_raw_device->bus_location;
-        p_sd->p_sys->i_dev = p_raw_device->devnum;
-        p_sd->p_sys->i_product_id = p_raw_device->device_entry.product_id;
+        p_sys->i_bus = p_raw_device->bus_location;
+        p_sys->i_dev = p_raw_device->devnum;
+        p_sys->i_product_id = p_raw_device->device_entry.product_id;
         if( ( p_track = LIBMTP_Get_Tracklisting_With_Callback( p_device,
                             CountTracks, p_sd ) ) == NULL )
         {
             msg_Warn( p_sd, "No tracks on the device" );
-            p_sd->p_sys->pp_items = NULL;
+            p_sys->pp_items = NULL;
         }
         else
         {
-            if( !( p_sd->p_sys->pp_items = calloc( p_sd->p_sys->i_tracks_num,
+            if( !( p_sys->pp_items = calloc( p_sys->i_tracks_num,
                                                    sizeof( input_item_t * ) ) ) )
             {
                 free( psz_name );
                 return VLC_ENOMEM;
             }
-            p_sd->p_sys->i_count = 0;
+            p_sys->i_count = 0;
             while( p_track != NULL )
             {
                 msg_Dbg( p_sd, "Track found: %s - %s", p_track->artist,
@@ -219,7 +221,7 @@ static int AddDevice( services_discovery_t *p_sd,
                 LIBMTP_destroy_track_t( p_tmp );
             }
         }
-        p_sd->p_sys->psz_name = psz_name;
+        p_sys->psz_name = psz_name;
         LIBMTP_Release_Device( p_device );
         return VLC_SUCCESS;
     }
@@ -232,14 +234,15 @@ static int AddDevice( services_discovery_t *p_sd,
 
 static void AddTrack( services_discovery_t *p_sd, LIBMTP_track_t *p_track )
 {
+    services_discovery_sys_t *p_sys = p_sd->p_sys;
     input_item_t *p_input;
     char *psz_string;
     char *extension;
 
     extension = rindex( p_track->filename, '.' );
     if( asprintf( &psz_string, "mtp://%"PRIu32":%"PRIu8":%"PRIu16":%d%s",
-                  p_sd->p_sys->i_bus, p_sd->p_sys->i_dev,
-                  p_sd->p_sys->i_product_id, p_track->item_id,
+                  p_sys->i_bus, p_sys->i_dev,
+                  p_sys->i_product_id, p_track->item_id,
                   extension ) == -1 )
     {
         msg_Err( p_sd, "Error adding %s, skipping it", p_track->filename );
@@ -269,16 +272,17 @@ static void AddTrack( services_discovery_t *p_sd, LIBMTP_track_t *p_track )
     input_item_SetDate( p_input, p_track->date );
     p_input->i_duration = p_track->duration * INT64_C(1000);
     services_discovery_AddItem( p_sd, p_input );
-    p_sd->p_sys->pp_items[p_sd->p_sys->i_count++] = p_input;
+    p_sys->pp_items[p_sys->i_count++] = p_input;
 }
 
 static void CloseDevice( services_discovery_t *p_sd )
 {
-    input_item_t **pp_items = p_sd->p_sys->pp_items;
+    services_discovery_sys_t *p_sys = p_sd->p_sys;
+    input_item_t **pp_items = p_sys->pp_items;
 
     if( pp_items != NULL )
     {
-        for( int i_i = 0; i_i < p_sd->p_sys->i_count; i_i++ )
+        for( int i_i = 0; i_i < p_sys->i_count; i_i++ )
         {
             if( pp_items[i_i] != NULL )
             {
@@ -295,6 +299,7 @@ static int CountTracks( uint64_t const sent, uint64_t const total,
 {
     VLC_UNUSED( sent );
     services_discovery_t *p_sd = (services_discovery_t *)data;
-    p_sd->p_sys->i_tracks_num = total;
+    services_discovery_sys_t *p_sys = p_sd->p_sys;
+    p_sys->i_tracks_num = total;
     return 0;
 }
diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c
index a8837e1f46..327b58ca3a 100644
--- a/modules/services_discovery/podcast.c
+++ b/modules/services_discovery/podcast.c
@@ -83,7 +83,7 @@ enum {
   UPDATE_REQUEST
 }; /* FIXME Temporary. Updating by compound urls string to be removed later. */
 
-struct services_discovery_sys_t
+typedef struct
 {
     /* playlist node */
     input_thread_t **pp_input;
@@ -102,7 +102,7 @@ struct services_discovery_sys_t
     bool b_savedurls_loaded;
     char *psz_request;
     int update_type;
-};
+} services_discovery_sys_t;
 
 /*****************************************************************************
  * Local prototypes
@@ -184,16 +184,16 @@ static void Close( vlc_object_t *p_this )
 
     for( int i = 0; i < p_sys->i_input; i++ )
     {
-        input_thread_t *p_input = p_sd->p_sys->pp_input[i];
+        input_thread_t *p_input = p_sys->pp_input[i];
         if( !p_input )
             continue;
 
         input_Stop( p_input );
         input_Close( p_input );
 
-        p_sd->p_sys->pp_input[i] = NULL;
+        p_sys->pp_input[i] = NULL;
     }
-    free( p_sd->p_sys->pp_input );
+    free( p_sys->pp_input );
 
     for( int i = 0; i < p_sys->i_urls; i++ )
          free( p_sys->ppsz_urls[i] );
@@ -237,9 +237,9 @@ noreturn static void *Run( void *data )
 
         p_sys->b_update = false;
 
-        for( int i = 0; i < p_sd->p_sys->i_input; i++ )
+        for( int i = 0; i < p_sys->i_input; i++ )
         {
-            input_thread_t *p_input = p_sd->p_sys->pp_input[i];
+            input_thread_t *p_input = p_sys->pp_input[i];
             int state = var_GetInteger( p_input, "state" );
 
             if( state == END_S || state == ERROR_S )
@@ -247,7 +247,7 @@ noreturn static void *Run( void *data )
                 input_Stop( p_input );
                 input_Close( p_input );
 
-                p_sd->p_sys->pp_input[i] = NULL;
+                p_sys->pp_input[i] = NULL;
                 TAB_ERASE(p_sys->i_input, p_sys->pp_input, i);
                 i--;
             }
diff --git a/modules/services_discovery/pulse.c b/modules/services_discovery/pulse.c
index 8797664f2e..839fb6a6fd 100644
--- a/modules/services_discovery/pulse.c
+++ b/modules/services_discovery/pulse.c
@@ -52,12 +52,12 @@ vlc_module_begin ()
     VLC_SD_PROBE_SUBMODULE
 vlc_module_end ()
 
-struct services_discovery_sys_t
+typedef struct
 {
     void                 *root;
     pa_context           *context;
     pa_threaded_mainloop *mainloop;
-};
+} services_discovery_sys_t;
 
 static void SourceCallback(pa_context *, const pa_source_info *, int, void *);
 static void ContextCallback(pa_context *, pa_subscription_event_type_t,
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index ae7c1d7a01..df07447297 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -211,7 +211,7 @@ struct sap_announce_t
     input_item_t * p_item;
 };
 
-struct services_discovery_sys_t
+typedef struct
 {
     vlc_thread_t thread;
 
@@ -228,7 +228,7 @@ struct services_discovery_sys_t
     bool  b_parse;
 
     int i_timeout;
-};
+} services_discovery_sys_t;
 
 typedef struct
 {
@@ -458,6 +458,7 @@ static void CloseDemux( vlc_object_t *p_this )
 static void *Run( void *data )
 {
     services_discovery_t *p_sd = data;
+    services_discovery_sys_t *p_sys = p_sd->p_sys;
     char *psz_addr;
     int timeout = -1;
     int canc = vlc_savecancel ();
@@ -524,7 +525,7 @@ static void *Run( void *data )
         InitSocket( p_sd, psz_addr, SAP_PORT );
     free( psz_addr );
 
-    if( p_sd->p_sys->i_fd == 0 )
+    if( p_sys->i_fd == 0 )
     {
         msg_Err( p_sd, "unable to listen on any address" );
         return NULL;
@@ -534,12 +535,12 @@ static void *Run( void *data )
     for (;;)
     {
         vlc_restorecancel (canc);
-        unsigned n = p_sd->p_sys->i_fd;
+        unsigned n = p_sys->i_fd;
         struct pollfd ufd[n];
 
         for (unsigned i = 0; i < n; i++)
         {
-            ufd[i].fd = p_sd->p_sys->pi_fd[i];
+            ufd[i].fd = p_sys->pi_fd[i];
             ufd[i].events = POLLIN;
             ufd[i].revents = 0;
         }
@@ -576,10 +577,10 @@ static void *Run( void *data )
         timeout = 1000 * 60 * 60;
 
         /* Check for items that need deletion */
-        for( int i = 0; i < p_sd->p_sys->i_announces; i++ )
+        for( int i = 0; i < p_sys->i_announces; i++ )
         {
-            mtime_t i_timeout = ( mtime_t ) 1000000 * p_sd->p_sys->i_timeout;
-            sap_announce_t * p_announce = p_sd->p_sys->pp_announces[i];
+            mtime_t i_timeout = ( mtime_t ) 1000000 * p_sys->i_timeout;
+            sap_announce_t * p_announce = p_sys->pp_announces[i];
             mtime_t i_last_period = now - p_announce->i_last;
 
             /* Remove the announcement, if the last announcement was 1 hour ago
@@ -599,7 +600,7 @@ static void *Run( void *data )
             }
         }
 
-        if( !p_sd->p_sys->i_announces )
+        if( !p_sys->i_announces )
             timeout = -1; /* We can safely poll indefinitely. */
         else if( timeout < 200 )
             timeout = 200; /* Don't wakeup too fast. */
@@ -663,6 +664,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 static int ParseSAP( services_discovery_t *p_sd, const uint8_t *buf,
                      size_t len )
 {
+    services_discovery_sys_t *p_sys = p_sd->p_sys;
     const char          *psz_sdp;
     const uint8_t *end = buf + len;
     sdp_t               *p_sdp;
@@ -693,7 +695,7 @@ static int ParseSAP( services_discovery_t *p_sd, const uint8_t *buf,
 
     uint16_t i_hash = U16_AT (buf + 2);
 
-    if( p_sd->p_sys->b_strict && i_hash == 0 )
+    if( p_sys->b_strict && i_hash == 0 )
     {
         msg_Dbg( p_sd, "strict mode, discarding announce with null id hash");
         return VLC_EGENERIC;
@@ -774,7 +776,7 @@ static int ParseSAP( services_discovery_t *p_sd, const uint8_t *buf,
         p_sdp->psz_uri = NULL;
 
     /* Multi-media or no-parse -> pass to LIVE.COM */
-    if( !IsWellKnownPayload( p_sdp->i_media_type ) || !p_sd->p_sys->b_parse )
+    if( !IsWellKnownPayload( p_sdp->i_media_type ) || !p_sys->b_parse )
     {
         free( p_sdp->psz_uri );
         if (asprintf( &p_sdp->psz_uri, "sdp://%s", p_sdp->psz_sdp ) == -1)
@@ -787,9 +789,9 @@ static int ParseSAP( services_discovery_t *p_sd, const uint8_t *buf,
         goto error;
     }
 
-    for( int i = 0 ; i< p_sd->p_sys->i_announces ; i++ )
+    for( int i = 0 ; i < p_sys->i_announces ; i++ )
     {
-        sap_announce_t * p_announce = p_sd->p_sys->pp_announces[i];
+        sap_announce_t * p_announce = p_sys->pp_announces[i];
         /* FIXME: slow */
         if( ( !i_hash && IsSameSession( p_announce->p_sdp, p_sdp ) )
             || ( i_hash && p_announce->i_hash == i_hash
@@ -800,7 +802,7 @@ static int ParseSAP( services_discovery_t *p_sd, const uint8_t *buf,
              * Instead we cleverly implement Implicit Announcement removal.
              *
              * if( b_need_delete )
-             *    RemoveAnnounce( p_sd, p_sd->p_sys->pp_announces[i]);
+             *    RemoveAnnounce( p_sd, p_sys->pp_announces[i]);
              * else
              */
 
@@ -1481,7 +1483,8 @@ static int InitSocket( services_discovery_t *p_sd, const char *psz_address,
         return VLC_EGENERIC;
 
     shutdown( i_fd, SHUT_WR );
-    TAB_APPEND(p_sd->p_sys->i_fd, p_sd->p_sys->pi_fd, i_fd);
+    services_discovery_sys_t *p_sys = p_sd->p_sys;
+    TAB_APPEND(p_sys->i_fd, p_sys->pi_fd, i_fd);
     return VLC_SUCCESS;
 }
 
@@ -1572,8 +1575,8 @@ static int RemoveAnnounce( services_discovery_t *p_sd,
         p_announce->p_item = NULL;
     }
 
-    TAB_REMOVE(p_sd->p_sys->i_announces, p_sd->p_sys->pp_announces,
-               p_announce);
+    services_discovery_sys_t *p_sys = p_sd->p_sys;
+    TAB_REMOVE(p_sys->i_announces, p_sys->pp_announces, p_announce);
     free( p_announce );
 
     return VLC_SUCCESS;
diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
index ae5c4c85ef..65cf7e267b 100644
--- a/modules/services_discovery/udev.c
+++ b/modules/services_discovery/udev.c
@@ -125,13 +125,13 @@ struct subsys
     int item_type;
 };
 
-struct services_discovery_sys_t
+typedef struct
 {
     const struct subsys *subsys;
     struct udev_monitor *monitor;
     vlc_thread_t         thread;
     void                *root;
-};
+} services_discovery_sys_t;
 
 /**
  * Compares two devices (to support binary search).
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index a4c367dbce..863421141f 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -78,6 +78,7 @@ static const char *const ppsz_readible_satip_channel_lists[] = {
     "Astra 19.2°E", "Astra 28.2°E", "Astra 23.5°E", N_("Master List"), N_("Server List"), N_("Custom List")
 };
 
+namespace { // for ODR
 /*
  * VLC handle
  */
@@ -86,6 +87,7 @@ struct services_discovery_sys_t
     UpnpInstanceWrapper* p_upnp;
     vlc_thread_t         thread;
 };
+} // namespace
 
 struct access_sys_t
 {
@@ -223,7 +225,7 @@ static void *
 SearchThread( void *p_data )
 {
     services_discovery_t *p_sd = ( services_discovery_t* )p_data;
-    services_discovery_sys_t *p_sys  = p_sd->p_sys;
+    services_discovery_sys_t *p_sys = reinterpret_cast<services_discovery_sys_t *>( p_sd->p_sys );
 
     /* Search for media servers */
     int i_res = UpnpSearchAsync( p_sys->p_upnp->handle(), 5,
@@ -283,7 +285,7 @@ static int Open( vlc_object_t *p_this )
 static void Close( vlc_object_t *p_this )
 {
     services_discovery_t *p_sd = ( services_discovery_t* )p_this;
-    services_discovery_sys_t *p_sys = p_sd->p_sys;
+    services_discovery_sys_t *p_sys = reinterpret_cast<services_discovery_sys_t *>( p_sd->p_sys );
 
     vlc_join( p_sys->thread, NULL );
     p_sys->p_upnp->release( true );
diff --git a/modules/services_discovery/xcb_apps.c b/modules/services_discovery/xcb_apps.c
index 57f84f20c2..659df39384 100644
--- a/modules/services_discovery/xcb_apps.c
+++ b/modules/services_discovery/xcb_apps.c
@@ -57,7 +57,7 @@ vlc_module_begin ()
     VLC_SD_PROBE_SUBMODULE
 vlc_module_end ()
 
-struct services_discovery_sys_t
+typedef struct
 {
     xcb_connection_t *conn;
     vlc_thread_t      thread;
@@ -66,7 +66,7 @@ struct services_discovery_sys_t
     xcb_window_t      root_window;
     void             *apps;
     input_item_t     *apps_root;
-};
+} services_discovery_sys_t;
 
 static void *Run (void *);
 static void UpdateApps (services_discovery_t *);
-- 
2.17.0



More information about the vlc-devel mailing list