Commit e4341d22 authored by fogal1's avatar fogal1

Squashed commit of the following:

commit 55284337953c92f3ac7fd4cd648dde35c8a76806
Author: Tom Fogal <tfogal@alumni.unh.edu>
Date:   Sat Jun 14 22:03:55 2008 -0400

    avtDataRepresentation.C: warning fix.
    ImproperUseException: changed it to a constant reference to avoid copying.

commit 06e95de97117de786e23d9a1d337206050b8283c
Author: Tom Fogal <tfogal@alumni.unh.edu>
Date:   Sat Jun 14 20:19:24 2008 -0400

    Fixes implicit casts from a const char * to a char *, sourced from using an
    exception with a compile-time string constant.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@4445 18c085ea-50e0-402c-830e-de6fd14e8384
parent fa02e852
......@@ -930,6 +930,10 @@ avtDataRepresentation::GetTimeToDecompress() const
// Cyrus Harrison, Tue Feb 19 11:41:18 PST 2008
// Fixed a bug with naming -dump vtk output files in the parallel case.
//
// Tom Fogal, Sat Jun 14 21:59:58 EDT 2008
// Made an array `static const' to avoid a warning and allow it to be put in
// a RO section of the object.
//
// ****************************************************************************
const char *
......@@ -1071,10 +1075,7 @@ avtDataRepresentation::DebugDump(avtWebpage *webpage, const char *prefix)
data[0] = asVTK->GetFieldData();
data[1] = asVTK->GetPointData();
data[2] = asVTK->GetCellData();
char *names[3];
names[0] = "field";
names[1] = "point";
names[2] = "cell";
static const char *names[3] = { "field", "point", "cell" };
for (int fd = 0 ; fd < 3 ; fd++)
{
......
......@@ -51,9 +51,15 @@ using std::string;
// Programmer: Hank Childs
// Creation: July 24, 2000
//
// Modifications:
//
// Tom Fogal, Sat Jun 14 20:22:32 EDT 2008
// Changed the argument to be a constant reference. It needs to be const to
// be usable with string constants.
//
// ****************************************************************************
ImproperUseException::ImproperUseException(std::string reason)
ImproperUseException::ImproperUseException(const std::string & reason)
{
if (reason == "")
msg = "The pipeline object is being used improperly.";
......
......@@ -60,16 +60,19 @@
// Programmer: Hank Childs
// Creation: July 24, 2000
//
// Modifications:
//
// Tom Fogal, Sat Jun 14 18:48:35 EDT 2008
// Constant constructor argument avoids implicit conversion issues; made it
// a reference too, to avoid copying strings frequently.
//
// ****************************************************************************
class AVTEXCEPTION_API ImproperUseException : public PipelineException
{
public:
ImproperUseException(std::string = "");
ImproperUseException(const std::string & = "");
virtual ~ImproperUseException() VISIT_THROW_NOTHING {;};
};
#endif
......@@ -95,10 +95,10 @@ VisItException::VisItException(const std::string &m)
if (mtmp.find("avtprep:") == 0 ||
mtmp.find("cli:") == 0 ||
mtmp.find("engine:") == 0 ||
mtmp.find("gui:") == 0 ||
mtmp.find("gui:") == 0 ||
mtmp.find("launcher:") == 0 ||
mtmp.find("mdserver:") == 0 ||
mtmp.find("viewer:") == 0)
mtmp.find("viewer:") == 0)
msg = m;
else
msg = std::string(Init::GetComponentName()) + ": " + m;
......@@ -108,7 +108,6 @@ VisItException::VisItException(const std::string &m)
log = &debug1_real;
}
// ****************************************************************************
// Method: VisItException::SetThrowLocation
//
......@@ -123,10 +122,15 @@ VisItException::VisItException(const std::string &m)
// Programmer: Hank Childs
// Creation: May 16, 2000
//
// Modifications:
//
// Tom Fogal, Sat Jun 14 19:05:32 EDT 2008
// Add const to string argument.
//
// ****************************************************************************
void
VisItException::SetThrowLocation(int l, char *f)
VisItException::SetThrowLocation(int l, const char *f)
{
line = l;
filename = f;
......
......@@ -104,6 +104,9 @@
// Removed GetMessage method once and for all. Too many times has it
// been confused with GetMessageA on Windows.
//
// Tom Fogal, Sat Jun 14 18:44:35 EDT 2008
// Added const qualifications to avoid warnings (and bugs too I guess :)
//
// ****************************************************************************
class MISC_API VisItException
......@@ -115,11 +118,11 @@ class MISC_API VisItException
void Log(void);
void SetThrowLocation(int, char *);
void SetType(char *t) { type = t; };
void SetThrowLocation(int, const char *);
void SetType(const char *t) { type = t; };
void SetType(const std::string &t) { type = t; };
const std::string &Message() { return msg; };
const std::string &GetExceptionType() { return type; };
const std::string &Message() const { return msg; };
const std::string &GetExceptionType() const { return type; };
int GetLine() const { return line; };
const std::string &GetFilename() const { return filename; };
......
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