[ENet-discuss] Invalid Conversion in protocol.c

Steve Williams stevewilliams at kromestudios.com
Tue Jun 26 14:45:49 PDT 2007


A typecast should do it.

commandNumber = (ENetProtocolCommand)outgoingCommand -> 
command.header.command;


Nick "Pablo" Pirollo wrote:
> I am compiling a project I recently finished and during the build 
> Dev-C++ is complaining about protocol.c converting from enet_uint8 to 
> ENetProtocolCommand on line 114.  For reference the function it is in 
> is reproduced below.
>  
> *the cuplrit is said to be this line:*
> commandNumber = outgoingCommand -> command.header.command;
>  
> *in this function:*
> ** 
> static ENetProtocolCommand
> enet_protocol_remove_sent_reliable_command (ENetPeer * peer, 
> enet_uint32 reliableSequenceNumber, enet_uint8 channelID)
> {
>     ENetOutgoingCommand * outgoingCommand;
>     ENetListIterator currentCommand;
>     ENetProtocolCommand commandNumber;
>  
>     for (currentCommand = enet_list_begin (& peer -> 
> sentReliableCommands);
>          currentCommand != enet_list_end (& peer -> sentReliableCommands);
>          currentCommand = enet_list_next (currentCommand))
>     {
>        outgoingCommand = (ENetOutgoingCommand *) currentCommand;
>        
>        if (outgoingCommand -> reliableSequenceNumber == 
> reliableSequenceNumber &&
>            outgoingCommand -> command.header.channelID == channelID)
>          break;
>     }
>  
>     if (currentCommand == enet_list_end (& peer -> sentReliableCommands))
>       return ENET_PROTOCOL_COMMAND_NONE;
>  
>     commandNumber = outgoingCommand -> command.header.command;
>  
>     enet_list_remove (& outgoingCommand -> outgoingCommandList);
>  
>     if (outgoingCommand -> packet != NULL)
>     {
>        peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
>  
>        -- outgoingCommand -> packet -> referenceCount;
>  
>        if (outgoingCommand -> packet -> referenceCount == 0)
>          enet_packet_destroy (outgoingCommand -> packet);
>     }
>  
>     enet_free (outgoingCommand);
>  
>     if (enet_list_empty (& peer -> sentReliableCommands))
>       return commandNumber;
>    
>     outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer 
> -> sentReliableCommands);
>    
>     peer -> nextTimeout = outgoingCommand -> sentTime + 
> outgoingCommand -> roundTripTimeout;
>  
>     return commandNumber;
> }
>  
>  
>  
> Thank you in advance for any help you can provide.  If further 
> information is needed, just let me know
>  
> Cheers,
> Nick
> ------------------------------------------------------------------------
>
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>   



This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.



More information about the ENet-discuss mailing list