Commit d0813459 authored by Ian Bell's avatar Ian Bell
Browse files

REFORM DEB_OUT. Fixed some potential bugs with nullptr filenames and added a...

REFORM DEB_OUT. Fixed some potential bugs with nullptr filenames and added a string_out() method to DebStream (not currently exploited).

[git-p4: depot-paths = "//ReForm/ReForm/main/Base/": change = 10656]
parent debfe27a
...@@ -153,6 +153,8 @@ public: ...@@ -153,6 +153,8 @@ public:
) ; ) ;
~DebStream(); ~DebStream();
const char * string_out() const;
DebStream& print(const int); DebStream& print(const int);
DebStream& print(const double); DebStream& print(const double);
DebStream& print(const char* const, bool fork = true); DebStream& print(const char* const, bool fork = true);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
namespace { // LOCAL_PROC namespace { // LOCAL_PROC
bool is_html_filename(const char* const str) bool is_html_filename(const char* const str)
{ {
if (str == nullptr) return false;
const char* dot = strchr(str, '.'); const char* dot = strchr(str, '.');
if (dot == nullptr) return false; if (dot == nullptr) return false;
++dot; ++dot;
...@@ -643,6 +644,10 @@ public: ...@@ -643,6 +644,10 @@ public:
return res; return res;
} // endfunc flush } // endfunc flush
// Use with extreme caution.
const char * string_out() const
{ return current_.c_str(); }
void close() void close()
{ {
footer(); footer();
...@@ -652,7 +657,7 @@ public: ...@@ -652,7 +657,7 @@ public:
void set_file_name(const char* _name) void set_file_name(const char* _name)
{ {
file_name_ = _name; file_name_ = _name ? _name : "";
if (is_html_filename(_name)) if (is_html_filename(_name))
type_ = (DebStream::StreamType)(type_ | DebStream::StreamType::HTML); type_ = (DebStream::StreamType)(type_ | DebStream::StreamType::HTML);
} }
...@@ -912,6 +917,10 @@ DebStream::~DebStream() ...@@ -912,6 +917,10 @@ DebStream::~DebStream()
} }
} }
const char * DebStream::string_out() const
{ return dfile()->string_out();}
DebStream& DebStream::print(const int _i) DebStream& DebStream::print(const int _i)
{ {
dfile_->print(_i); dfile_->print(_i);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment