[MPlayer-dev-eng] [PATCH] VCD support for Windows (except Win9x)

Gianluigi Tiesi mplayer at netfarm.it
Tue Feb 27 06:39:40 CET 2007


On Mon, Feb 26, 2007 at 03:22:47PM +0100, Reimar D?ffinger wrote:
> Hello,
> On Mon, Feb 26, 2007 at 09:49:10PM +0800, Zuxy Meng wrote:
> > 2007/2/26, Compn <tempn at twmi.rr.com>:
> > >On Mon, 26 Feb 2007 21:37:40 +0800,
> > >Zuxy Meng scribed:
> > >
> > >> +#ifdef WIN32
> > >> +  HANDLE hd;
> > >> +  char device[] = "\\\\.\\D:";
> > >> +#endif
> > >
> > >does this hardcode the device name?
> > >D: is not the dvd/cdrom drive on all systems.
> > 
> > D is only a stub here. The actual letter is filled by:
> > +  device[4] = p->device[0];
> 
> With any sane combination of compiler and operating system this should
> crash. String constants are supposed to be in readonly memory.
> 

char * are r/w, const char * "should be" r/o (but most compiler still
keep it as r/w).
msvc6 is able to have a #define MYSTRING "test1", with the string
reference r/w, obiviously vs2005 crashes as it should :)

with char device[] you are saying to the compiler to allocate
a char array sized as the length of the provided string + trailing \0
it's the same of char device[6] (or whatever) and then filling the
content.

Anyway a space or a ? or a x should be more readable

Bye
	
-- 
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/



More information about the MPlayer-dev-eng mailing list