diff --git a/include/printapp.cpp b/include/printapp.cpp index 573b60e80..aaeedc4cd 100755 --- a/include/printapp.cpp +++ b/include/printapp.cpp @@ -970,7 +970,7 @@ void TPrint_application::set_row ( #ifdef __LONGDOUBLE__ sprintf (q.get_buffer(), formato, (long double)rrr); #else - rrr.sprintf(q.get_buffer(), (char*)(const char*)formato); + q = rrr.format(formato); #endif } if (rrr.is_zero () && !_print_zero) @@ -1484,7 +1484,7 @@ bool TPrint_application::print_one ( #ifdef __LONGDOUBLE__ sprintf(ps.get_buffer(), fff, (long double)rrr); #else - rrr.sprintf(ps.get_buffer(), (char*)fff); + ps = rrr.format(fff); #endif } if (rrr.is_zero () && !_print_zero) diff --git a/include/real.cpp b/include/real.cpp index d26162360..0647a3886 100755 --- a/include/real.cpp +++ b/include/real.cpp @@ -1579,6 +1579,18 @@ const char* real::string(const char *picture) const return f; } +// Certified 50% +const char* real::format(const char *picture) const +{ + if (*picture == '\0') + return string (); + + TString& f = get_tmp_string(); + dsprintf((char *)(const char *) f, (char *) picture, ptr()); + + return f; +} + // Certified 99% const char* real::stringa (int len, int dec, char pad) const { diff --git a/include/real.h b/include/real.h index 74b7ba433..7535bd5b5 100755 --- a/include/real.h +++ b/include/real.h @@ -206,7 +206,9 @@ public: const char* stringa(int len = 0, int dec = UNDEFINED, char pad = ' ') const; // @cmember Ritorna la stringa con il formato passato const char* string(const char* picture) const; - + // @cmember Ritorna la stringa con il formato passato + const char* real::format(const char *picture) const; + // @cmember Ritorna la precisione del reale (numero di decimali) int precision() const; // @cmember Controlla se si tratta di un reale uguale 0 (TRUE se 0) diff --git a/include/xml.cpp b/include/xml.cpp index 8e16e9c77..a2a3d4468 100755 --- a/include/xml.cpp +++ b/include/xml.cpp @@ -1,8 +1,12 @@ #include "real.h" #include "xml.h" +#ifdef WIN32 #include #include +#else +#include +#endif /////////////////////////////////////////////////////////// // Utilities @@ -417,8 +421,10 @@ void TXmlItem::Write(ostream& outf, int tab) const } if (GetChildren() > 0) { + int n; + outf << '>'; - for (int n = 0; ; n++) + for (n = 0; ; n++) { TXmlItem* c = GetChild(n); if (c == NULL) @@ -444,7 +450,12 @@ void TXmlItem::AsString(TString& str) const { char* buf = str.get_buffer(nSize); memset(buf, 0, nSize); +#ifdef WIN32 ostrstream outf(buf, nSize); +#else + ostringstream outf(buf); +#endif + Write(outf, 0); if (buf[nSize-1] == '\0') break; @@ -486,7 +497,7 @@ TXmlItem* TXmlItem::FindFirst(const char* strTag) const } TXmlItem::TXmlItem() - : m_strTag(15), m_Attributes(NULL), m_Children(NULL), m_strText(NULL) + : m_strTag(15), m_strText(NULL), m_Attributes(NULL), m_Children(NULL) { } TXmlItem::~TXmlItem()