diff --git a/cde/programs/ttsnoop/DtTt.C b/cde/programs/ttsnoop/DtTt.C index 24d977071..ffd208fa9 100644 --- a/cde/programs/ttsnoop/DtTt.C +++ b/cde/programs/ttsnoop/DtTt.C @@ -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(errStream.str().c_str()) ); return returnVal; } @@ -521,8 +519,8 @@ _DtTtChoices( tt_free( name ); } itemStream << ends; - char *string = const_cast(itemStream.str().c_str()); - items[ i ] = XmStringCreateLocalized( string ); + items[ i ] = + XmStringCreateLocalized(const_cast(itemStream.str().c_str())); } return items; } @@ -571,8 +569,8 @@ _DtTtChoices( tt_free( id ); } itemStream << ends; - char *string = const_cast(itemStream.str().c_str()); - items[ i ] = XmStringCreateLocalized( string ); + items[ i ] = + XmStringCreateLocalized(const_cast(itemStream.str().c_str())); } return items; case DTTT_PATTERN: diff --git a/cde/programs/ttsnoop/ttsnoop.C.src b/cde/programs/ttsnoop/ttsnoop.C.src index 5deb6fd8f..e80312aab 100644 --- a/cde/programs/ttsnoop/ttsnoop.C.src +++ b/cde/programs/ttsnoop/ttsnoop.C.src @@ -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 ); } diff --git a/cde/programs/ttsnoop/ttsnoop_stubs.C.src b/cde/programs/ttsnoop/ttsnoop_stubs.C.src index f57104a4e..0ee8414ad 100644 --- a/cde/programs/ttsnoop/ttsnoop_stubs.C.src +++ b/cde/programs/ttsnoop/ttsnoop_stubs.C.src @@ -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(traceScript.c_str()) ); tt_trace_control( 1 ); /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/ }