aboutsummaryrefslogtreecommitdiff
path: root/src/formatter.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/formatter.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/formatter.h b/src/formatter.h
index 8bb8e08..9f407a4 100644
--- a/src/formatter.h
+++ b/src/formatter.h
@@ -134,6 +134,7 @@ namespace Bu
134 { 134 {
135 // This code is taken from Nango, hopefully we can make it better. 135 // This code is taken from Nango, hopefully we can make it better.
136 bool bNeg = i<0; 136 bool bNeg = i<0;
137 char cBase = fLast.bCaps?'A':'a';
137 char buf[sizeof(type)*8+1]; 138 char buf[sizeof(type)*8+1];
138 if( bNeg ) i = -i; 139 if( bNeg ) i = -i;
139 if( fLast.uRadix < 2 || fLast.uRadix > 36 ) 140 if( fLast.uRadix < 2 || fLast.uRadix > 36 )
@@ -146,7 +147,7 @@ namespace Bu
146 { 147 {
147 int c = i%fLast.uRadix; 148 int c = i%fLast.uRadix;
148 i /= fLast.uRadix; 149 i /= fLast.uRadix;
149 buf[j] = (char)((c<10)?('0'+c):('A'+c-10)); 150 buf[j] = (char)((c<10)?('0'+c):(cBase+c-10));
150 if( i == 0 ) 151 if( i == 0 )
151 { 152 {
152 if( bNeg ) buf[--j] = '-'; 153 if( bNeg ) buf[--j] = '-';
@@ -164,6 +165,7 @@ namespace Bu
164 { 165 {
165 // This code is taken from Nango, hopefully we can make it better. 166 // This code is taken from Nango, hopefully we can make it better.
166 char buf[sizeof(type)*8+1]; 167 char buf[sizeof(type)*8+1];
168 char cBase = fLast.bCaps?'A':'a';
167 if( fLast.uRadix < 2 || fLast.uRadix > 36 ) 169 if( fLast.uRadix < 2 || fLast.uRadix > 36 )
168 { 170 {
169 usedFormat(); 171 usedFormat();
@@ -174,7 +176,7 @@ namespace Bu
174 { 176 {
175 int c = i%fLast.uRadix; 177 int c = i%fLast.uRadix;
176 i /= fLast.uRadix; 178 i /= fLast.uRadix;
177 buf[j] = (char)((c<10)?('0'+c):('A'+c-10)); 179 buf[j] = (char)((c<10)?('0'+c):(cBase+c-10));
178 if( i == 0 ) 180 if( i == 0 )
179 { 181 {
180 if( fLast.bPlus ) buf[--j] = '+'; 182 if( fLast.bPlus ) buf[--j] = '+';