The Samba-Bugzilla – Attachment 1156 Details for
Bug 2609
snprintf("%llul\n", ULLONG_MAX) not correct
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fixes long long problems
snprintf.patch (text/plain), 1.99 KB, created by
Sean Young
on 2005-04-14 10:20:27 UTC
(
hide
)
Description:
Fixes long long problems
Filename:
MIME Type:
Creator:
Sean Young
Created:
2005-04-14 10:20:27 UTC
Size:
1.99 KB
patch
obsolete
>Index: snprintf.c >=================================================================== >--- snprintf.c (revision 6342) >+++ snprintf.c (working copy) >@@ -87,6 +87,9 @@ > * Martin Pool (mbp@samba.org) May 2003 > * Put in a prototype for dummy_snprintf() to quiet compiler warnings. > * >+ * Sean Young (sean@mess.org) April 2005 >+ * fmtint() had a too smaller buffer to format ULLONG_MAX. >+ * > * Move #endif to make sure VA_COPY, LDOUBLE, etc are defined even > * if the C library has some snprintf functions already. > **************************************************************/ >@@ -198,7 +201,7 @@ > static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, > char *value, int flags, int min, int max); > static void fmtint(char *buffer, size_t *currlen, size_t maxlen, >- long value, int base, int min, int max, int flags); >+ LLONG value, int base, int min, int max, int flags); > static void fmtfp(char *buffer, size_t *currlen, size_t maxlen, > LDOUBLE fvalue, int min, int max, int flags); > static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c); >@@ -505,11 +508,11 @@ > /* Have to handle DP_F_NUM (ie 0x and 0 alternates) */ > > static void fmtint(char *buffer, size_t *currlen, size_t maxlen, >- long value, int base, int min, int max, int flags) >+ LLONG value, int base, int min, int max, int flags) > { > int signvalue = 0; >- unsigned long uvalue; >- char convert[20]; >+ LLONG uvalue; >+ char convert[21]; > int place = 0; > int spadlen = 0; /* amount to space pad */ > int zpadlen = 0; /* amount to zero pad */ >@@ -537,10 +540,10 @@ > do { > convert[place++] = > (caps? "0123456789ABCDEF":"0123456789abcdef") >- [uvalue % (unsigned)base ]; >- uvalue = (uvalue / (unsigned)base ); >- } while(uvalue && (place < 20)); >- if (place == 20) place--; >+ [uvalue % (unsigned LLONG)base ]; >+ uvalue = (uvalue / (unsigned LLONG)base ); >+ } while(uvalue && (place < sizeof(convert))); >+ if (place == sizeof(convert)) place--; > convert[place] = 0; > > zpadlen = max - place;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 2609
: 1156