Article View: gnu.g++.bug
Article #254sign bug in stream.C: itoa
From: Doug Moore
Date: Tue, 14 Apr 1992 02:24
Date: Tue, 14 Apr 1992 02:24
31 lines
1069 bytes
1069 bytes
The use of the itoa function in stream.C, as via dec(), places the minus
sign for negative numbers after the number, rather than before it.
The following patch fixes the problem.
Doug Moore (dougm@cs.rice.edu)
*** stream.C~ Mon Apr 13 21:08:54 1992
--- stream.C Mon Apr 13 21:18:20 1992
***************
*** 44,51 ****
if (needed < (2+neg) || ptr > EndBuffer)
return NULL;
*--ptr = 0;
- if (neg)
- *--ptr = '-';
if (i == 0)
*--ptr = '0';
--- 44,49 ----
***************
*** 58,63 ****
--- 56,63 ----
ch += '0';
*--ptr = ch;
}
+ if (neg)
+ *--ptr = '-';
if (size == 0)
return ptr;
while (ptr > buf)
Technical Details
Message-ID:
<9204140224.AA11388@cs.rice.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.rice.edu!dougmShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.rice.edu!dougm From: dougm@cs.rice.edu (Doug Moore) Subject: sign bug in stream.C: itoa Message-ID: <9204140224.AA11388@cs.rice.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 14 Apr 1992 02:24:07 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 34