libobs: Use locale-independent double conversion

Prevents issues on specific locales, especially where decimal points are
represented by commas rather than periods.
This commit is contained in:
jp9000
2015-03-21 13:23:41 -07:00
parent 4abae186ce
commit d44d3b1f0a
5 changed files with 110 additions and 8 deletions

View File

@@ -16,6 +16,7 @@
******************************************************************************/
#include <assert.h>
#include "../util/platform.h"
#include "effect-parser.h"
#include "effect.h"
@@ -735,7 +736,7 @@ static inline int ep_parse_param_assign_intfloat(struct effect_parser *ep,
return code;
if (is_float) {
float f = (float)strtod(ep->cfp.cur_token->str.array, NULL);
float f = (float)os_strtod(ep->cfp.cur_token->str.array);
if (is_negative) f = -f;
da_push_back_array(param->default_val, &f, sizeof(float));
} else {

View File

@@ -15,6 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include "../util/platform.h"
#include "shader-parser.h"
enum gs_shader_param_type get_shader_param_type(const char *type)
@@ -489,7 +490,7 @@ static inline int sp_parse_param_assign_intfloat(struct shader_parser *sp,
return code;
if (is_float) {
float f = (float)strtod(sp->cfp.cur_token->str.array, NULL);
float f = (float)os_strtod(sp->cfp.cur_token->str.array);
if (is_negative) f = -f;
da_push_back_array(param->default_val, &f, sizeof(float));
} else {