提交 d3909d74 编写于 作者: W Wolfgang Denk

Merge branch 'master' of git://git.denx.de/u-boot-fdt

...@@ -574,14 +574,18 @@ static int fdt_parse_prop(char **newval, int count, char *data, int *len) ...@@ -574,14 +574,18 @@ static int fdt_parse_prop(char **newval, int count, char *data, int *len)
* Byte stream. Convert the values. * Byte stream. Convert the values.
*/ */
newp++; newp++;
while ((*newp != ']') && (stridx < count)) { while ((stridx < count) && (*newp != ']')) {
tmp = simple_strtoul(newp, &newp, 16);
*data++ = tmp & 0xFF;
*len = *len + 1;
while (*newp == ' ') while (*newp == ' ')
newp++; newp++;
if (*newp != '\0') if (*newp == '\0') {
newp = newval[++stridx]; newp = newval[++stridx];
continue;
}
if (!isxdigit(*newp))
break;
tmp = simple_strtoul(newp, &newp, 16);
*data++ = tmp & 0xFF;
*len = *len + 1;
} }
if (*newp != ']') { if (*newp != ']') {
printf("Unexpected character '%c'\n", *newp); printf("Unexpected character '%c'\n", *newp);
...@@ -589,12 +593,15 @@ static int fdt_parse_prop(char **newval, int count, char *data, int *len) ...@@ -589,12 +593,15 @@ static int fdt_parse_prop(char **newval, int count, char *data, int *len)
} }
} else { } else {
/* /*
* Assume it is a string. Copy it into our data area for * Assume it is one or more strings. Copy it into our
* convenience (including the terminating '\0'). * data area for convenience (including the
* terminating '\0's).
*/ */
while (stridx < count) { while (stridx < count) {
*len = strlen(newp) + 1; size_t length = strlen(newp) + 1;
strcpy(data, newp); strcpy(data, newp);
data += length;
*len += length;
newp = newval[++stridx]; newp = newval[++stridx];
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册