Ticket #4016: boost_property_tree_gcc_warning_cleanup.diff
File boost_property_tree_gcc_warning_cleanup.diff, 26.1 KB (added by , 13 years ago) |
---|
-
boost/property_tree/detail/exception_implementation.hpp
30 30 /////////////////////////////////////////////////////////////////////////// 31 31 // ptree_error 32 32 33 inline ptree_error::ptree_error(const std::string & what):34 std::runtime_error( what)33 inline ptree_error::ptree_error(const std::string &p_what): 34 std::runtime_error(p_what) 35 35 { 36 36 } 37 37 … … 43 43 // ptree_bad_data 44 44 45 45 template<class D> inline 46 ptree_bad_data::ptree_bad_data(const std::string & what, const D &data):47 ptree_error( what), m_data(data)46 ptree_bad_data::ptree_bad_data(const std::string &p_what, const D &p_data): 47 ptree_error(p_what), m_data(p_data) 48 48 { 49 49 } 50 50 … … 62 62 // ptree_bad_path 63 63 64 64 template<class P> inline 65 ptree_bad_path::ptree_bad_path(const std::string & what, const P &path):66 ptree_error(detail::prepare_bad_path_what( what, path)), m_path(path)65 ptree_bad_path::ptree_bad_path(const std::string &p_what, const P &p_path): 66 ptree_error(detail::prepare_bad_path_what(p_what, p_path)), m_path(p_path) 67 67 { 68 68 69 69 } -
boost/property_tree/detail/file_parser_error.hpp
26 26 // Construction & destruction 27 27 28 28 // Construct error 29 file_parser_error(const std::string & message,30 const std::string & filename,31 unsigned long line) :32 ptree_error(format_what( message, filename,line)),33 m_message( message), m_filename(filename), m_line(line)29 file_parser_error(const std::string &p_message, 30 const std::string &p_filename, 31 unsigned long p_line) : 32 ptree_error(format_what(p_message, p_filename, p_line)), 33 m_message(p_message), m_filename(p_filename), m_line(p_line) 34 34 { 35 35 } 36 36 -
boost/property_tree/detail/rapidxml.hpp
50 50 public: 51 51 52 52 //! Constructs parse error 53 parse_error(const char * what, void *where)54 : m_what( what)55 , m_where( where)53 parse_error(const char *p_what, void *p_where) 54 : m_what(p_what) 55 , m_where(p_where) 56 56 { 57 57 } 58 58 … … 688 688 //! Use name(const Ch *) function to have the length automatically calculated (string must be zero terminated). 689 689 //! \param name Name of node to set. Does not have to be zero terminated. 690 690 //! \param size Size of name, in characters. This does not include zero terminator, if one is present. 691 void name(const Ch * name, std::size_t size)691 void name(const Ch *p_name, std::size_t size) 692 692 { 693 m_name = const_cast<Ch *>( name);693 m_name = const_cast<Ch *>(p_name); 694 694 m_name_size = size; 695 695 } 696 696 697 697 //! Sets name of node to a zero-terminated string. 698 698 //! See also \ref ownership_of_strings and xml_node::name(const Ch *, std::size_t). 699 699 //! \param name Name of node to set. Must be zero terminated. 700 void name(const Ch * name)700 void name(const Ch *p_name) 701 701 { 702 this->name( name, internal::measure(name));702 this->name(p_name, internal::measure(p_name)); 703 703 } 704 704 705 705 //! Sets value of node to a non zero-terminated string. … … 718 718 //! If you want to manipulate data of elements using values, use parser flag rapidxml::parse_no_data_nodes to prevent creation of data nodes by the parser. 719 719 //! \param value value of node to set. Does not have to be zero terminated. 720 720 //! \param size Size of value, in characters. This does not include zero terminator, if one is present. 721 void value(const Ch * value, std::size_t size)721 void value(const Ch *p_value, std::size_t size) 722 722 { 723 m_value = const_cast<Ch *>( value);723 m_value = const_cast<Ch *>(p_value); 724 724 m_value_size = size; 725 725 } 726 726 727 727 //! Sets value of node to a zero-terminated string. 728 728 //! See also \ref ownership_of_strings and xml_node::value(const Ch *, std::size_t). 729 729 //! \param value Vame of node to set. Must be zero terminated. 730 void value(const Ch * value)730 void value(const Ch *p_value) 731 731 { 732 this->value( value, internal::measure(value));732 this->value(p_value, internal::measure(p_value)); 733 733 } 734 734 735 735 /////////////////////////////////////////////////////////////////////////// … … 803 803 //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string 804 804 //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters 805 805 //! \return Pointer to found attribute, or 0 if not found. 806 xml_attribute<Ch> *previous_attribute(const Ch * name = 0, std::size_tname_size = 0, bool case_sensitive = true) const806 xml_attribute<Ch> *previous_attribute(const Ch *p_name = 0, std::size_t p_name_size = 0, bool case_sensitive = true) const 807 807 { 808 if ( name)808 if (p_name) 809 809 { 810 if ( name_size == 0)811 name_size = internal::measure(name);810 if (p_name_size == 0) 811 p_name_size = internal::measure(p_name); 812 812 for (xml_attribute<Ch> *attribute = m_prev_attribute; attribute; attribute = attribute->m_prev_attribute) 813 if (internal::compare(attribute->name(), attribute->name_size(), name,name_size, case_sensitive))813 if (internal::compare(attribute->name(), attribute->name_size(), p_name, p_name_size, case_sensitive)) 814 814 return attribute; 815 815 return 0; 816 816 } … … 823 823 //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string 824 824 //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters 825 825 //! \return Pointer to found attribute, or 0 if not found. 826 xml_attribute<Ch> *next_attribute(const Ch * name = 0, std::size_tname_size = 0, bool case_sensitive = true) const826 xml_attribute<Ch> *next_attribute(const Ch *p_name = 0, std::size_t p_name_size = 0, bool case_sensitive = true) const 827 827 { 828 if ( name)828 if (p_name) 829 829 { 830 if ( name_size == 0)831 name_size = internal::measure(name);830 if (p_name_size == 0) 831 p_name_size = internal::measure(p_name); 832 832 for (xml_attribute<Ch> *attribute = m_next_attribute; attribute; attribute = attribute->m_next_attribute) 833 if (internal::compare(attribute->name(), attribute->name_size(), name,name_size, case_sensitive))833 if (internal::compare(attribute->name(), attribute->name_size(), p_name, p_name_size, case_sensitive)) 834 834 return attribute; 835 835 return 0; 836 836 } … … 868 868 //! Constructs an empty node with the specified type. 869 869 //! Consider using memory_pool of appropriate document to allocate nodes manually. 870 870 //! \param type Type of node to construct. 871 xml_node(node_type type)872 : m_type( type)871 xml_node(node_type p_type) 872 : m_type(p_type) 873 873 , m_first_node(0) 874 874 , m_first_attribute(0) 875 875 { … … 903 903 //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string 904 904 //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters 905 905 //! \return Pointer to found child, or 0 if not found. 906 xml_node<Ch> *first_node(const Ch * name = 0, std::size_tname_size = 0, bool case_sensitive = true) const906 xml_node<Ch> *first_node(const Ch *p_name = 0, std::size_t p_name_size = 0, bool case_sensitive = true) const 907 907 { 908 if ( name)908 if (p_name) 909 909 { 910 if ( name_size == 0)911 name_size = internal::measure(name);910 if (p_name_size == 0) 911 p_name_size = internal::measure(p_name); 912 912 for (xml_node<Ch> *child = m_first_node; child; child = child->next_sibling()) 913 if (internal::compare(child->name(), child->name_size(), name,name_size, case_sensitive))913 if (internal::compare(child->name(), child->name_size(), p_name, p_name_size, case_sensitive)) 914 914 return child; 915 915 return 0; 916 916 } … … 925 925 //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string 926 926 //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters 927 927 //! \return Pointer to found child, or 0 if not found. 928 xml_node<Ch> *last_node(const Ch * name = 0, std::size_tname_size = 0, bool case_sensitive = true) const928 xml_node<Ch> *last_node(const Ch *p_name = 0, std::size_t p_name_size = 0, bool case_sensitive = true) const 929 929 { 930 930 assert(m_first_node); // Cannot query for last child if node has no children 931 if ( name)931 if (p_name) 932 932 { 933 if ( name_size == 0)934 name_size = internal::measure(name);933 if (p_name_size == 0) 934 p_name_size = internal::measure(p_name); 935 935 for (xml_node<Ch> *child = m_last_node; child; child = child->previous_sibling()) 936 if (internal::compare(child->name(), child->name_size(), name,name_size, case_sensitive))936 if (internal::compare(child->name(), child->name_size(), p_name, p_name_size, case_sensitive)) 937 937 return child; 938 938 return 0; 939 939 } … … 948 948 //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string 949 949 //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters 950 950 //! \return Pointer to found sibling, or 0 if not found. 951 xml_node<Ch> *previous_sibling(const Ch * name = 0, std::size_tname_size = 0, bool case_sensitive = true) const951 xml_node<Ch> *previous_sibling(const Ch *p_name = 0, std::size_t p_name_size = 0, bool case_sensitive = true) const 952 952 { 953 953 assert(this->m_parent); // Cannot query for siblings if node has no parent 954 if ( name)954 if (p_name) 955 955 { 956 if ( name_size == 0)957 name_size = internal::measure(name);956 if (p_name_size == 0) 957 p_name_size = internal::measure(p_name); 958 958 for (xml_node<Ch> *sibling = m_prev_sibling; sibling; sibling = sibling->m_prev_sibling) 959 if (internal::compare(sibling->name(), sibling->name_size(), name,name_size, case_sensitive))959 if (internal::compare(sibling->name(), sibling->name_size(), p_name, p_name_size, case_sensitive)) 960 960 return sibling; 961 961 return 0; 962 962 } … … 971 971 //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string 972 972 //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters 973 973 //! \return Pointer to found sibling, or 0 if not found. 974 xml_node<Ch> *next_sibling(const Ch * name = 0, std::size_tname_size = 0, bool case_sensitive = true) const974 xml_node<Ch> *next_sibling(const Ch *p_name = 0, std::size_t p_name_size = 0, bool case_sensitive = true) const 975 975 { 976 976 assert(this->m_parent); // Cannot query for siblings if node has no parent 977 if ( name)977 if (p_name) 978 978 { 979 if ( name_size == 0)980 name_size = internal::measure(name);979 if (p_name_size == 0) 980 p_name_size = internal::measure(p_name); 981 981 for (xml_node<Ch> *sibling = m_next_sibling; sibling; sibling = sibling->m_next_sibling) 982 if (internal::compare(sibling->name(), sibling->name_size(), name,name_size, case_sensitive))982 if (internal::compare(sibling->name(), sibling->name_size(), p_name, p_name_size, case_sensitive)) 983 983 return sibling; 984 984 return 0; 985 985 } … … 992 992 //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string 993 993 //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters 994 994 //! \return Pointer to found attribute, or 0 if not found. 995 xml_attribute<Ch> *first_attribute(const Ch * name = 0, std::size_tname_size = 0, bool case_sensitive = true) const995 xml_attribute<Ch> *first_attribute(const Ch *p_name = 0, std::size_t p_name_size = 0, bool case_sensitive = true) const 996 996 { 997 if ( name)997 if (p_name) 998 998 { 999 if ( name_size == 0)1000 name_size = internal::measure(name);999 if (p_name_size == 0) 1000 p_name_size = internal::measure(p_name); 1001 1001 for (xml_attribute<Ch> *attribute = m_first_attribute; attribute; attribute = attribute->m_next_attribute) 1002 if (internal::compare(attribute->name(), attribute->name_size(), name,name_size, case_sensitive))1002 if (internal::compare(attribute->name(), attribute->name_size(), p_name, p_name_size, case_sensitive)) 1003 1003 return attribute; 1004 1004 return 0; 1005 1005 } … … 1012 1012 //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string 1013 1013 //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters 1014 1014 //! \return Pointer to found attribute, or 0 if not found. 1015 xml_attribute<Ch> *last_attribute(const Ch * name = 0, std::size_tname_size = 0, bool case_sensitive = true) const1015 xml_attribute<Ch> *last_attribute(const Ch *p_name = 0, std::size_t p_name_size = 0, bool case_sensitive = true) const 1016 1016 { 1017 if ( name)1017 if (p_name) 1018 1018 { 1019 if ( name_size == 0)1020 name_size = internal::measure(name);1019 if (p_name_size == 0) 1020 p_name_size = internal::measure(p_name); 1021 1021 for (xml_attribute<Ch> *attribute = m_last_attribute; attribute; attribute = attribute->m_prev_attribute) 1022 if (internal::compare(attribute->name(), attribute->name_size(), name,name_size, case_sensitive))1022 if (internal::compare(attribute->name(), attribute->name_size(), p_name, p_name_size, case_sensitive)) 1023 1023 return attribute; 1024 1024 return 0; 1025 1025 } … … 1032 1032 1033 1033 //! Sets type of node. 1034 1034 //! \param type Type of node to set. 1035 void type(node_type type)1035 void type(node_type p_type) 1036 1036 { 1037 m_type = type;1037 m_type = p_type; 1038 1038 } 1039 1039 1040 1040 /////////////////////////////////////////////////////////////////////////// … … 1757 1757 } 1758 1758 1759 1759 // Remember value start 1760 Ch * value = text;1760 Ch *text_value = text; 1761 1761 1762 1762 // Skip until end of comment 1763 1763 while (text[0] != Ch('-') || text[1] != Ch('-') || text[2] != Ch('>')) … … 1769 1769 1770 1770 // Create comment node 1771 1771 xml_node<Ch> *comment = this->allocate_node(node_comment); 1772 comment->value( value, text -value);1772 comment->value(text_value, text - text_value); 1773 1773 1774 1774 // Place zero terminator after comment value 1775 1775 if (!(Flags & parse_no_string_terminators)) … … 1784 1784 xml_node<Ch> *parse_doctype(Ch *&text) 1785 1785 { 1786 1786 // Remember value start 1787 Ch * value = text;1787 Ch *text_value = text; 1788 1788 1789 1789 // Skip to > 1790 1790 while (*text != Ch('>')) … … 1806 1806 case Ch('['): ++depth; break; 1807 1807 case Ch(']'): --depth; break; 1808 1808 case 0: BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text); 1809 default: break; 1809 1810 } 1810 1811 ++text; 1811 1812 } … … 1828 1829 { 1829 1830 // Create a new doctype node 1830 1831 xml_node<Ch> *doctype = this->allocate_node(node_doctype); 1831 doctype->value( value, text -value);1832 doctype->value(text_value, text - text_value); 1832 1833 1833 1834 // Place zero terminator after value 1834 1835 if (!(Flags & parse_no_string_terminators)) … … 1856 1857 xml_node<Ch> *pi = this->allocate_node(node_pi); 1857 1858 1858 1859 // Extract PI target name 1859 Ch * name = text;1860 Ch *text_name = text; 1860 1861 skip<node_name_pred, Flags>(text); 1861 if (text == name)1862 if (text == text_name) 1862 1863 BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected PI target", text); 1863 pi->name( name, text -name);1864 pi->name(text_name, text - text_name); 1864 1865 1865 1866 // Skip whitespace between pi target and pi 1866 1867 skip<whitespace_pred, Flags>(text); 1867 1868 1868 1869 // Remember start of pi 1869 Ch * value = text;1870 Ch *text_value = text; 1870 1871 1871 1872 // Skip to '?>' 1872 1873 while (text[0] != Ch('?') || text[1] != Ch('>')) … … 1877 1878 } 1878 1879 1879 1880 // Set pi value (verbatim, no entity expansion or whitespace normalization) 1880 pi->value( value, text -value);1881 pi->value(text_value, text - text_value); 1881 1882 1882 1883 // Place zero terminator after name and value 1883 1884 if (!(Flags & parse_no_string_terminators)) … … 1914 1915 text = contents_start; 1915 1916 1916 1917 // Skip until end of data 1917 Ch * value = text, *end;1918 Ch *text_value = text, *end; 1918 1919 if (Flags & parse_normalize_whitespace) 1919 1920 end = skip_and_expand_character_refs<text_pred, text_pure_with_ws_pred, Flags>(text); 1920 1921 else … … 1942 1943 if (!(Flags & parse_no_data_nodes)) 1943 1944 { 1944 1945 xml_node<Ch> *data = this->allocate_node(node_data); 1945 data->value( value, end -value);1946 data->value(text_value, end - text_value); 1946 1947 node->append_node(data); 1947 1948 } 1948 1949 1949 1950 // Add data to parent node if no data exists yet 1950 1951 if (!(Flags & parse_no_element_values)) 1951 1952 if (*node->value() == Ch('\0')) 1952 node->value( value, end -value);1953 node->value(text_value, end - text_value); 1953 1954 1954 1955 // Place zero terminator after value 1955 1956 if (!(Flags & parse_no_string_terminators)) … … 1982 1983 } 1983 1984 1984 1985 // Skip until end of cdata 1985 Ch * value = text;1986 Ch *text_value = text; 1986 1987 while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>')) 1987 1988 { 1988 1989 if (!text[0]) … … 1992 1993 1993 1994 // Create new cdata node 1994 1995 xml_node<Ch> *cdata = this->allocate_node(node_cdata); 1995 cdata->value( value, text -value);1996 cdata->value(text_value, text - text_value); 1996 1997 1997 1998 // Place zero terminator after value 1998 1999 if (!(Flags & parse_no_string_terminators)) … … 2010 2011 xml_node<Ch> *element = this->allocate_node(node_element); 2011 2012 2012 2013 // Extract element name 2013 Ch * name = text;2014 Ch *text_name = text; 2014 2015 skip<node_name_pred, Flags>(text); 2015 if (text == name)2016 if (text == text_name) 2016 2017 BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected element name", text); 2017 element->name( name, text -name);2018 element->name(text_name, text - text_name); 2018 2019 2019 2020 // Skip whitespace between element name and attributes or > 2020 2021 skip<whitespace_pred, Flags>(text); … … 2115 2116 text += 9; // skip '!DOCTYPE ' 2116 2117 return parse_doctype<Flags>(text); 2117 2118 } 2119 break; 2118 2120 2121 default: break; 2122 2119 2123 } // switch 2120 2124 2121 2125 // Attempt to skip other, unrecognized node types starting with <! … … 2211 2215 while (attribute_name_pred::test(*text)) 2212 2216 { 2213 2217 // Extract attribute name 2214 Ch * name = text;2218 Ch *text_name = text; 2215 2219 ++text; // Skip first character of attribute name 2216 2220 skip<attribute_name_pred, Flags>(text); 2217 if (text == name)2218 BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected attribute name", name);2221 if (text == text_name) 2222 BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected attribute name", text_name); 2219 2223 2220 2224 // Create new attribute 2221 2225 xml_attribute<Ch> *attribute = this->allocate_attribute(); 2222 attribute->name( name, text -name);2226 attribute->name(text_name, text - text_name); 2223 2227 node->append_attribute(attribute); 2224 2228 2225 2229 // Skip whitespace after attribute name … … 2244 2248 ++text; 2245 2249 2246 2250 // Extract attribute value and expand char refs in it 2247 Ch * value = text, *end;2251 Ch *text_value = text, *end; 2248 2252 const int AttFlags = Flags & ~parse_normalize_whitespace; // No whitespace normalization in attributes 2249 2253 if (quote == Ch('\'')) 2250 2254 end = skip_and_expand_character_refs<attribute_value_pred<Ch('\'')>, attribute_value_pure_pred<Ch('\'')>, AttFlags>(text); … … 2252 2256 end = skip_and_expand_character_refs<attribute_value_pred<Ch('"')>, attribute_value_pure_pred<Ch('"')>, AttFlags>(text); 2253 2257 2254 2258 // Set attribute value 2255 attribute->value( value, end -value);2259 attribute->value(text_value, end - text_value); 2256 2260 2257 2261 // Make sure that end quote is present 2258 2262 if (*text != quote) -
boost/property_tree/detail/ptree_implementation.hpp
185 185 } 186 186 187 187 template<class K, class D, class C> inline 188 basic_ptree<K, D, C>::basic_ptree(const data_type & data)189 : m_data( data), m_children(new typename subs::base_container)188 basic_ptree<K, D, C>::basic_ptree(const data_type &p_data) 189 : m_data(p_data), m_children(new typename subs::base_container) 190 190 { 191 191 } 192 192 -
boost/property_tree/detail/xml_parser_error.hpp
20 20 class xml_parser_error: public file_parser_error 21 21 { 22 22 public: 23 xml_parser_error(const std::string & message,24 const std::string & filename,25 unsigned long line):26 file_parser_error( message, filename,line)23 xml_parser_error(const std::string &p_message, 24 const std::string &p_filename, 25 unsigned long p_line): 26 file_parser_error(p_message, p_filename, p_line) 27 27 { 28 28 } 29 29 }; -
boost/property_tree/detail/xml_parser_writer_settings.hpp
35 35 class xml_writer_settings 36 36 { 37 37 public: 38 xml_writer_settings(Ch indent_char = Ch(' '),39 typename std::basic_string<Ch>::size_type indent_count = 0,40 const std::basic_string<Ch> & encoding = widen<Ch>("utf-8"))41 : indent_char( indent_char)42 , indent_count( indent_count)43 , encoding( encoding)38 xml_writer_settings(Ch p_indent_char = Ch(' '), 39 typename std::basic_string<Ch>::size_type p_indent_count = 0, 40 const std::basic_string<Ch> &p_encoding = widen<Ch>("utf-8")) 41 : indent_char(p_indent_char) 42 , indent_count(p_indent_count) 43 , encoding(p_encoding) 44 44 { 45 45 } 46 46