- bugfixes related to cppcheck report

- bugfixes found using valgrind (memory leaks)
This commit is contained in:
Mark Vejvoda
2011-12-02 16:07:59 +00:00
parent 4885f3f3a6
commit d33e1174a5
59 changed files with 772 additions and 272 deletions

View File

@@ -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