[Help-gnutls] Re: Recognising error codes with an unsigned size_t

Michael Weiser michael at weiser.dinsnail.net
Thu Nov 13 21:00:22 CET 2008


On Thu, Nov 13, 2008 at 09:33:48AM +0100, Simon Josefsson wrote:

> > I'm writing a small program using gnutls and its gnutls_record_{recv,send}()
> > interface. They return a size_t which holds either the number of bytes
> > transferred or a negative error code.
> No, they return a ssize_t.

> > seems just as wrong to me. Am I missing the obvious here?
> I think you are using the wrong type for the 'bytes' variable, use
> 'ssize_t' which is guaranteed to be signed.  Then the '< 0' comparison
> should work.

Cheers. That was the obvious I was missing. With ssize_t's it works
nicely now.
-- 
Michael





More information about the Gnutls-help mailing list