From: Wolfgang Bangerth Date: Mon, 18 Feb 2002 09:22:07 +0000 (+0000) Subject: Improve exception output and work around a bug in gcc3.0.1 where a \0 character was... X-Git-Tag: v8.0.0~18321 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=874d468dfb7ec36a50b1fcdbe72210eed76ce596;p=dealii.git Improve exception output and work around a bug in gcc3.0.1 where a \0 character was appended to what one gets from a strstream.str() call. git-svn-id: https://svn.dealii.org/trunk@5522 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/numerics/data_out.h b/deal.II/deal.II/include/numerics/data_out.h index 6f545cc725..901d3d5905 100644 --- a/deal.II/deal.II/include/numerics/data_out.h +++ b/deal.II/deal.II/include/numerics/data_out.h @@ -380,12 +380,14 @@ class DataOut_DoFData : public DataOutInterface /** * Exception */ - DeclException1 (ExcInvalidCharacter, - std::string, + DeclException2 (ExcInvalidCharacter, + std::string, size_t, << "Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl << "description strings since some graphics formats will only accept these." << std::endl - << "The string you gave was <" << arg1 << ">."); + << "The string you gave was <" << arg1 + << ">, the invalid character is <" << arg1[arg2] + << ">." << std::endl); /** * Exception */ diff --git a/deal.II/deal.II/include/numerics/data_out_stack.h b/deal.II/deal.II/include/numerics/data_out_stack.h index 2ce4e639ec..9cbed62642 100644 --- a/deal.II/deal.II/include/numerics/data_out_stack.h +++ b/deal.II/deal.II/include/numerics/data_out_stack.h @@ -297,11 +297,14 @@ class DataOutStack : public DataOutInterface /** * Exception */ - DeclException1 (ExcInvalidCharacter, - std::string, + DeclException2 (ExcInvalidCharacter, + std::string, size_t, << "Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl - << "description strings since AVS will only accept these." << std::endl - << "The string you gave was <" << arg1 << ">."); + << "description strings since some graphics formats will only accept these." + << std::endl + << "The string you gave was <" << arg1 + << ">, the invalid character is <" << arg1[arg2] + << ">." << std::endl); /** * Exception */ diff --git a/deal.II/deal.II/source/numerics/data_out.cc b/deal.II/deal.II/source/numerics/data_out.cc index 8035bd65c8..7779bfce78 100644 --- a/deal.II/deal.II/source/numerics/data_out.cc +++ b/deal.II/deal.II/source/numerics/data_out.cc @@ -169,7 +169,10 @@ add_data_vector (const VECTOR &vec, Assert (names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789_<>()") == std::string::npos, - ExcInvalidCharacter (names[i])); + ExcInvalidCharacter (names[i], + names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789_<>()"))); DataEntry new_entry (&vec, names); if (actual_type == type_dof_data) @@ -210,8 +213,8 @@ add_data_vector (const VECTOR &vec, #else std::ostrstream namebuf; #endif - namebuf << name << '_' << i << std::ends; - names[i] = namebuf.str(); + namebuf << '_' << i << std::ends; + names[i] = name + namebuf.str().c_str(); }; }; diff --git a/deal.II/deal.II/source/numerics/data_out_stack.cc b/deal.II/deal.II/source/numerics/data_out_stack.cc index b7e08a559f..b5a3359e09 100644 --- a/deal.II/deal.II/source/numerics/data_out_stack.cc +++ b/deal.II/deal.II/source/numerics/data_out_stack.cc @@ -158,7 +158,10 @@ void DataOutStack::add_data_vector (const Vector &vec, Assert (names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789_<>()") == std::string::npos, - ExcInvalidCharacter (names[i])); + ExcInvalidCharacter (names[i], + names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789_<>()"))); if (vec.size() == dof_handler->n_dofs()) {