diff options
Diffstat (limited to 'libcutils/str_parms.c')
-rw-r--r-- | libcutils/str_parms.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libcutils/str_parms.c b/libcutils/str_parms.c index 9e1d2dc..7cfbcb3 100644 --- a/libcutils/str_parms.c +++ b/libcutils/str_parms.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2011-2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,8 @@ #include <cutils/str_parms.h> +#define UNUSED __attribute__((unused)) + struct str_parms { Hashmap *map; }; @@ -278,10 +280,11 @@ int str_parms_get_float(struct str_parms *str_parms, const char *key, return -ENOENT; out = strtof(value, &end); - if (*value != '\0' && *end == '\0') - return 0; + if (*value == '\0' || *end != '\0') + return -EINVAL; - return -EINVAL; + *val = out; + return 0; } static bool combine_strings(void *key, void *value, void *context) @@ -318,7 +321,7 @@ char *str_parms_to_str(struct str_parms *str_parms) return str; } -static bool dump_entry(void *key, void *value, void *context) +static bool dump_entry(void *key, void *value, void *context UNUSED) { ALOGI("key: '%s' value: '%s'\n", (char *)key, (char *)value); return true; |