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

Rich Felker dalias at aerifal.cx
Tue Feb 27 06:54:22 CET 2007


On Tue, Feb 27, 2007 at 06:39:40AM +0100, Gianluigi Tiesi wrote:
> 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).

Nonsense. char * declares a _pointer_ that's allowed to be used to
modify the data it points to, but the string literal "foo" that you
initialize this pointer to point to is not modifiable.
RTF-ISO/IEC-9899.

> msvc6 is able to have a #define MYSTRING "test1", with the string
> reference r/w, obiviously vs2005 crashes as it should :)

Eh? #define is irrelevant here.. What are you trying to say? I think I
didn't understand...

> 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.

Yes.

Rich



More information about the MPlayer-dev-eng mailing list