equal
deleted
inserted
replaced
177 const char *value = findValue(ini->inidict, ini->currentSection, key); |
177 const char *value = findValue(ini->inidict, ini->currentSection, key); |
178 if(!value) { |
178 if(!value) { |
179 value = def; |
179 value = def; |
180 } |
180 } |
181 char *valueDup = flib_strdupnull(value); |
181 char *valueDup = flib_strdupnull(value); |
182 if(valueDup) { |
182 if(valueDup || !def) { |
183 *outVar = valueDup; |
183 *outVar = valueDup; |
184 result = 0; |
184 result = 0; |
185 } |
185 } |
186 } |
186 } |
187 return result; |
187 return result; |
207 int flib_ini_get_int_opt(flib_ini *ini, int *outVar, const char *key, int def) { |
207 int flib_ini_get_int_opt(flib_ini *ini, int *outVar, const char *key, int def) { |
208 int tmpValue; |
208 int tmpValue; |
209 int result = flib_ini_get_int(ini, &tmpValue, key); |
209 int result = flib_ini_get_int(ini, &tmpValue, key); |
210 if(result == 0) { |
210 if(result == 0) { |
211 *outVar = tmpValue; |
211 *outVar = tmpValue; |
212 } else if(result == INI_ERROR_NOTFOUND) { |
212 } else if(result == INI_ERROR_NOTFOUND || result == INI_ERROR_FORMAT) { |
213 *outVar = def; |
213 *outVar = def; |
214 result = 0; |
214 result = 0; |
215 } |
215 } |
216 return result; |
216 return result; |
217 } |
217 } |
236 int flib_ini_get_bool_opt(flib_ini *ini, bool *outVar, const char *key, bool def) { |
236 int flib_ini_get_bool_opt(flib_ini *ini, bool *outVar, const char *key, bool def) { |
237 bool tmpValue; |
237 bool tmpValue; |
238 int result = flib_ini_get_bool(ini, &tmpValue, key); |
238 int result = flib_ini_get_bool(ini, &tmpValue, key); |
239 if(result == 0) { |
239 if(result == 0) { |
240 *outVar = tmpValue; |
240 *outVar = tmpValue; |
241 } else if(result == INI_ERROR_NOTFOUND) { |
241 } else if(result == INI_ERROR_NOTFOUND || result == INI_ERROR_FORMAT) { |
242 *outVar = def; |
242 *outVar = def; |
243 result = 0; |
243 result = 0; |
244 } |
244 } |
245 return result; |
245 return result; |
246 } |
246 } |