Re: [gnet-dev] gnet_io_channel_writen() clarification



I've finally investigated this.  This was delibrate.  If error is
G_IO_ERROR_NONE and bytes_read/written != n, then EOF was received.  The
programmer should check this.

David


On Thu, 2003-10-30 at 17:50, Scott Long wrote:
> However I've encountered a small inconsistency in the documentation 
> for gnet_io_channel_writen().
> 
> The comments in the source and the online documentation both say: "If 
> bytes_writtenp is set, the number of bytes written is stored in the 
> integer it points to."
> 
> To me, this implies that if bytes_writtenp is NULL (i.e. "not set"), 
> then the number of bytes written will not be stored.
> 
> However, in the source for this function (iochannel.c) there is the 
> test:
> 
> g_return_val_if_fail (bytes_writtenp, G_IO_ERROR_INVAL);
> 
> Thus this function cannot be used if bytes_writtenp == NULL, i.e., if 
> the caller doesn't care about the number of bytes written. This is 
> perfectly fine behavior; but the documentation and reality are not in 
> sync. If it is required that bytes_writtenp point somewhere valid, 
> then the perhaps the documentation should be updated to make it 
> clearer.
> 
> A similar inconsistency exists for the other function, 
> gnet_io_channel_readn().

-- 
David Helder - dhelder gizmolabs org - http://www.gizmolabs.org/~dhelder




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]