Date: Mon, 21 Apr 2003 05:00:23 -0700 (PDT) From: Stefan Farfeleder <stefan@fafoe.dyndns.org> To: freebsd-standards@FreeBSD.org Subject: Re: standards/51209: [PATCH] add a64l()/l64a/l64a_r functions (obtained from NetBSD) Message-ID: <200304211200.h3LC0NLt058710@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/51209; it has been noted by GNATS. From: Stefan Farfeleder <stefan@fafoe.dyndns.org> To: bug-followup@FreeBSD.org Cc: Subject: Re: standards/51209: [PATCH] add a64l()/l64a/l64a_r functions (obtained from NetBSD) Date: Mon, 21 Apr 2003 13:52:01 +0200 On Mon, Apr 21, 2003 at 02:59:46PM +0400, Sergey A.Osokin wrote: > +int > +l64a_r (long value, char *buffer, int buflen) > +{ > + char *s = buffer; > + int digit; > + unsigned long v = value; ^^^^^^^^^^^^^ Shouldn't this be 'uint32_t'? According to SUSv3: "If the type long contains more than 32 bits, only the low-order 32 bits shall be used for these operations." > + > + _DIAGASSERT(buffer != NULL); > + > + if (value == 0UL) > + goto out; > + > + for (; v != 0 && buflen > 1; s++, buflen--) { > + digit = (int)(v & 0x3f); > + > + if (digit < 2) > + *s = digit + '.'; > + else if (digit < 12) > + *s = digit + '0' - 2; > + else if (digit < 38) > + *s = digit + 'A' - 12; > + else > + *s = digit + 'a' - 38; > + v >>= 6; > + } > + > +out: > + *s = '\0'; > + > + return (v == 0UL ? 0 : -1); > +}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304211200.h3LC0NLt058710>