Fix a problem where older IRIX compilers needed a typecast for certain opperations

This commit is contained in:
ehofman
2003-10-16 12:51:47 +00:00
parent db928ea1ae
commit 3c08eae85b
8 changed files with 58 additions and 11 deletions

View File

@@ -0,0 +1,43 @@
#ifndef __SGI_HXX
#define __SGI_HXX
#include <string>
inline bool
operator!=( const std::string& lhs, const char* rhs)
{
return lhs.compare( rhs ) != 0;
}
inline bool
operator!=( const char* lhs, const std::string& rhs)
{
return rhs.compare( lhs ) != 0;
}
inline bool
operator==( const std::string& lhs, const char* rhs)
{
return lhs.compare( rhs ) == 0;
}
inline bool
operator==( const char* lhs, const std::string& rhs)
{
return rhs.compare( lhs ) == 0;
}
inline std::string
operator+(const std::string& lhs, const char* rhs)
{
return lhs + std::string(rhs);
}
inline std::string
operator+(const char* lhs, const std::string& rhs)
{
return std::string(lhs) + rhs;
}
#endif // !__SGI_HXX

View File

@@ -28,4 +28,6 @@ include_HEADERS = \
ctime \
iomanip \
new \
streambuf
streambuf \
\
IRIX

View File

@@ -290,6 +290,8 @@
#if defined ( sgi ) && !defined( __GNUC__ )
# define SG_HAVE_NATIVE_SGI_COMPILERS
#include <simgear/compatibility/IRIX>
# define SG_EXPLICIT_FUNCTION_TMPL_ARGS
# define SG_CLASS_PARTIAL_SPECIALIZATION
# define SG_NEED_AUTO_PTR

View File

@@ -54,7 +54,7 @@ SGSocket::SGSocket( const string& host, const string& port_,
{
is_tcp = true;
}
else if ( style != (string)"udp" )
else if ( style != "udp" )
{
SG_LOG( SG_IO, SG_ALERT,
"Error: SGSocket() unknown style = " << style );

View File

@@ -18,17 +18,17 @@ int main (int ac, char ** av)
SGTabbedValues tv(string1);
if (tv[0] != string("Hello")) {
if (tv[0] != "Hello") {
cerr << "failed to read string at index 0" << endl;
return 1;
}
if (tv[1] != string("World")) {
if (tv[1] != "World") {
cerr << "failed to read string at index 1" << endl;
return 1;
}
if (tv[2] != string("34")) {
if (tv[2] != "34") {
cerr << "failed to read string at index 2" << endl;
return 1;
}
@@ -61,7 +61,7 @@ int main (int ac, char ** av)
return 3;
}
if (tv[5] != string("There Is No Spoon")) {
if (tv[5] != "There Is No Spoon") {
cerr << "failed to read string at index 5 (got [" << tv[5] << "]" << endl;
return 1;
}

View File

@@ -113,7 +113,7 @@ parse_name (const string &path, int &i)
name = ".";
}
if (i < max && path[i] != '/')
throw string(string("Illegal character after ") + name);
throw string("Illegal character after " + name);
}
else if (isalpha(path[i]) || path[i] == '_') {

View File

@@ -117,9 +117,9 @@ checkFlag (const char * flag, bool defaultState = true)
{
if (flag == 0)
return defaultState;
else if (string(flag) == "y")
else if (flag == "y")
return true;
else if (string(flag) == "n")
else if (flag == "n")
return false;
else {
string message = "Unrecognized flag value '";
@@ -137,7 +137,7 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts)
const char * attval;
if (_level == 0) {
if (string(name) != (string)"PropertyList") {
if (name != "PropertyList") {
string message = "Root element name is ";
message += name;
message += "; expected PropertyList";

View File

@@ -86,7 +86,7 @@ sg_location::asString () const
{
char buf[128];
string out = "";
if (_path != (string)"") {
if (!_path.empty()) {
out += _path;
if (_line != -1 || _column != -1)
out += ",\n";