diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-08-12 12:10:11 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-08-12 12:10:11 -0400 |
commit | 809773474d2590fbace4eed3f6377c75d3d11589 (patch) | |
tree | 8410c9a09e6620acb6602da85488230e209d492e | |
parent | a8be2b6f17baa974ce4fa07dec30bf1e03abb9ab (diff) | |
download | stasis-809773474d2590fbace4eed3f6377c75d3d11589.tar.gz |
bugfix: use strtof in INIVAL_TYPE_FLOAT case
* Include stdio.h to pull in FILE structure
-rw-r--r-- | include/ini.h | 1 | ||||
-rw-r--r-- | src/ini.c | 3 |
2 files changed, 2 insertions, 2 deletions
diff --git a/include/ini.h b/include/ini.h index 2992a37..3d0565b 100644 --- a/include/ini.h +++ b/include/ini.h @@ -2,6 +2,7 @@ #ifndef STASIS_INI_H #define STASIS_INI_H +#include <stdio.h> #include <stddef.h> #include <stdbool.h> @@ -170,7 +170,7 @@ int ini_getval(struct INIFILE *ini, char *section_name, char *key, int type, int result->as_double = (double) strtod(data_copy, NULL); break; case INIVAL_TYPE_FLOAT: - result->as_float = (float) strtod(data_copy, NULL); + result->as_float = strtof(data_copy, NULL); break; case INIVAL_TYPE_STR: result->as_char_p = strdup(data_copy); @@ -638,7 +638,6 @@ struct INIFILE *ini_open(const char *filename) { } if (isempty(value)) { //printf("%s is probably long raw data\n", key); - //ini_data_set_hint(&ini, current_section, key, INIVAL_TYPE_STR_ARRAY); hint = INIVAL_TYPE_STR_ARRAY; multiline_data = 1; no_data = 1; |