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 3, 2022
1 parent 7f24ac6 commit d0fce01
Show file tree
Hide file tree
Showing 36 changed files with 70 additions and 71 deletions.
2 changes: 1 addition & 1 deletion StRoot/RTS/EventTracker/gl3Histo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//
//####################################################################################
gl3Histo::gl3Histo ( char iId[10], char iTitle[100],
gl3Histo::gl3Histo (const char iId[10], const char iTitle[100],
int iNBins, double iXMin, double iXMax ) {
info = 0 ;
if ( iNBins < 0 ) {
Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/EventTracker/gl3Histo.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class gl3Histo {
double* info ;

public:
gl3Histo ( char iId[10]="id", char iTitle[100]="name",
gl3Histo (const char iId[10]="id", const char iTitle[100]="name",
int iNBins=100, double iXMin=0., double iXMax=100. ) ;
~gl3Histo ( ) ;
int Fill (double x, double weight=1) ;
Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/EventTracker/l3CoordinateTransformer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ l3CoordinateTransformer::~l3CoordinateTransformer()

#include "mapbin.h"

int l3CoordinateTransformer::LoadTPCLookupTable(char *)
int l3CoordinateTransformer::LoadTPCLookupTable(const char *)
{
// if (TPCmap) free(TPCmap);
// TPCmap = NULL;
Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/EventTracker/l3CoordinateTransformer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class l3CoordinateTransformer{
l3CoordinateTransformer() ; // Init parameters and variables
virtual ~l3CoordinateTransformer() ; // Delete variables

int LoadTPCLookupTable(char * filename = "/L3/etc/map.bin");
int LoadTPCLookupTable(const char * filename = "/L3/etc/map.bin");

// Memberfunctions
// raw -> global
Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/include/fcfClass.hh
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public:
int compare(u_int *p1[3], u_int *p2[3]) ;

void decode(u_int *data, fcfHit *h, u_int *sim = 0) ; // utility: from FCF to local
void print_hit(char *, fcfHit *hit) ; // utility
void print_hit(const char *, fcfHit *hit) ; // utility

u_int do_swap ; // 0=no, 1=yes => set by "burn"
u_int do_merge ; // merge broken rows
Expand Down
3 changes: 1 addition & 2 deletions StRoot/RTS/src/DAQ_BTOW/daq_btow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,9 @@ daq_dta *daq_btow::handle_raw()
char *from, *st ;
int bytes ;
char str[256] ;
char *full_name = "?" ; // just a dummy...
const char *full_name = "?" ; // just a dummy...

from = 0 ;
full_name = "?" ;

assert(caller) ;

Expand Down
10 changes: 5 additions & 5 deletions StRoot/RTS/src/DAQ_EMC/emc_reader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ static char *inst2char(int inst)
static struct emc_describe_t {
int id ;

char *p ;
char *secp ;
char *rbp ;
char *adcr ;
char *adcd ;
const char *p ;
const char *secp ;
const char *rbp ;
const char *adcr ;
const char *adcd ;
int trg_index ;
int type ; // 0 Barrel, 1 Endcap
int sub ; // 0 tower, 1 SMD
Expand Down
8 changes: 4 additions & 4 deletions StRoot/RTS/src/DAQ_EMC/emc_single_reader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include <DAQ_READER/daq_det.h>

const struct hdrs {
char *emcp ;
char *secp ;
char *rbp ;
char *adc ;
const char *emcp ;
const char *secp ;
const char *rbp ;
const char *adc ;
} hdrs[2] = {
{ CHAR_EMCP, CHAR_EMCSECP, CHAR_EMCRBP, CHAR_EMCADCR },
{ CHAR_EECP, CHAR_EECSECP, CHAR_EECRBP, CHAR_EECADCR }
Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/src/DAQ_READER/daqReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ char *daqReader::skip_then_get(int numToSkip, int num, int type)
}


char *daqReader::getInputType()
const char *daqReader::getInputType()
{
switch(input_type) {
case none:
Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/src/DAQ_READER/daqReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class daqReader {
u_int L3summary[4];

int fixDatapSummary(DATAP *datap);
char *getInputType();
const char *getInputType();
int getNextEventFilename(int num, int type);
int getNextEventFilenameFromLive(int type);
int getNextEventFilenameFromDir(int eventNum);
Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/src/DAQ_READER/daq_det.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ daq_dta *daq_det::put(const char *bank,int c1, int c2, int c3, void *p1, void *


// helpers
int checkBank(char *in, char *expect)
int checkBank(char *in, const char *expect)
{
char buff[12] ;

Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/src/DAQ_READER/daq_det.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class daqReader ;
class daq_det ;

// helpers
extern int checkBank(char *in, char *expect) ;
extern int checkBank(char *in, const char *expect) ;
extern int *legacyDetp(int rts_id, char *datap) ;


Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/src/FCF/fcfAfterburner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fcfAfterburner::fcfAfterburner()
If "str" is non-NULL it prepends it to the line
as a label.
*/
void fcfAfterburner::print_hit(char *str, struct fcfHit *h)
void fcfAfterburner::print_hit(const char *str, struct fcfHit *h)
{
if(str) {
fprintf(stdout,"%s: ",str) ;
Expand Down
10 changes: 5 additions & 5 deletions StRoot/RTS/src/SFS/fs_index.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ int fs_index::initmount()
return 0;
}

void fs_index::getFullPath(char *fullpath, char *name)
void fs_index::getFullPath(char *fullpath, const char *name)
{
if(name[0] == '/') {
strcpy(fullpath,name);
Expand Down Expand Up @@ -436,7 +436,7 @@ void fs_index::umount()
index_created = 0;
}

fs_dirent *fs_index::readdirent(char *dir, fs_dirent *ent)
fs_dirent *fs_index::readdirent(const char *dir, fs_dirent *ent)
{
if(ent == NULL) {
ent = &_readdirent_static_;
Expand Down Expand Up @@ -473,7 +473,7 @@ fs_dirent *fs_index::readdirent(char *dir, fs_dirent *ent)
}


fs_dir *fs_index::opendir(char *dir)
fs_dir *fs_index::opendir(const char *dir)
{
if(!index_created) return NULL;

Expand Down Expand Up @@ -582,7 +582,7 @@ fs_inode *fs_index::alloc_inode(const char *name, long long int off, int sz, int
return n;
}

int fs_index::fileSize(char *fn)
int fs_index::fileSize(const char *fn)
{
if(!index_created) return -1;

Expand All @@ -595,7 +595,7 @@ int fs_index::fileSize(char *fn)
return entry->sz;
}

int fs_index::read(char *fn, char *buff, int maxsize)
int fs_index::read(const char *fn, char *buff, int maxsize)
{
if(!index_created) return -1;

Expand Down
12 changes: 6 additions & 6 deletions StRoot/RTS/src/SFS/fs_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,30 +131,30 @@ class fs_index {
char *pwd() { return cwd; };

// directory functions
fs_dir *opendir(char *dir);
fs_dir *opendir(const char *dir);
void closedir(fs_dir *dir);
fs_dirent *readdir(fs_dir *dir, fs_dirent *storage=NULL);
fs_dirent *readdirent(char *name, fs_dirent *storage=NULL);
fs_dirent *readdirent(const char *name, fs_dirent *storage=NULL);

// meant for users that have memory mapped/memory sfs indexes
// and want to use the buffers in place to avoid memcpy
// access the data through the dirent's offset / size
//
inline fs_dirent *opendirent(char *name) { return readdirent(name); };
inline fs_dirent *opendirent(const char *name) { return readdirent(name); };

int mem_ls(fs_filelist *filelist, int recurse, fs_dir *dir);

// File operations
int read(char *fn, char *buff, int sz);
int read(const char *fn, char *buff, int sz);
virtual int write(char *fn, char *buff, int sz) { return -1; };
virtual int getwritevsz(fs_iovec *fsiovec, int n) { return 0; };
virtual int writev(fs_iovec *iovec, int n) { return -1; };
virtual int writev_sticky(fs_iovec *iovec, int n, int *sticky) { return -1; };

int fileSize(char *fn);
int fileSize(const char *fn);

int n_inodes;
void getFullPath(char *fullname, char *name);
void getFullPath(char *fullname, const char *name);
virtual void dump(int fd)=0;

wrapfile wfile;
Expand Down
2 changes: 1 addition & 1 deletion StRoot/StDaqLib/GENERIC/EventReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ char * EventReader::findBank(char *bankid)

}

void EventReader::fprintError(int err, char *file, int line, char *userstring)
void EventReader::fprintError(int err, char *file, int line, const char *userstring)
{
if (logfd==NULL) return; //no file designated
if (err<0 || err>MX_MESSAGE) return; //protect against bad error code
Expand Down
2 changes: 1 addition & 1 deletion StRoot/StDaqLib/GENERIC/EventReader.hh
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ public:
int system_present(Bank_DATAP *datap, int sys);

void printEventInfo(FILE *fd=stdout);
void fprintError(int err, char *file, int line, char *userstring);
void fprintError(int err, char *file, int line, const char *userstring);

int runno() { return runnum; }
int errorNo() { return errnum; };
Expand Down
4 changes: 2 additions & 2 deletions StRoot/StFlowMaker/StFlowEvent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ TVector2 StFlowEvent::Q(StFlowSelection* pFlowSelect) {

//-------------------------------------------------------------

TVector2 StFlowEvent::ReCentPar(StFlowSelection* pFlowSelect, char* TPC) {
TVector2 StFlowEvent::ReCentPar(StFlowSelection* pFlowSelect, const char* TPC) {
// For LYZ
// Calculate weighted recentering vector per particle for each TPC
// TPC can be "TPC", "TPCE", or "TPCW"
Expand Down Expand Up @@ -417,7 +417,7 @@ TVector2 StFlowEvent::ReCentPar(StFlowSelection* pFlowSelect, char* TPC) {

//-------------------------------------------------------------

TVector2 StFlowEvent::ReCentEPPar(StFlowSelection* pFlowSelect, char* TPC) {
TVector2 StFlowEvent::ReCentEPPar(StFlowSelection* pFlowSelect, const char* TPC) {
// For ana
// Calculate the recentering vector per particle for each TPC
// TPC can be "TPCE", "TPCW", "FTPCE", or "FTPCW"
Expand Down
4 changes: 2 additions & 2 deletions StRoot/StFlowMaker/StFlowEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class StFlowEvent : public StObject {
TVector2 Q(StFlowSelection*);
TVector2 NormQ(StFlowSelection* pFlowSelect);
TVector2 QPart(StFlowSelection*);
TVector2 ReCentEPPar(StFlowSelection*, char*); // for ana
TVector2 ReCentPar(StFlowSelection*, char*); // for LYZ
TVector2 ReCentEPPar(StFlowSelection*, const char*); // for ana
TVector2 ReCentPar(StFlowSelection*, const char*); // for LYZ
TVector2 ReCent(Int_t selN, Int_t harN, StFlowTrack* pFlowTrack) const;
TVector2 ReCentEP(Int_t selN, Int_t harN, StFlowTrack* pFlowTrack) const;
Float_t q(StFlowSelection*);
Expand Down
6 changes: 3 additions & 3 deletions StRoot/StSpinPool/StSpinDbMaker/StSpinDbMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ void StSpinDbMaker::optimizeTables (){

}

char *polDir="scrambled";
string polDir="scrambled";
if(isPolDirTrans()) polDir="Transverse";
if(isPolDirLong()) polDir="Longitudinal";

Expand Down Expand Up @@ -487,9 +487,9 @@ void StSpinDbMaker::print(int level) {
int yellBx=(bXstar+getBucketOffsets()[yellRing]/3)%SPINDbMaxBXings;
int spin8=spin8usingBX48(bx48);
int spin4=spin4usingBX48(bx48);
char *ftt="empty ";
const char *ftt="empty ";
if (isBXfilledUsingBX48(bx48))ftt="filled";
char *mtt="use ";
const char *mtt="use ";
if(isMaskedUsingBX48(bx48))mtt="*mask*";
printf(" %3d 0x%02x %2d %6s %6s %3d %3d %3d\n",bXstar,spin8,spin4,ftt,mtt,bx48,blueBx,yellBx);
// printf("bx48=%d mU=%d bxStar=%d mR=%d\n", bx48,isMaskedUsingBX48(bx48),bXstar,mTabSpinBXmask->bXmask[bXstar]);
Expand Down
6 changes: 3 additions & 3 deletions StRoot/StSvtDaqMaker/StSvtDaqData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ StSvtDaqData::StSvtDaqData() :
StSvtData()
{}

StSvtDaqData::StSvtDaqData(const char* config, StSVTReader* reader, char* option, int run, int event, int trigger) :
StSvtDaqData::StSvtDaqData(const char* config, StSVTReader* reader, const char* option, int run, int event, int trigger) :
StSvtData(config, run, event, trigger)
{
// The Same as StSvtHybridCollection, with two additional parameters:
Expand All @@ -66,7 +66,7 @@ StSvtDaqData::StSvtDaqData(const char* config, StSVTReader* reader, char* option
setData(reader,option);
}

StSvtDaqData::StSvtDaqData(StSvtConfig* config, StSVTReader* reader, char* option, int run, int event, int trigger) :
StSvtDaqData::StSvtDaqData(StSvtConfig* config, StSVTReader* reader, const char* option, int run, int event, int trigger) :
StSvtData(config, run, event, trigger)
{
// The Same as StSvtHybridCollection, with two additional parameters:
Expand All @@ -80,7 +80,7 @@ StSvtDaqData::StSvtDaqData(StSvtConfig* config, StSVTReader* reader, char* optio
setData(reader,option);
}

int StSvtDaqData::setData(StSVTReader* reader, char* option)
int StSvtDaqData::setData(StSVTReader* reader, const char* option)
{
int status, index;

Expand Down
6 changes: 3 additions & 3 deletions StRoot/StSvtDaqMaker/StSvtDaqData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class StSvtDaqData: public StSvtData
{
public:
StSvtDaqData();
StSvtDaqData(const char* config, StSVTReader* reader=0, char* option = "ZS", int run=0, int event=0, int trigger=0);
StSvtDaqData(StSvtConfig* config, StSVTReader* reader=0, char* option = "ZS", int run=0, int event=0, int trigger=0);
StSvtDaqData(const char* config, StSVTReader* reader=0, const char* option = "ZS", int run=0, int event=0, int trigger=0);
StSvtDaqData(StSvtConfig* config, StSVTReader* reader=0, const char* option = "ZS", int run=0, int event=0, int trigger=0);

int setData(StSVTReader* reader, char* option = "ZS");
int setData(StSVTReader* reader, const char* option = "ZS");

protected:

Expand Down
4 changes: 2 additions & 2 deletions StRoot/StSvtDaqMaker/StSvtHybridDaqData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

ClassImp(StSvtHybridDaqData)

StSvtHybridDaqData::StSvtHybridDaqData(int barrel, int ladder, int wafer, int hybrid, StSVTReader* reader, char* option) :
StSvtHybridDaqData::StSvtHybridDaqData(int barrel, int ladder, int wafer, int hybrid, StSVTReader* reader, const char* option) :
StSvtHybridData(barrel, ladder, wafer, hybrid)
{
assert(sizeof(TPCSequence)==sizeof(StSequence));
Expand All @@ -51,7 +51,7 @@ StSvtHybridDaqData::StSvtHybridDaqData(int barrel, int ladder, int wafer, int hy
setHybridData(reader,option);
}

int StSvtHybridDaqData::setHybridData(StSVTReader* reader, char* option)
int StSvtHybridDaqData::setHybridData(StSVTReader* reader, const char* option)
{
// fills the data members of this object,
// so one can access the data through the two methods mentioned below.
Expand Down
4 changes: 2 additions & 2 deletions StRoot/StSvtDaqMaker/StSvtHybridDaqData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class StSVTReader;
class StSvtHybridDaqData: public StSvtHybridData
{
public:
StSvtHybridDaqData(int barrel, int ladder, int wafer, int hybrid, StSVTReader* reader=0, char* option="ZS");
StSvtHybridDaqData(int barrel, int ladder, int wafer, int hybrid, StSVTReader* reader=0, const char* option="ZS");

int setHybridData(StSVTReader* reader, char* option = "ZS");
int setHybridData(StSVTReader* reader, const char* option = "ZS");

protected:

Expand Down
2 changes: 1 addition & 1 deletion StRoot/StSvtPool/SvtMatchedTree/SvtMatchedTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SvtMatchedTree : public StMaker {
void Print(Option_t *opt="") const;
void SetMinNoHits(Int_t MinNoHits=0) {fMinNoHits = MinNoHits;}
void SetpCut(Double_t pCut=0.0) {fpCut = pCut;}
void SetOut(Char_t *Out="Event") {fOut = Out;}
void SetOut(const Char_t *Out="Event") {fOut = Out;}
void MakeListOfRotations();
private:
TFile *fFile;
Expand Down
2 changes: 1 addition & 1 deletion StRoot/StTofCalibMaker/StTofCalibMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ Int_t StTofCalibMaker::initParameters(int runnumber)

if(Debug()) gMessMgr->Info("","OS") << " Number of rows read in: " << numRows << " for INL tables" << endm;

Char_t *boardName;
const Char_t *boardName;
Short_t boardId;
Short_t tdcId;
Float_t INLcorr[1024];
Expand Down
6 changes: 3 additions & 3 deletions StRoot/StTofUtil/StTofrGeometry.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@

Bool_t StTofrNode::mDebug = kFALSE;
Double_t const StTofrGeomSensor::mSensorDy = 10.35; // Actual module length;
char* const StTofrGeometry::sectorPref = "BSEC";
char* const StTofrGeometry::trayPref = "BTRA";
char* const StTofrGeometry::senPref = "BRMD";
const char* const StTofrGeometry::sectorPref = "BSEC";
const char* const StTofrGeometry::trayPref = "BTRA";
const char* const StTofrGeometry::senPref = "BRMD";

//_____________________________________________________________________________
StTofrNode::StTofrNode(TVolumeView *element, TVolumeView *top)
Expand Down
6 changes: 3 additions & 3 deletions StRoot/StTofUtil/StTofrGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,9 @@ class StTofrGeometry : public TNamed {

static Bool_t mDebug; //!Control message printing of this class

static char* const sectorPref ;//= "BSEC";
static char* const trayPref ;//= "BTRA";
static char* const senPref ;//= "BRMD";
static const char* const sectorPref ;//= "BSEC";
static const char* const trayPref ;//= "BTRA";
static const char* const senPref ;//= "BRMD";

protected:
//void InitFromXdf(const char* xdffile);
Expand Down
Loading

0 comments on commit d0fce01

Please sign in to comment.