forked from len0rd/rockbox
Bugfix: some settings can have spaces in them
90bc769 strips spaces from the settings value, but it
goes to the first space rather than just stripping off
the last one. Break out of the loop when we find the
first non-space character.
Also change 0 to '\0' for readability.
Change-Id: I915b82a6d1603740998a67c575d08005456ffbd8
This commit is contained in:
parent
f6f12db062
commit
3555e84a7a
1 changed files with 5 additions and 4 deletions
|
|
@ -268,17 +268,18 @@ bool settings_parseline(char* line, char** name, char** value)
|
|||
return false;
|
||||
|
||||
*name = line;
|
||||
*ptr = 0;
|
||||
*ptr = '\0'; /* terminate previous */
|
||||
ptr++;
|
||||
ptr = skip_whitespace(ptr);
|
||||
*value = ptr;
|
||||
|
||||
/* strip whitespace from the right side of value */
|
||||
ptr += strlen(ptr);
|
||||
for (ptr--; ptr >= *value; ptr--)
|
||||
ptr--;
|
||||
while ((ptr > (*value) - 1) && isspace(*ptr))
|
||||
{
|
||||
if (isspace(*ptr))
|
||||
*ptr = '\0';
|
||||
*ptr = '\0';
|
||||
ptr--;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue