Skip to content

Commit

Permalink
Fix GCC warning: forbidden conversion to char*
Browse files Browse the repository at this point in the history
GCC 11
warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

GCC 485
warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  • Loading branch information
plexoos committed Sep 6, 2022
1 parent 5b5f3f3 commit 0b31427
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 37 deletions.
4 changes: 2 additions & 2 deletions OnlTools/Jevp/StJevpBuilders/fcsMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ Short_t HMapSCBRA[10];
Short_t HMapSCPP[10];
Short_t HMapSCJ[10];

char* colW[4]={"Green ","Brown ","Orange","Blue "};
char* colJ[8]={"Blue ","Orange","Violet","Black ",
const char* colW[4]={"Green ","Brown ","Orange","Blue "};
const char* colJ[8]={"Blue ","Orange","Violet","Black ",
"Yellow","Red ","Grey ","Blue "};
float leng[8]={ 6.5, 6.5, 5.0, 5.0,
3.5, 3.5, 8.0, 8.0};
Expand Down
4 changes: 2 additions & 2 deletions OnlTools/Jevp/StJevpPlot/JevpPlotSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ JevpPlotSet::JevpPlotSet(JevpServer *server)
PCP;
}

void JevpPlotSet::logDbVariable(char *name, double value) {
void JevpPlotSet::logDbVariable(const char *name, double value) {
JevpPlotSet::staticLogDbVariable(name, value, run, lastevttm, plotsetname, clientdatadir);
}

void JevpPlotSet::staticLogDbVariable(char *name, double value, int my_run, int my_time, char *my_plotsetname, char *my_clientdatadir) {
void JevpPlotSet::staticLogDbVariable(const char *name, double value, int my_run, int my_time, char *my_plotsetname, char *my_clientdatadir) {
char fn[256];
sprintf(fn, "%s/%s", my_clientdatadir, "dbVariable.tosend");

Expand Down
4 changes: 2 additions & 2 deletions OnlTools/Jevp/StJevpPlot/JevpPlotSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ class JevpPlotSet : public TObject {

//StTriggerData *getStTriggerData(daqReader *rdr);

void logDbVariable(char *variable_name, double value);
static void staticLogDbVariable(char *name, double value, int my_run, int my_time, char *my_plotsetname, char *my_clientdatadir);
void logDbVariable(const char *variable_name, double value);
static void staticLogDbVariable(const char *name, double value, int my_run, int my_time, char *my_plotsetname, char *my_clientdatadir);

JevpServer *parent;

Expand Down
4 changes: 2 additions & 2 deletions StRoot/RTS/src/DAQ_BSMD/bsmdPed.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ int bsmdPed::to_evb(char *buff)
int bsmdPed::from_cache(char *fname)
{
FILE *f ;
char *fn ;
const char *fn ;

init(0x3F) ; // to clear ped storage for all 6 RDOs

Expand Down Expand Up @@ -395,7 +395,7 @@ int bsmdPed::to_cache(char *fname, u_int run)
{
FILE *f ;
int r, p, t ;
char *fn ;
const char *fn ;


if(!valid) {
Expand Down
6 changes: 3 additions & 3 deletions StRoot/RTS/src/DAQ_READER/daqReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ daqReader::daqReader(char *mem, int size)

}

daqReader::daqReader(char *name)
daqReader::daqReader(const char *name)
{
struct stat64 stat_buf ;

Expand Down Expand Up @@ -1665,7 +1665,7 @@ int daqReader::fillSummaryInfo_v02(SummaryInfo *info, gbPayload_0x02 *pay) {

/////// Tonko

char *daqReader::get_sfs_name(char *right)
char *daqReader::get_sfs_name(const char *right)
{
if(sfs == 0) return 0 ;

Expand Down Expand Up @@ -2024,7 +2024,7 @@ int daqReader::fillSummaryInfo_v02(SummaryInfo *info, gbPayload_0x02 *pay) {
msg.head.status = 0 ;
msg.ld.dword[0] = htonl(getpid()) ;

char *user ;
const char *user ;

struct passwd *passwd = getpwuid(getuid()) ;
if(passwd == NULL) {
Expand Down
4 changes: 2 additions & 2 deletions StRoot/RTS/src/DAQ_READER/daqReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class daqReader {
// space separated files --> read from each file in turn
//
daqReader(char *buffer, int size);
daqReader(char *fname) ;
daqReader(const char *fname) ;
~daqReader(void) ;

void init();
Expand All @@ -111,7 +111,7 @@ class daqReader {
void insert(daq_det *which, int rts_id) ;
void de_insert(int rts_id) ;
void Make() ;
char *get_sfs_name(char *snippet=0) ; // returns the full name of the SFS
char *get_sfs_name(const char *snippet=0) ; // returns the full name of the SFS
char *get(int which, int type=EVP_TYPE_ANY) ;
char *skip_then_get(int numToSkip, int num, int type=EVP_TYPE_ANY);
// The following are the descriptors and pointers defining the event
Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/src/DAQ_TPX/tpxGain.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ void tpxGain::do_default(int sec)
return ;
}

int tpxGain::from_file(char *fname, int sec)
int tpxGain::from_file(const char *fname, int sec)
{
FILE *f ;
int s, r, p ;
Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/src/DAQ_TPX/tpxGain.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class tpxGain
return (gains[s-1] + r*TPX_MAX_PAD + (p-1)) ;
}

int from_file(char *fname, int sector = 0) ;
int from_file(const char *fname, int sector = 0) ;


// [sector 1-24][RDO 1-6][fee-index 0-35]
Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/src/FCF/fcfClass.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include <rtsSystems.h>
#include <fcfClass.hh>

static char *fcf_cvs_revision = "$Revision: 1.5 $" ;
static const char *fcf_cvs_revision = "$Revision: 1.5 $" ;

#ifdef __ROOT__ // STAR Offline

Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/src/RTS_EXAMPLE/rts_example.trg.C
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ static int fgt_doer(daqReader *rdr, const char *do_print, int which)
char s_found[128] ;
daq_dta *dd ;

char *d_name = 0 ;
const char *d_name = 0 ;


switch(which) {
Expand Down
14 changes: 8 additions & 6 deletions StRoot/StStrangeMuDstMaker/StStrangeMuDstPlayer.cxx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <cstring>

#include "StChain.h"
#include "StIOMaker/StIOMaker.h"
#include "StEventMaker/StEventMaker.h"
Expand All @@ -17,8 +19,8 @@ ClassImp(StrangeMuDstPlayer)

char empty = '\0';
char slash = '/';
void ParseFileName(Char_t *output, Char_t **file, Char_t **dir) {
if ((*file = strrchr(output,slash))) {
void ParseFileName(const Char_t *output, Char_t **file, Char_t **dir) {
if ((*file = std::strrchr(output,slash))) {
(*file)++;
*dir = new char[strlen(output)+5];
strncpy(*dir,output,(strlen(output)-strlen(*file)));
Expand Down Expand Up @@ -53,7 +55,7 @@ StrangeMuDstPlayer::StrangeMuDstPlayer() {
xiDcaBachelorToPrimVertex = 0.;
}

void StrangeMuDstPlayer::Make(Int_t NEvents, StFile* input, Char_t* output) {
void StrangeMuDstPlayer::Make(Int_t NEvents, StFile* input, const Char_t* output) {

StStrangeMuDstMaker *muDstMakers[3];
StStrangeMuDstMaker *v0MuDstMaker, *xiMuDstMaker, *kinkMuDstMaker;
Expand Down Expand Up @@ -166,7 +168,7 @@ void StrangeMuDstPlayer::Make(Int_t NEvents, StFile* input, Char_t* output) {
}
}

void StrangeMuDstPlayer::Filter(Int_t NEvents, StFile* input, Char_t* output) {
void StrangeMuDstPlayer::Filter(Int_t NEvents, StFile* input, const Char_t* output) {

StStrangeMuDstMaker *oldMuDstMaker=0;
StStrangeMuDstMaker *newMuDstMakers[3];
Expand Down Expand Up @@ -366,7 +368,7 @@ void StrangeMuDstPlayer::Filter(Int_t NEvents, StFile* input, Char_t* output) {
}
}

void StrangeMuDstPlayer::Play(Int_t NEvents, StFile* input, Char_t* output) {
void StrangeMuDstPlayer::Play(Int_t NEvents, StFile* input, const Char_t* output) {

StStrangeMuDstMaker *oldMuDstMaker=0;
StStrangeMuDstMaker *newMuDstMakers[3];
Expand Down Expand Up @@ -592,7 +594,7 @@ void StrangeMuDstPlayer::Play(Int_t NEvents, StFile* input, Char_t* output) {
}
}

void StrangeMuDstPlayer::Copy(Int_t NEvents, StFile* input, Char_t* output) {
void StrangeMuDstPlayer::Copy(Int_t NEvents, StFile* input, const Char_t* output) {

StStrangeMuDstMaker *oldMuDstMaker=0;
StStrangeMuDstMaker *newMuDstMakers[3];
Expand Down
8 changes: 4 additions & 4 deletions StRoot/StStrangeMuDstMaker/StStrangeMuDstPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ class StrangeMuDstPlayer {
public:
StrangeMuDstPlayer();
virtual ~StrangeMuDstPlayer() {}
void Make(Int_t NEvents, StFile* input, Char_t *output="evMuDst.root");
void Filter(Int_t NEvents, StFile* input, Char_t *output="evMuDst.root");
void Play(Int_t NEvents, StFile* input, Char_t *output="evMuDst.root");
void Copy(Int_t NEvents, StFile* input, Char_t *output="evMuDst.root");
void Make(Int_t NEvents, StFile* input, const Char_t *output="evMuDst.root");
void Filter(Int_t NEvents, StFile* input, const Char_t *output="evMuDst.root");
void Play(Int_t NEvents, StFile* input, const Char_t *output="evMuDst.root");
void Copy(Int_t NEvents, StFile* input, const Char_t *output="evMuDst.root");
void DoFileSplit(Bool_t val = kTRUE);
void DoMC(Bool_t val = kTRUE);
void DoT0Abort(Bool_t val = kTRUE);
Expand Down
2 changes: 1 addition & 1 deletion StRoot/StSvtClusterMaker/StSvtHitMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ Int_t StSvtHitMaker::Finish(){
}

//________________________________________________________________________
void StSvtHitMaker::SetFileNames(char* filen, char* filec){
void StSvtHitMaker::SetFileNames(const char* filen, const char* filec){
filenameN = filen;
filenameC = filec;
}
Expand Down
6 changes: 3 additions & 3 deletions StRoot/StSvtClusterMaker/StSvtHitMaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class StSvtHitMaker : public StMaker
void TransformIntoSpacePoint();
void SaveIntoNtuple(int numOfCluster, int index);
void SetWriteNtuple(int iwrite){iWrite = iwrite;};
void SetFileNames(char* name1="/dev/null", char* name2="/dev/null");
void SetFileNames(const char* name1="/dev/null", const char* name2="/dev/null");
Int_t Eval();
double LaserTemperatureCorrection();

Expand Down Expand Up @@ -145,8 +145,8 @@ class StSvtHitMaker : public StMaker
TH1F *mZHitResolution; //!
TH2F *mHitResolution; //!

char* filenameN;
char* filenameC;
const char* filenameN;
const char* filenameC;

ClassDef(StSvtHitMaker,0) //virtual base class for Makers

Expand Down
2 changes: 1 addition & 1 deletion StRoot/StSvtDaqMaker/StSvtDaqMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
ClassImp(StSvtDaqMaker)

//_____________________________________________________________________________
StSvtDaqMaker::StSvtDaqMaker(const char *name, char* config, char* data):StMaker(name)
StSvtDaqMaker::StSvtDaqMaker(const char *name, const char* config, const char* data):StMaker(name)
{
fConfig = config;
fDataType = data;
Expand Down
10 changes: 5 additions & 5 deletions StRoot/StSvtDaqMaker/StSvtDaqMaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class TObjectSet;
class StSvtDaqMaker : public StMaker {

private:
char *fConfig; //!
char *fDataType; //!
const char *fConfig; //!
const char *fDataType; //!

StSvtHybridDaqData *fData; //!
StSvtDaqData *fSvtData; //!
Expand All @@ -79,10 +79,10 @@ class StSvtDaqMaker : public StMaker {
protected:

public:
StSvtDaqMaker(const char *name="SvtDaq", char* config="FULL", char* data="ZS");
StSvtDaqMaker(const char *name="SvtDaq", const char* config="FULL", const char* data="ZS");
virtual ~StSvtDaqMaker();
void SetConfiguration(char* config){fConfig = config;}
void SetDataType(char* data){fDataType = data;}
void SetConfiguration(const char* config){fConfig = config;}
void SetDataType(const char* data){fDataType = data;}
Int_t SetSvtData();
Int_t SetSvtPed();
Int_t SetSvtRMSPed();
Expand Down

0 comments on commit 0b31427

Please sign in to comment.