schiff

Estimate the radiative properties of soft particless
git clone git://git.meso-star.com/schiff.git
Log | Files | Refs | README | LICENSE

commit 516b7908bc85efeb55ef1b0cf4e582eeb4b48556
parent ee3942c7f94d163141428ce8a78d6797ee8ae196
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 20 Oct 2015 16:40:43 +0200

Fix an issue in the parsing of the Schiff optical properties file

Diffstat:
Msrc/sbox_schiff_optical_properties.c | 13+++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/sbox_schiff_optical_properties.c b/src/sbox_schiff_optical_properties.c @@ -65,8 +65,7 @@ parse_optical_properties } strncpy(buf, str, sizeof(buf)); - tk = strtok(buf, " \t"); - while(tk) { + for(i=0, tk=strtok(buf, " \t"); tk && i < 4; ++i, tk=strtok(NULL, " \t")) { res = sbox_str_to_double(tk, props + i); if(res != RES_OK) { logger_print(&sbox->logger, LOG_WARNING, @@ -74,8 +73,6 @@ parse_optical_properties filename, (unsigned long)iline, tk); return res; } - tk = strtok(NULL, " \t"); - ++i; } if(i < 4) { logger_print(&sbox->logger, LOG_WARNING, @@ -139,8 +136,7 @@ sbox_schiff_optical_properties_load } buf = sa_add(buf, buf_chunk); - iline = 1; - while(fgets(buf, (int)sa_size(buf), fp)) { + for(iline = 1; fgets(buf, (int)sa_size(buf), fp); ++iline) { char* line; size_t last_char; struct sbox_schiff_optical_properties tmp_props; @@ -159,11 +155,12 @@ sbox_schiff_optical_properties_load while(last_char-- && (line[last_char]=='\n' || line[last_char]=='\r')); line[last_char + 1] = '\0'; - if(*line == '\0' /*Empty line*/ && *line == '#' /* Comment */) + if(*line == '\0' /*Empty line*/ || *line == '#' /* Comment */) continue; /* Read optical properties */ - parse_optical_properties(sbox, filename, iline, line, &tmp_props); + res = parse_optical_properties + (sbox, filename, iline, strtok(line, "#"), &tmp_props); if(res == RES_OK) { /* *NO* error */ sa_push(props, tmp_props); }