FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Cannot compile

 
Post new topic   Reply to topic     Forum Index -> Element
View previous topic :: View next topic  
Author Message
odeamus



Joined: 21 Feb 2006
Posts: 78
Location: Helsinki, Finland

PostPosted: Tue Nov 28, 2006 6:59 am    Post subject: Cannot compile Reply with quote

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
View user's profile Send private message
trevorparscal



Joined: 25 May 2005
Posts: 73
Location: Bay Area, CA (USA)

PostPosted: Tue Nov 28, 2006 1:08 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
odeamus



Joined: 21 Feb 2006
Posts: 78
Location: Helsinki, Finland

PostPosted: Tue Nov 28, 2006 1:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Tue Nov 28, 2006 1:51 pm    Post subject: Reply with quote

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); }
};


Smile
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
odeamus



Joined: 21 Feb 2006
Posts: 78
Location: Helsinki, Finland

PostPosted: Tue Nov 28, 2006 3:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
trevorparscal



Joined: 25 May 2005
Posts: 73
Location: Bay Area, CA (USA)

PostPosted: Thu Nov 30, 2006 1:46 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Element All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group