Skip to content

Commit

Permalink
fix all warnings for gcc 7
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Feb 6, 2020
1 parent a5ac4a9 commit dbea367
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/mcx_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ void mcx_savenii(OutputType *dat, size_t len, char* name, int type32bit, int out

void mcx_savedata(OutputType *dat, size_t len, mcconfig *cfg,int isref){
FILE *fp;
char name[MAX_PATH_LENGTH];
char fname[MAX_PATH_LENGTH];
char name[MAX_FULL_PATH];
char fname[MAX_FULL_PATH];
unsigned int glformat=GL_RGBA32F;

if(cfg->rootpath[0])
Expand Down Expand Up @@ -796,7 +796,7 @@ void mcx_loadconfig(FILE *in, mcconfig *cfg){
int i,gates,srctype,itmp;
size_t nphoton;
float dtmp;
char comment[MAX_PATH_LENGTH],*comm, srctypestr[MAX_SESSION_LENGTH]={'\0'};
char comment[MAX_FULL_PATH],*comm, srctypestr[MAX_SESSION_LENGTH]={'\0'};

if(in==stdin)
MMC_FPRINTF(stdout,"Please specify the total number of photons: [1000000]\n\t");
Expand Down Expand Up @@ -1517,7 +1517,7 @@ void mcx_parsecmd(int argc, char* argv[], mcconfig *cfg){

void mcx_savedetphoton(float *ppath, void *seeds, int count, int doappend, mcconfig *cfg){
FILE *fp;
char fhistory[MAX_PATH_LENGTH];
char fhistory[MAX_FULL_PATH];
if(cfg->rootpath[0])
sprintf(fhistory,"%s%c%s.mch",cfg->rootpath,pathsep,cfg->session);
else
Expand Down
2 changes: 2 additions & 0 deletions src/mcx_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

#define MAX_PROP 256 /**< max optical property count */
#define MAX_DETECTORS 256 /**< max number of detectors */

#define MAX_FULL_PATH 2048 /**< max characters in a full file name string */
#define MAX_PATH_LENGTH 1024 /**< max characters in a full file name string */
#define MAX_SESSION_LENGTH 256 /**< max session name length */
#define MAX_CHECKPOINT 16 /**< max number of photon save points */
Expand Down
18 changes: 9 additions & 9 deletions src/simpmesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void mesh_error(const char *msg,const char *file,const int linenum){
*/

void mesh_filenames(const char *format,char *foutput,mcconfig *cfg){
char filename[MAX_PATH_LENGTH];
char filename[MAX_FULL_PATH];
sprintf(filename,format,cfg->meshtag);

if(cfg->rootpath[0])
Expand All @@ -174,7 +174,7 @@ void mesh_filenames(const char *format,char *foutput,mcconfig *cfg){
void mesh_loadnode(tetmesh *mesh,mcconfig *cfg){
FILE *fp;
int tmp,len,i;
char fnode[MAX_PATH_LENGTH];
char fnode[MAX_FULL_PATH];
mesh_filenames("node_%s.dat",fnode,cfg);
if((fp=fopen(fnode,"rt"))==NULL){
MESH_ERROR("can not open node file");
Expand Down Expand Up @@ -236,7 +236,7 @@ void mesh_createdualmesh(tetmesh *mesh,mcconfig *cfg){
void mesh_loadmedia(tetmesh *mesh,mcconfig *cfg){
FILE *fp;
int tmp,len,i;
char fmed[MAX_PATH_LENGTH];
char fmed[MAX_FULL_PATH];
mesh_filenames("prop_%s.dat",fmed,cfg);
if((fp=fopen(fmed,"rt"))==NULL){
MESH_ERROR("can not open media property file");
Expand Down Expand Up @@ -290,7 +290,7 @@ void mesh_loadelem(tetmesh *mesh,mcconfig *cfg){
FILE *fp;
int tmp,len,i,j,datalen;
int *pe;
char felem[MAX_PATH_LENGTH];
char felem[MAX_FULL_PATH];

mesh_filenames("elem_%s.dat",felem,cfg);
if((fp=fopen(felem,"rt"))==NULL){
Expand Down Expand Up @@ -376,7 +376,7 @@ void mesh_srcdetelem(tetmesh *mesh,mcconfig *cfg){
void mesh_loadelemvol(tetmesh *mesh,mcconfig *cfg){
FILE *fp;
int tmp,len,i,j,*ee;
char fvelem[MAX_PATH_LENGTH];
char fvelem[MAX_FULL_PATH];
mesh_filenames("velem_%s.dat",fvelem,cfg);
if((fp=fopen(fvelem,"rt"))==NULL){
MESH_ERROR("can not open element volume file");
Expand Down Expand Up @@ -411,7 +411,7 @@ void mesh_loadfaceneighbor(tetmesh *mesh,mcconfig *cfg){
FILE *fp;
int len,i,j;
int *pe;
char ffacenb[MAX_PATH_LENGTH];
char ffacenb[MAX_FULL_PATH];
mesh_filenames("facenb_%s.dat",ffacenb,cfg);

if((fp=fopen(ffacenb,"rt"))==NULL){
Expand Down Expand Up @@ -911,7 +911,7 @@ void mesh_saveweightat(tetmesh *mesh,mcconfig *cfg,int id){
void mesh_saveweight(tetmesh *mesh,mcconfig *cfg,int isref){
FILE *fp;
int i,j, datalen=(cfg->method==rtBLBadouelGrid) ? cfg->crop0.z : ( (cfg->basisorder) ? mesh->nn : mesh->ne);
char fweight[MAX_PATH_LENGTH];
char fweight[MAX_FULL_PATH];
double *data=mesh->weight;

if(isref){
Expand Down Expand Up @@ -967,7 +967,7 @@ void mesh_saveweight(tetmesh *mesh,mcconfig *cfg,int isref){

void mesh_savedetphoton(float *ppath, void *seeds, int count, int seedbyte, mcconfig *cfg){
FILE *fp;
char fhistory[MAX_PATH_LENGTH];
char fhistory[MAX_FULL_PATH];
if(cfg->rootpath[0])
sprintf(fhistory,"%s%c%s.mch",cfg->rootpath,pathsep,cfg->session);
else
Expand Down Expand Up @@ -1063,7 +1063,7 @@ void mesh_getdetimage(float *detmap, float *ppath, int count, mcconfig *cfg, tet
void mesh_savedetimage(float *detmap, mcconfig *cfg){

FILE *fp;
char fhistory[MAX_PATH_LENGTH];
char fhistory[MAX_FULL_PATH];
if(cfg->rootpath[0])
sprintf(fhistory,"%s%c%s.img",cfg->rootpath,pathsep,cfg->session);
else
Expand Down
2 changes: 1 addition & 1 deletion src/tictoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "tictoc.h"

#define _BSD_SOURCE
#define _DEFAULT_SOURCE

#ifndef USE_OS_TIMER

Expand Down

0 comments on commit dbea367

Please sign in to comment.