diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-05-09 01:14:49 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-05-09 01:14:49 +0100 |
commit | 5e89fa46f8f90015f47210d9f532fb8626db8d17 (patch) | |
tree | 2e3dcacbb1183e8b3de132a83c9d88bf3156d58f /project2/common/variableConvert.cpp | |
parent | Fix leak of html/xml document structure (diff) | |
download | project2-1.2.6.tar.bz2 project2-1.2.6.tar.xz project2-1.2.6.zip |
Remove implicit cast to char * because it's dangerous as everyone knowsproject2-1.2.6
Diffstat (limited to 'project2/common/variableConvert.cpp')
-rw-r--r-- | project2/common/variableConvert.cpp | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/project2/common/variableConvert.cpp b/project2/common/variableConvert.cpp index fb90c95..0681ed0 100644 --- a/project2/common/variableConvert.cpp +++ b/project2/common/variableConvert.cpp @@ -70,30 +70,6 @@ class ConvertVisitorStdString : public boost::static_visitor<const std::string & private: const VariableType * var; }; -// Convert to char * (with std::string storage) -class ConvertVisitorCharStar : public boost::static_visitor<const char *> { - public: - ConvertVisitorCharStar(const VariableType * v) : var(v) { - } - const char * operator()(const Glib::ustring & r) const { - return r.c_str(); - } - const char * operator()(const boost::posix_time::time_duration & r) const { - CONVERTF(const Glib::ustring, boost::posix_time::to_simple_string, c_str); - } - const char * operator()(const boost::posix_time::ptime & r) const { - CONVERTF(const Glib::ustring, boost::posix_time::to_iso_extended_string, c_str); - } - const char * operator()(const Null &) const { - return NULL; - } - template <typename T> - const char * operator()(const T & r) const { - CONVERTF(const Glib::ustring, boost::lexical_cast<Glib::ustring>, c_str); - } - private: - const VariableType * var; -}; // Convert to numeric type template <typename DestType> class ConvertVisitor : public boost::static_visitor<DestType> { @@ -203,14 +179,6 @@ VariableType::operator const std::string &() const { return boost::apply_visitor(ConvertVisitorStdString(this), *this); } -VariableType::operator const char *() const -{ - return boost::apply_visitor(ConvertVisitorCharStar(this), *this); -} -VariableType::operator const unsigned char *() const -{ - return reinterpret_cast<const unsigned char *>(boost::apply_visitor(ConvertVisitorCharStar(this), *this)); -} VariableType::operator int() const { return boost::apply_visitor(ConvertVisitor<int>(this), *this); |