|
Line
Link Here
|
| 0 |
-- worker-2.8.0.orig/src/aguix/lowlevelfunc.cc |
0 |
++ worker-2.8.0/src/aguix/lowlevelfunc.cc |
|
Lines 21-26
Link Here
|
| 21 |
/* $Id: lowlevelfunc.cc,v 1.25 2003/06/05 01:02:20 ralf Exp $ */ |
21 |
/* $Id: lowlevelfunc.cc,v 1.25 2003/06/05 01:02:20 ralf Exp $ */ |
| 22 |
|
22 |
|
| 23 |
#include "lowlevelfunc.h" |
23 |
#include "lowlevelfunc.h" |
|
|
24 |
#include <locale.h> |
| 24 |
|
25 |
|
| 25 |
#ifdef USE_MEM_SYSTEM |
26 |
#ifdef USE_MEM_SYSTEM |
| 26 |
typedef struct _safemem {void *ptr; |
27 |
typedef struct _safemem {void *ptr; |
|
Lines 205-210
Link Here
|
| 205 |
int s = NiceLongSize( size ); |
206 |
int s = NiceLongSize( size ); |
| 206 |
char ch; |
207 |
char ch; |
| 207 |
int l,i,pos; |
208 |
int l,i,pos; |
|
|
209 |
/* assign a fallback default value */ |
| 210 |
char own_thousands_sep = '.'; |
| 211 |
struct lconv *current_locale = localeconv(); |
| 212 |
|
| 213 |
/* check if the locale defines thousands_sep */ |
| 214 |
if (*(current_locale->thousands_sep)) { |
| 215 |
/* yes, it does. just copy the char. */ |
| 216 |
own_thousands_sep = *(current_locale->thousands_sep); |
| 217 |
} |
| 218 |
|
| 208 |
// first write the normal str into buf |
219 |
// first write the normal str into buf |
| 209 |
l=WriteLong2Str(buffer,size); |
220 |
l=WriteLong2Str(buffer,size); |
| 210 |
// start at the right of needed room (the lowest number) |
221 |
// start at the right of needed room (the lowest number) |
|
Lines 213-225
Link Here
|
| 213 |
for(i=0;i<l;i++) { |
224 |
for(i=0;i<l;i++) { |
| 214 |
// save the char |
225 |
// save the char |
| 215 |
ch=buffer[l-1-i]; |
226 |
ch=buffer[l-1-i]; |
| 216 |
// when overtaking the thousand/million/billion number write a "." |
227 |
// when overtaking the thousand/million/billion number write the |
| 217 |
// into the dest |
228 |
// own_thousands_sep (depending on the current locale) into the dest |
| 218 |
// this will NOT overwrite any important information because |
229 |
// this will NOT overwrite any important information because |
| 219 |
// 1.we saved the ch we will write |
230 |
// 1.we saved the ch we will write |
| 220 |
// 2.at the end we will be at pos 0 (pos starts at s-1) |
231 |
// 2.at the end we will be at pos 0 (pos starts at s-1) |
| 221 |
// and if we have all points written, we will overtake the ch |
232 |
// and if we have all points written, we will overtake the ch |
| 222 |
if(((i==3)||(i==6)||(i==9))&&(isdigit(ch))) buffer[pos--]='.'; |
233 |
if(((i==3)||(i==6)||(i==9))&&(isdigit(ch))) buffer[pos--] = own_thousands_sep; |
| 223 |
buffer[pos--]=ch; |
234 |
buffer[pos--]=ch; |
| 224 |
} |
235 |
} |
| 225 |
return s; |
236 |
return s; |