MCPcopy Create free account
hub / github.com/defold/defold / GetBaseFloat

Function GetBaseFloat

engine/dlib/src/dlib/configfile.cpp:146–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146static float GetBaseFloat(HConfigFile config, const char* key, float default_value)
147{
148 const char* tmp = GetBaseString(config, key, 0);
149 if (tmp == 0)
150 return default_value;
151 int l = strlen(tmp);
152 char* end = 0;
153 float ret = (float) strtod(tmp, &end);
154 if (end != (tmp + l) || end == tmp)
155 {
156 dmLogWarning("Unable to convert '%s' to float", tmp);
157 return default_value;
158 }
159 return ret;
160}
161
162static bool GetFloatOverride(HConfigFile config, const char* key, float default_value, float* out_value)
163{

Callers 1

ConfigFileGetFloatFunction · 0.85

Calls 1

GetBaseStringFunction · 0.85

Tested by

no test coverage detected