[MPlayer-dev-eng] [PATCH] make stream_info_t typedef const etc.

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Dec 1 17:51:58 CET 2007


Hello,
the easiest way to make the streaminfo structs properly const seems to
me to make the typedef const, like attached patch does.
That patch also removes the then useless consts from stream.c and makes
the auto_open_streams array itself const (to be applied in two or three
steps).
Do you agree with this?

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: stream/stream.c
===================================================================
--- stream/stream.c	(revision 25235)
+++ stream/stream.c	(working copy)
@@ -88,7 +88,7 @@
 extern stream_info_t stream_info_dvd;
 #endif
 
-static const stream_info_t* auto_open_streams[] = {
+static stream_info_t* const auto_open_streams[] = {
 #ifdef HAVE_VCD
   &stream_info_vcd,
 #endif
@@ -144,7 +144,7 @@
   NULL
 };
 
-stream_t* open_stream_plugin(const stream_info_t* sinfo,char* filename,int mode,
+stream_t* open_stream_plugin(stream_info_t* sinfo,char* filename,int mode,
 			     char** options, int* file_format, int* ret,
 			     char** redirected_url) {
   void* arg = NULL;
@@ -213,7 +213,7 @@
 
 stream_t* open_stream_full(char* filename,int mode, char** options, int* file_format) {
   int i,j,l,r;
-  const stream_info_t* sinfo;
+  stream_info_t* sinfo;
   stream_t* s;
   char *redirected_url = NULL;
 
Index: stream/stream.h
===================================================================
--- stream/stream.h	(revision 25235)
+++ stream/stream.h	(working copy)
@@ -67,7 +67,7 @@
 #endif
 
 struct stream_st;
-typedef struct stream_info_st {
+typedef const struct stream_info_st {
   const char *info;
   const char *name;
   const char *author;


More information about the MPlayer-dev-eng mailing list