Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49558 - trunk/boost/graph
From: asutton_at_[hidden]
Date: 2008-11-03 10:22:52


Author: asutton
Date: 2008-11-03 10:22:52 EST (Mon, 03 Nov 2008)
New Revision: 49558
URL: http://svn.boost.org/trac/boost/changeset/49558

Log:
Fixed warnings about conversion from c-str literals to char*.

Text files modified:
   trunk/boost/graph/graphml.hpp | 98 ++++++++++++++++++++--------------------
   1 files changed, 49 insertions(+), 49 deletions(-)

Modified: trunk/boost/graph/graphml.hpp
==============================================================================
--- trunk/boost/graph/graphml.hpp (original)
+++ trunk/boost/graph/graphml.hpp 2008-11-03 10:22:52 EST (Mon, 03 Nov 2008)
@@ -25,15 +25,15 @@
 #include <exception>
 #include <sstream>
 
-namespace boost
+namespace boost
 {
 
 /////////////////////////////////////////////////////////////////////////////
 // Graph reader exceptions
 /////////////////////////////////////////////////////////////////////////////
-struct parse_error: public graph_exception
+struct parse_error: public graph_exception
 {
- parse_error(const std::string& error) {statement = "parse error: " + error;}
+ parse_error(const std::string& error) {statement = "parse error: " + error;}
     virtual ~parse_error() throw() {}
     virtual const char* what() const throw() {return statement.c_str();}
     std::string statement;
@@ -48,14 +48,14 @@
 
     virtual boost::any do_add_vertex() = 0;
     virtual std::pair<boost::any,bool> do_add_edge(boost::any source, boost::any target) = 0;
-
- virtual void
+
+ virtual void
     set_graph_property(const std::string& name, const std::string& value, const std::string& value_type) = 0;
 
- virtual void
+ virtual void
     set_vertex_property(const std::string& name, boost::any vertex, const std::string& value, const std::string& value_type) = 0;
-
- virtual void
+
+ virtual void
     set_edge_property(const std::string& name, boost::any edge, const std::string& value, const std::string& value_type) = 0;
 };
 
@@ -87,27 +87,27 @@
         return std::make_pair(any(retval.first), retval.second);
     }
 
- virtual void
+ virtual void
     set_graph_property(const std::string& name, const std::string& value, const std::string& value_type)
     {
         bool type_found = false;
         try
         {
             mpl::for_each<value_types>(put_property<MutableGraph,value_types>
- (name, m_dp, m_g, value, value_type, m_type_names, type_found));
+ (name, m_dp, m_g, value, value_type, m_type_names, type_found));
         }
         catch (bad_lexical_cast)
         {
- throw parse_error("invalid value \"" + value + "\" for key " +
+ throw parse_error("invalid value \"" + value + "\" for key " +
                               name + " of type " + value_type);
         }
         if (!type_found)
- throw parse_error("unrecognized type \"" + value_type +
+ throw parse_error("unrecognized type \"" + value_type +
                                "\" for key " + name);
-
+
     }
-
- virtual void
+
+ virtual void
     set_vertex_property(const std::string& name, any vertex, const std::string& value, const std::string& value_type)
     {
         bool type_found = false;
@@ -115,20 +115,20 @@
         {
             mpl::for_each<value_types>(put_property<vertex_descriptor,value_types>
                                        (name, m_dp, any_cast<vertex_descriptor>(vertex),
- value, value_type, m_type_names, type_found));
+ value, value_type, m_type_names, type_found));
         }
         catch (bad_lexical_cast)
         {
- throw parse_error("invalid value \"" + value + "\" for key " +
+ throw parse_error("invalid value \"" + value + "\" for key " +
                               name + " of type " + value_type);
         }
         if (!type_found)
- throw parse_error("unrecognized type \"" + value_type +
+ throw parse_error("unrecognized type \"" + value_type +
                                "\" for key " + name);
-
+
     }
-
- virtual void
+
+ virtual void
     set_edge_property(const std::string& name, any edge, const std::string& value, const std::string& value_type)
     {
         bool type_found = false;
@@ -136,15 +136,15 @@
         {
             mpl::for_each<value_types>(put_property<edge_descriptor,value_types>
                                        (name, m_dp, any_cast<edge_descriptor>(edge),
- value, value_type, m_type_names, type_found));
+ value, value_type, m_type_names, type_found));
         }
         catch (bad_lexical_cast)
         {
- throw parse_error("invalid value \"" + value + "\" for key " +
+ throw parse_error("invalid value \"" + value + "\" for key " +
                               name + " of type " + value_type);
         }
         if (!type_found)
- throw parse_error("unrecognized type \"" + value_type +
+ throw parse_error("unrecognized type \"" + value_type +
                                "\" for key " + name);
     }
 
@@ -152,11 +152,11 @@
     class put_property
     {
     public:
- put_property(const std::string& name, dynamic_properties& dp, const Key& key,
- const std::string& value, const std::string& value_type,
- char** type_names, bool& type_found)
- : m_name(name), m_dp(dp), m_key(key), m_value(value),
- m_value_type(value_type), m_type_names(type_names),
+ put_property(const std::string& name, dynamic_properties& dp, const Key& key,
+ const std::string& value, const std::string& value_type,
+ const char** type_names, bool& type_found)
+ : m_name(name), m_dp(dp), m_key(key), m_value(value),
+ m_value_type(value_type), m_type_names(type_names),
               m_type_found(type_found) {}
         template <class Value>
         void operator()(Value)
@@ -173,19 +173,19 @@
         const Key& m_key;
         const std::string& m_value;
         const std::string& m_value_type;
- char** m_type_names;
+ const char** m_type_names;
         bool& m_type_found;
- };
-
+ };
+
 protected:
     MutableGraph& m_g;
     dynamic_properties& m_dp;
     typedef mpl::vector<bool, int, long, float, double, std::string> value_types;
- static char* m_type_names[];
+ static const char* m_type_names[];
 };
 
 template<typename MutableGraph>
-char* mutate_graph_impl<MutableGraph>::m_type_names[] = {"boolean", "int", "long", "float", "double", "string"};
+const char* mutate_graph_impl<MutableGraph>::m_type_names[] = {"boolean", "int", "long", "float", "double", "string"};
 
 void BOOST_GRAPH_DECL
 read_graphml(std::istream& in, mutate_graph& g);
@@ -193,7 +193,7 @@
 template<typename MutableGraph>
 void
 read_graphml(std::istream& in, MutableGraph& g, dynamic_properties& dp)
-{
+{
     mutate_graph_impl<MutableGraph> mg(g,dp);
     read_graphml(in, mg);
 }
@@ -202,7 +202,7 @@
 class get_type_name
 {
 public:
- get_type_name(const std::type_info& type, char** type_names, std::string& type_name)
+ get_type_name(const std::type_info& type, const char** type_names, std::string& type_name)
         : m_type(type), m_type_names(type_names), m_type_name(type_name) {}
     template <typename Type>
     void operator()(Type)
@@ -212,7 +212,7 @@
     }
 private:
     const std::type_info &m_type;
- char** m_type_names;
+ const char** m_type_names;
     std::string &m_type_name;
 };
 
@@ -226,22 +226,22 @@
     typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor;
     typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor;
 
- BOOST_STATIC_CONSTANT(bool,
- graph_is_directed =
+ BOOST_STATIC_CONSTANT(bool,
+ graph_is_directed =
                           (is_convertible<directed_category*, directed_tag*>::value));
 
     out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
         << "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">\n";
 
     typedef mpl::vector<bool, short, unsigned short, int, unsigned int, long, unsigned long, long long, unsigned long long, float, double, long double, std::string> value_types;
- char* type_names[] = {"boolean", "int", "int", "int", "int", "long", "long", "long", "long", "float", "double", "double", "string"};
+ const char* type_names[] = {"boolean", "int", "int", "int", "int", "long", "long", "long", "long", "float", "double", "double", "string"};
     std::map<std::string, std::string> graph_key_ids;
     std::map<std::string, std::string> vertex_key_ids;
     std::map<std::string, std::string> edge_key_ids;
     int key_count = 0;
 
     // Output keys
- for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
+ for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
     {
         std::string key_id = "key" + lexical_cast<std::string>(key_count++);
         if (i->second->key() == typeid(Graph))
@@ -254,14 +254,14 @@
             continue;
         std::string type_name = "string";
         mpl::for_each<value_types>(get_type_name<value_types>(i->second->value(), type_names, type_name));
- out << " <key id=\"" << key_id << "\" for=\""
+ out << " <key id=\"" << key_id << "\" for=\""
             << (i->second->key() == typeid(Graph) ? "graph" : (i->second->key() == typeid(vertex_descriptor) ? "node" : "edge")) << "\""
             << " attr.name=\"" << i->first << "\""
             << " attr.type=\"" << type_name << "\""
             << " />\n";
     }
 
- out << " <graph id=\"G\" edgedefault=\""
+ out << " <graph id=\"G\" edgedefault=\""
         << (graph_is_directed ? "directed" : "undirected") << "\""
         << " parse.nodeids=\"" << (ordered_vertices ? "canonical" : "free") << "\""
         << " parse.edgeids=\"canonical\" parse.order=\"nodesfirst\">\n";
@@ -269,13 +269,13 @@
     // Output graph data
     for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
     {
- if (i->second->key() == typeid(Graph))
+ if (i->second->key() == typeid(Graph))
         {
             out << " <data key=\"" << graph_key_ids[i->first] << "\">"
                 << i->second->get_string(g) << "</data>\n";
         }
     }
-
+
     typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator;
     vertex_iterator v, v_end;
     for (tie(v, v_end) = vertices(g); v != v_end; ++v)
@@ -284,7 +284,7 @@
         // Output data
         for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
         {
- if (i->second->key() == typeid(vertex_descriptor))
+ if (i->second->key() == typeid(vertex_descriptor))
             {
                 out << " <data key=\"" << vertex_key_ids[i->first] << "\">"
                     << i->second->get_string(*v) << "</data>\n";
@@ -296,7 +296,7 @@
     typedef typename graph_traits<Graph>::edge_iterator edge_iterator;
     edge_iterator e, e_end;
     typename graph_traits<Graph>::edges_size_type edge_count = 0;
- for (tie(e, e_end) = edges(g); e != e_end; ++e)
+ for (tie(e, e_end) = edges(g); e != e_end; ++e)
     {
         out << " <edge id=\"e" << edge_count++ << "\" source=\"n"
             << get(vertex_index, source(*e, g)) << "\" target=\"n"
@@ -305,7 +305,7 @@
         // Output data
         for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
         {
- if (i->second->key() == typeid(edge_descriptor))
+ if (i->second->key() == typeid(edge_descriptor))
             {
                 out << " <data key=\"" << edge_key_ids[i->first] << "\">"
                     << i->second->get_string(*e) << "</data>\n";
@@ -321,7 +321,7 @@
 
 template <typename Graph>
 void
-write_graphml(std::ostream& out, const Graph& g, const dynamic_properties& dp,
+write_graphml(std::ostream& out, const Graph& g, const dynamic_properties& dp,
               bool ordered_vertices=false)
 {
     write_graphml(out, g, get(vertex_index, g), dp, ordered_vertices);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk