mirror of
https://github.com/glest/glest-source.git
synced 2025-08-12 11:24:00 +02:00
- bugfixes related to cppcheck report
- bugfixes found using valgrind (memory leaks)
This commit is contained in:
@@ -15,6 +15,9 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include "platform_common.h"
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <locale>
|
||||
#include "leak_dumper.h"
|
||||
|
||||
using namespace std;
|
||||
@@ -145,4 +148,21 @@ bool IsNumeric(const char *p, bool allowNegative) {
|
||||
return true;
|
||||
}
|
||||
|
||||
class Comma: public numpunct<char>// own facet class
|
||||
{
|
||||
protected:
|
||||
char do_thousands_sep() const { return ','; }// use the comma
|
||||
string do_grouping() const { return "\3"; }//group 3 digits
|
||||
};
|
||||
string formatNumber(uint64 f) {
|
||||
|
||||
locale myloc( locale(), // C++ default locale
|
||||
new Comma);// Own numeric facet
|
||||
|
||||
ostringstream out;
|
||||
out.imbue(myloc);
|
||||
out << f;
|
||||
return out.str();
|
||||
}
|
||||
|
||||
}}//end namespace
|
||||
|
Reference in New Issue
Block a user