Changeset 86 for trunk/src/os2ahci/libc.c
- Timestamp:
- Apr 28, 2011, 7:41:44 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/libc.c
r82 r86 715 715 static void long_to_asc(long val, char _far *buf, int base, int zero, int flen) 716 716 { 717 register unsigned long abs_val = (unsigned long) val;717 register unsigned long abs_val; 718 718 char tmp[80]; 719 719 char _far *ptmp = tmp; … … 725 725 } 726 726 727 abs_val = (unsigned long) ((val < 0 && base <= 10) ? -val : val); 727 728 tmp[sizeof(tmp) - 1] = '\0'; 729 728 730 for (s = ptmp + sizeof(tmp) - 2; s > ptmp; s--) { 729 731 *s = hex_digits[abs_val % base]; … … 734 736 } 735 737 738 /* left-pad the resulting number with zeros or spaces up to 'flen' */ 739 while (flen > 0) { 740 *(--s) = (zero) ? '0' : ' '; 741 flen--; 742 } 743 736 744 /* prepend minus sign if val was negative and base is decimal or less */ 737 745 if (val < 0 && base <= 0) { … … 740 748 } 741 749 742 /* left-pad the resulting number with zeros or spaces up to 'flen' */743 while (flen > 0) {744 *(--s) = (zero) ? '0' : ' ';745 flen--;746 }747 748 750 strcpy(buf, s); 749 751 }
Note:
See TracChangeset
for help on using the changeset viewer.