diff --git a/src/binary_c_code_options.h b/src/binary_c_code_options.h index d4e5df4faa21e7b95921809a28d927d1412115a5..80a7fd53b812455374e598558f16abe37059d240 100644 --- a/src/binary_c_code_options.h +++ b/src/binary_c_code_options.h @@ -905,6 +905,12 @@ void Print_trace(void); #define strncpy ___DUMMY #undef strncat #define strncat ___DUMMY +#undef atof +#define strncat ___DUMMY +#undef atoi +#define strncat ___DUMMY +#undef atol +#define strncat ___DUMMY #endif // BAN_UNSAFE_FUNCTIONS diff --git a/src/main.c b/src/main.c index 47a60552fb02e8cc3bd478f935dccfdc5fe5ec71..43bf4583c38b3144ada1254664d9ca75023523b2 100644 --- a/src/main.c +++ b/src/main.c @@ -118,10 +118,10 @@ static int binary_c_main(int argc, { printf("You must run binary_c with four arguments (X,Z,T,rho) to test the opacity table\n"); } - op.H = atof(argv[1]); - op.Z = atof(argv[2]); - op.temperature = atof(argv[3]); - op.density = atof(argv[4]); + op.H = strtod(argv[1],NULL); + op.Z = strtod(argv[2],NULL); + op.temperature = strtod(argv[3],NULL); + op.density = strtod(argv[4],NULL); double kap_pac = opacity_paczynski(stardata,&op,OPACITY_ALGORITHM_PACZYNSKI); double kap_fop = opacity_ferguson_opal(stardata,&op,OPACITY_ALGORITHM_FERGUSON_OPAL); diff --git a/src/setup/argument_setting_functions.c b/src/setup/argument_setting_functions.c index 4182dd1fc11d4b56e3e263a5f3032a6f83279d23..300c62a838ad4dcaf9de56029e8eb1d8e12ec157 100644 --- a/src/setup/argument_setting_functions.c +++ b/src/setup/argument_setting_functions.c @@ -10,8 +10,7 @@ static char * arg_variable_default_string( void binary_c_warmup_cpu(ARG_SUBROUTINE_DECLARATION) { (*c)++; - const int secs = atoi(argv[*c]); - printf("secs warmup %d\n",secs); + const int secs = (int) strtol(argv[*c],NULL,10); if(secs!=0)warmup_cpu(stardata,secs); } @@ -389,10 +388,10 @@ void No_return dumpversion(ARG_SUBROUTINE_DECLARATION) void set_init_abund_mult(ARG_SUBROUTINE_DECLARATION) { (*c)++; - int n MAYBE_UNUSED =atoi(argv[*c]); + Isotope n MAYBE_UNUSED = (Isotope)strtol(argv[*c],NULL,10); (*c)++; #ifdef NUCSYN - double f=atof(argv[*c]); + double f = strtod(argv[*c],NULL); if(n<ISOTOPE_ARRAY_SIZE) stardata->preferences->initial_abundance_multiplier[n]=f; #endif } @@ -400,10 +399,10 @@ void set_init_abund_mult(ARG_SUBROUTINE_DECLARATION) void set_init_abund_dex(ARG_SUBROUTINE_DECLARATION) { (*c)++; - int n MAYBE_UNUSED =atoi(argv[*c]); + Isotope n MAYBE_UNUSED = (Isotope)strtol(argv[*c],NULL,10); (*c)++; #ifdef NUCSYN - double f=atof(argv[*c]); + double f = strtod(argv[*c],NULL); f = pow(10.0,f); if(n<ISOTOPE_ARRAY_SIZE) stardata->preferences->initial_abundance_multiplier[n]=f; //fprintf(stderr,"SET MULT %d to %g\n",n,f); @@ -413,10 +412,10 @@ void set_init_abund_dex(ARG_SUBROUTINE_DECLARATION) void set_init_abund(ARG_SUBROUTINE_DECLARATION) { (*c)++; - int n MAYBE_UNUSED =atoi(argv[*c]); + Isotope n MAYBE_UNUSED = (Isotope)strtol(argv[*c],NULL,10); (*c)++; #ifdef NUCSYN - double X=atof(argv[*c]); + double X = strtod(argv[*c],NULL); if(n<ISOTOPE_ARRAY_SIZE) stardata->preferences->the_initial_abundances[n]=X; #endif } @@ -424,10 +423,10 @@ void set_init_abund(ARG_SUBROUTINE_DECLARATION) void set_third_dup_multiplier(ARG_SUBROUTINE_DECLARATION) { (*c)++; - int n MAYBE_UNUSED =atoi(argv[*c]); + Isotope n MAYBE_UNUSED = (Isotope)strtol(argv[*c],NULL,10); (*c)++; #if defined (NUCSYN) && defined(THIRD_DREDGE_UP) && defined(NUCSYN_THIRD_DREDGE_UP_MULTIPLIERS) - double X=atof(argv[*c]); + double X = strtod(argv[*c],NULL); if(n<ISOTOPE_ARRAY_SIZE) stardata->preferences->third_dup_multiplier[n]=X; preferences->boost_third_dup=TRUE; #endif diff --git a/src/setup/version.c b/src/setup/version.c index d291c6e36707a53a493f81766673510b87dd09f0..86d40c36ad21aa697ccf3f11ba6dc40e93249030 100644 --- a/src/setup/version.c +++ b/src/setup/version.c @@ -390,10 +390,10 @@ void version(struct stardata_t * RESTRICT const stardata) * This defaults to 100ms, but can be set using the * NMS environment variable. */ - int nms; + long int nms; char * nmsstring = getenv("NMS"); - nms = nmsstring==NULL ? 100 : atoi(nmsstring); - Printf("Speed tests for %d milliseconds\n",nms); + nms = nmsstring==NULL ? 100 : (strtol(nmsstring,NULL,10)); + Printf("Speed tests for %ld milliseconds\n",nms); fflush(stdout); /* @@ -406,7 +406,7 @@ void version(struct stardata_t * RESTRICT const stardata) ticks t1 = getticks(); \ if(t1!=0) \ { \ - t1 += nms * millisecond; \ + t1 += (ticks)(nms * millisecond); \ while(getticks()<t1) \ { \ { \ @@ -1867,5 +1867,5 @@ void version(struct stardata_t * RESTRICT const stardata) static float __test_seconds(void) { char * t = getenv("BINARY_C_SPEEDTEST_SECONDS"); - return t == NULL ? 1 : atof(t); + return t == NULL ? 1 : strtod(t,NULL); } diff --git a/src/string/string_array_to_double_array.c b/src/string/string_array_to_double_array.c index 3075780b21ed3153c33f4f4f7473963cb2b928c4..0ecdc871d7bfec7eaf51d324f06a8840f3b250d7 100644 --- a/src/string/string_array_to_double_array.c +++ b/src/string/string_array_to_double_array.c @@ -15,6 +15,6 @@ void string_array_to_double_array(char ** RESTRICT const strings, size_t i; for(i=0;i<n;i++) { - (*doubles)[i] = atof(strings[i]); + (*doubles)[i] = strtod(strings[i],NULL); } }