Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a c++14 mingw compiler error and some warnings #1082

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions HEN_HOUSE/cutils/egs_c_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ void egsOpenControlFile(const char *fname, int *status, int len) {
if (__my_fd > 0) {
break;
}
_sleep(1000);
#ifdef WIN32
Sleep(1000);
#else
_sleep(1000);
#endif
}
if (__my_fd < 0) {
*status = __my_fd;
Expand Down Expand Up @@ -208,7 +212,12 @@ void egsReadControlFile(char *buf, const int *n, int *status, int len) {

void egsSleep(const int *secs) {
unsigned int msecs = *secs * 1000;
_sleep(msecs);

#ifdef WIN32
Sleep(msecs);
#else
_sleep(msecs);
#endif
}
void egsPerror(const char *str, int len) {
perror(str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

EGS_PhspScoring::EGS_PhspScoring(const string &Name,
EGS_ObjectFactory *f) :
EGS_AusgabObject(Name,f), phsp_index(0), store_max(1000), phsp_file(0),
EGS_AusgabObject(Name,f), phsp_index(0), store_max(1000), phsp_file(),
count(0), countg(0), emin(1.e30), emax(-1.e30), first_flush(true), is_restart(false) {
otype = "EGS_PhspScoring";
}
Expand Down
7 changes: 6 additions & 1 deletion HEN_HOUSE/egs++/egs_base_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,12 @@ class EGS_EXPORT EGS_BaseSpectrum {
* This function prints information about the expected and actually
* sampled average energy of the spectrum using egsInformation().
*/
void reportAverageEnergy() const;
void reportAverageEnergy() const {
egsInformation("expected average energy: %g\n",expectedAverage());
EGS_Float e=0,de=0;
getSampledAverage(e,de);
egsInformation("sampled average energy: %g +/- %g\n",e,de);
};

protected:

Expand Down
2 changes: 1 addition & 1 deletion HEN_HOUSE/egs++/egs_run_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ void EGS_UniformRunControl::describeRCO() {
#define CLOSE_FILE _close
#define CREATE_FLAGS _O_CREAT | _O_EXCL | _O_RDWR, _S_IREAD | _S_IWRITE
#define OPEN_FLAGS _O_RDWR,_S_IREAD | _S_IWRITE
#define WAIT_FOR_FILE _sleep(1000)
#define WAIT_FOR_FILE Sleep(1000)
#define WRITE_FILE _write
#define READ_FILE _read

Expand Down
7 changes: 1 addition & 6 deletions HEN_HOUSE/egs++/egs_spectra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@

using namespace std;

void EGS_BaseSpectrum::reportAverageEnergy() const {
egsInformation("expected average energy: %g\n",expectedAverage());
EGS_Float e=0,de=0;
getSampledAverage(e,de);
egsInformation("sampled average energy: %g +/- %g\n",e,de);
}


/*! \brief A monoenergetic particle spectrum.
\ingroup egspp_main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ class EGS_NDG_EXPORT EGS_NDGeometry : public EGS_BaseGeometry {
EGS_Float &t, int *newmed=0, EGS_Vector *normal=0) {
if (ireg >= 0) {
int itmp = ireg;
int inext = -1, idelta, lnew_j=0;
int inext = -1, idelta=0, lnew_j=0;
for (int j=N-1; j>=0; j--) {
int l = itmp/n[j];
int lnew = g[j]->howfar(l,x,u,t,0,normal);
Expand Down
2 changes: 1 addition & 1 deletion HEN_HOUSE/iaea_phsp/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ FILE *open_file(char *filename, const char*extension, const char *access)
// char *filename1 = new(char[len+strlen(extension)+1]);

const int filenameLength = len+strlen(extension)+1;
char *filename1 = new(char[filenameLength]);
char *filename1 = new char[filenameLength];

strcpy(filename1,filename); // temp filename for appending extension

Expand Down
2 changes: 1 addition & 1 deletion HEN_HOUSE/omega/progs/ctcreate/ReadCT_DICOM.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ int string_to_doubles (const char *s,int num_doub)
}


F77_OBJ_(readct_dicom,READCT_DICOM)(char *ct_filename, int ct_arraysize[3],
int F77_OBJ_(readct_dicom,READCT_DICOM)(char *ct_filename, int ct_arraysize[3],
short *ctdata, float ct_offset[3],
float ct_voxelsize[3],int *ct_errorcode)
{
Expand Down
2 changes: 1 addition & 1 deletion HEN_HOUSE/user_codes/dosxyznrc/dosxyznrc.mortran
Original file line number Diff line number Diff line change
Expand Up @@ -4402,7 +4402,7 @@ REAL xbnd($IMAX+1), "voxel x boundaries"
ERR50AVG, "average % error of doses > 50% of max dose"
ERR50FRAC, "average error of doses > 50% of max"
" dose as a fraction of max dose"
DOSEFRAC, "fraction for calculating av. rel. uncertainty"
DOSEFRAC, "fraction for calculating av. rel. unc."
DOSEmin, "DOSEFRAC*MAXDOS(1)"
ARUFRAC; "average relative uncertainty on all voxels"
"with dose > DOSEFRAC*Dmax"
Expand Down