View previous topic :: View next topic |
Author |
Message |
odeamus
Joined: 21 Feb 2006 Posts: 78 Location: Helsinki, Finland
|
Posted: Tue Nov 28, 2006 6:59 am Post subject: Cannot compile |
|
|
I tried compiling the demo, but ran to the following errors.
Code: |
Compiling...
source\terra\abstracts\platforms\windows.d(874): Error: shadowing declaration te
rra.abstracts.platforms.windows.platformWindowProc.window is deprecated
source\fusion\formats\_png.d(341): function std.stream.EndianStream.read called
with argument types:
(ubyte)
matches both:
std.stream.EndianStream.read(short)
and:
std.stream.EndianStream.read(dchar)
source\fusion\formats\_png.d(341): Error: cast(short)(this.bitDepth) is not an l
value
source\fusion\formats\_png.d(342): function std.stream.EndianStream.read called
with argument types:
(ubyte)
matches both:
std.stream.EndianStream.read(short)
and:
std.stream.EndianStream.read(dchar)
source\fusion\formats\_png.d(342): Error: cast(short)(this.colorType) is not an
lvalue
Press any key to continue . . .
|
Also when you use '-w' switch you get a lot more errors. Nothing big but something I'd clean up. For example there are switch-statements where there is a return-statement followed by a break-statement.
I'm using dmd 0.175 and build v3.04(2515).
O. |
|
Back to top |
|
|
trevorparscal
Joined: 25 May 2005 Posts: 73 Location: Bay Area, CA (USA)
|
Posted: Tue Nov 28, 2006 1:08 pm Post subject: |
|
|
Yep.. It's a problem with Fusion - and I have tried to get the std.stream patch accepted, but they insist it's not nessecary. So in order for me to use the endian stream class the way I need to for reading PNG's, you have to edit your stream.d file. The detail s are in the heading of fusion/formats/_png.d
Sorry about the hassle. Maybe somebody could look at this problem and figure a way to solve it without the need for that patch.
- Trevor |
|
Back to top |
|
|
odeamus
Joined: 21 Feb 2006 Posts: 78 Location: Helsinki, Finland
|
Posted: Tue Nov 28, 2006 1:24 pm Post subject: |
|
|
trevorparscal wrote: | Yep.. It's a problem with Fusion - and I have tried to get the std.stream patch accepted, but they insist it's not nessecary. So in order for me to use the endian stream class the way I need to for reading PNG's, you have to edit your stream.d file. The detail s are in the heading of fusion/formats/_png.d
Sorry about the hassle. Maybe somebody could look at this problem and figure a way to solve it without the need for that patch.
|
That sucks. :( I don't like to go messing in the stdlib, but it seems that I'll have to. Ah well.
O. |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Tue Nov 28, 2006 1:51 pm Post subject: |
|
|
Why not use an adapter class? Provided that this extension to EndianStream doesn't get used outside of png.d, you could even use the anonymous syntax:
Code: | //line 241: _png.d
EndianStream data = new class(rawdata, Endian.BigEndian) EndianStream{
public:
this(Stream source, Endian end = std.system.endian) { super(source,end); }
void read(out byte x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
void read(out ubyte x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
};
|
_________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
odeamus
Joined: 21 Feb 2006 Posts: 78 Location: Helsinki, Finland
|
Posted: Tue Nov 28, 2006 3:42 pm Post subject: |
|
|
pragma wrote: | Why not use an adapter class? Provided that this extension to EndianStream doesn't get used outside of png.d, you could even use the anonymous syntax:
Code: | //line 241: _png.d
EndianStream data = new class(rawdata, Endian.BigEndian) EndianStream{
public:
this(Stream source, Endian end = std.system.endian) { super(source,end); }
void read(out byte x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
void read(out ubyte x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
};
|
:) |
Yes this works on line 241, but it is not needed there, I believe. The problem location is line 333, the chunk. And putting that anonymous class there gives the following error:
Code: |
source\fusion\formats\_png.d:334: Error: constructor calls not allowed in loops or after labels
|
A private class for the _png.d module probably works though.
O. |
|
Back to top |
|
|
trevorparscal
Joined: 25 May 2005 Posts: 73 Location: Bay Area, CA (USA)
|
Posted: Thu Nov 30, 2006 1:46 pm Post subject: |
|
|
Hmm - I will mess with adding the adapting code into the _png.d file instead of expecting people to patch their std.stream file.
Thanks,
Trevor Parscal |
|
Back to top |
|
|
|