mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
Core: Format(%.2f) now produces '.' despite setlocale
git-svn-id: svn://ultimatepp.org/upp/trunk@10642 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
50adfc8a3b
commit
66e00d369e
2 changed files with 11 additions and 21 deletions
|
|
@ -676,28 +676,16 @@ String StringFormatter(const Formatting& f)
|
|||
if(!lpad)
|
||||
r.Cat(q);
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
if(f.format.GetCount())
|
||||
String fmt = '%' + f.format + f.id;
|
||||
char h[256];
|
||||
#ifdef COMPILER_MSC
|
||||
int n = _snprintf(h, 256, fmt, ~s);
|
||||
if(n < 0)
|
||||
#else
|
||||
int n = snprintf(h, 255, fmt, ~s);
|
||||
if(n >= 254)
|
||||
#endif
|
||||
{
|
||||
#ifdef COMPILER_MSC
|
||||
n = _scprintf(fmt, ~s);
|
||||
#endif
|
||||
Buffer<char> ah(n + 1);
|
||||
sprintf(ah, fmt, ~s);
|
||||
return String(ah, n);
|
||||
static inline
|
||||
void sFixPoint(char *s) // We do not want locale to affect decimal point, convert ',' to '.'
|
||||
{
|
||||
while(*s) {
|
||||
if(*s == ',')
|
||||
*s = '.';
|
||||
s++;
|
||||
}
|
||||
return String(h, n);
|
||||
*/
|
||||
}
|
||||
|
||||
String FloatFormatter(const Formatting& f)
|
||||
|
|
@ -718,10 +706,12 @@ String FloatFormatter(const Formatting& f)
|
|||
#endif
|
||||
Buffer<char> ah(n + 1);
|
||||
sprintf(ah, fmt, d);
|
||||
sFixPoint(ah);
|
||||
return String(ah, n);
|
||||
}
|
||||
if(n < 0)
|
||||
return String();
|
||||
sFixPoint(h);
|
||||
return String(h, n);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
KEY(SETMAIN, "Set main package..", K_CTRL_M)
|
||||
KEY(EDITFILE, "Open file", K_CTRL_O)
|
||||
KEY(EDITFILE, "Edit file", K_CTRL_O)
|
||||
KEY(OPPOSITE, "Opposite file", K_ALT_O)
|
||||
KEY(SAVEFILE, "Save", K_CTRL_S)
|
||||
KEY(READONLY, "Read only", 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue