1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

ttsnoop: resolve coverity 176047, 176046, 176044, 176043, 176042 and 176040

This commit is contained in:
Jon Trulson 2018-07-05 13:42:36 -06:00
parent e91f12cc54
commit 16ee3d1be5
3 changed files with 12 additions and 14 deletions

View file

@ -466,8 +466,7 @@ DtTtSetLabel(
Tt_status status = tt_ptr_error( val );
std::ostringstream errStream;
errStream << func << " = " << val << " (" << status << ")" << ends;
const char *label = errStream.str().c_str();
DtTtSetLabel( labelWidget, label );
DtTtSetLabel( labelWidget, errStream.str().c_str() );
return status;
}
@ -480,8 +479,7 @@ DtTtSetLabel(
{
std::ostringstream errStream;
errStream << func << " = " << status << ends;
const char *label = errStream.str().c_str();
DtTtSetLabel( labelWidget, label );
DtTtSetLabel( labelWidget, errStream.str().c_str() );
return status;
}
@ -494,8 +492,8 @@ DtTtSetLabel(
{
std::ostringstream errStream;
errStream << func << " = " << returnVal << ends;
const char *label = errStream.str().c_str();
DtTtSetLabel( labelWidget, label );
DtTtSetLabel( labelWidget,
const_cast<char *>(errStream.str().c_str()) );
return returnVal;
}
@ -521,8 +519,8 @@ _DtTtChoices(
tt_free( name );
}
itemStream << ends;
char *string = const_cast<char *>(itemStream.str().c_str());
items[ i ] = XmStringCreateLocalized( string );
items[ i ] =
XmStringCreateLocalized(const_cast<char *>(itemStream.str().c_str()));
}
return items;
}
@ -571,8 +569,8 @@ _DtTtChoices(
tt_free( id );
}
itemStream << ends;
char *string = const_cast<char *>(itemStream.str().c_str());
items[ i ] = XmStringCreateLocalized( string );
items[ i ] =
XmStringCreateLocalized(const_cast<char *>(itemStream.str().c_str()));
}
return items;
case DTTT_PATTERN:

View file

@ -89,7 +89,7 @@ char * snoopFile = 0;
Boolean unlinkSnoopFile = True;
char * traceFile = 0;
Boolean unlinkTraceFile = True;
const char * traceScript = 0;
std::string traceScript;
int globalTimeout = 20000;
unsigned int globalSaveLines = 5000;
const char * globalVersionString = "1.0";
@ -667,7 +667,7 @@ main(int argc, char **argv)
std::ostringstream envStr;
envStr << "TT_TRACE_SCRIPT=> ";
envStr << traceFile << ends;
traceScript = envStr.str().c_str();
traceScript = envStr.str();
if (optImmediateTracing) {
turnOnTracing( 0, 0, 0 );
}

View file

@ -47,7 +47,7 @@ extern "C" { const char *_tt_lib_version; };
extern std::ofstream snoopStream;
extern unsigned int globalSaveLines;
extern char * traceScript;
extern std::string traceScript;
extern const char * globalVersionString;
extern Tt_pattern snoopPat;
extern Boolean snoopPatIsRegistered;
@ -118,7 +118,7 @@ turnOnTracing(
DtTtSetLabel( instance->cancelButton, "Stop" );
XtManageChild(instance->tracer_shellform);
tt_trace_control( 0 );
putenv( traceScript );
putenv( const_cast<char *>(traceScript.c_str()) );
tt_trace_control( 1 );
/*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
}