diff options
Diffstat (limited to 'scripts/dtc/treesource.c')
-rw-r--r-- | scripts/dtc/treesource.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c index 5740e6992d37..a55d1d128cce 100644 --- a/scripts/dtc/treesource.c +++ b/scripts/dtc/treesource.c | |||
@@ -26,12 +26,12 @@ extern int yyparse(void); | |||
26 | extern YYLTYPE yylloc; | 26 | extern YYLTYPE yylloc; |
27 | 27 | ||
28 | struct boot_info *the_boot_info; | 28 | struct boot_info *the_boot_info; |
29 | int treesource_error; | 29 | bool treesource_error; |
30 | 30 | ||
31 | struct boot_info *dt_from_source(const char *fname) | 31 | struct boot_info *dt_from_source(const char *fname) |
32 | { | 32 | { |
33 | the_boot_info = NULL; | 33 | the_boot_info = NULL; |
34 | treesource_error = 0; | 34 | treesource_error = false; |
35 | 35 | ||
36 | srcfile_push(fname); | 36 | srcfile_push(fname); |
37 | yyin = current_srcfile->f; | 37 | yyin = current_srcfile->f; |
@@ -54,9 +54,9 @@ static void write_prefix(FILE *f, int level) | |||
54 | fputc('\t', f); | 54 | fputc('\t', f); |
55 | } | 55 | } |
56 | 56 | ||
57 | static int isstring(char c) | 57 | static bool isstring(char c) |
58 | { | 58 | { |
59 | return (isprint(c) | 59 | return (isprint((unsigned char)c) |
60 | || (c == '\0') | 60 | || (c == '\0') |
61 | || strchr("\a\b\t\n\v\f\r", c)); | 61 | || strchr("\a\b\t\n\v\f\r", c)); |
62 | } | 62 | } |
@@ -109,7 +109,7 @@ static void write_propval_string(FILE *f, struct data val) | |||
109 | break; | 109 | break; |
110 | case '\0': | 110 | case '\0': |
111 | fprintf(f, "\", "); | 111 | fprintf(f, "\", "); |
112 | while (m && (m->offset < i)) { | 112 | while (m && (m->offset <= (i + 1))) { |
113 | if (m->type == LABEL) { | 113 | if (m->type == LABEL) { |
114 | assert(m->offset == (i+1)); | 114 | assert(m->offset == (i+1)); |
115 | fprintf(f, "%s: ", m->ref); | 115 | fprintf(f, "%s: ", m->ref); |
@@ -119,7 +119,7 @@ static void write_propval_string(FILE *f, struct data val) | |||
119 | fprintf(f, "\""); | 119 | fprintf(f, "\""); |
120 | break; | 120 | break; |
121 | default: | 121 | default: |
122 | if (isprint(c)) | 122 | if (isprint((unsigned char)c)) |
123 | fprintf(f, "%c", c); | 123 | fprintf(f, "%c", c); |
124 | else | 124 | else |
125 | fprintf(f, "\\x%02hhx", c); | 125 | fprintf(f, "\\x%02hhx", c); |
@@ -178,7 +178,7 @@ static void write_propval_bytes(FILE *f, struct data val) | |||
178 | m = m->next; | 178 | m = m->next; |
179 | } | 179 | } |
180 | 180 | ||
181 | fprintf(f, "%02hhx", *bp++); | 181 | fprintf(f, "%02hhx", (unsigned char)(*bp++)); |
182 | if ((const void *)bp >= propend) | 182 | if ((const void *)bp >= propend) |
183 | break; | 183 | break; |
184 | fprintf(f, " "); | 184 | fprintf(f, " "); |
@@ -281,3 +281,4 @@ void dt_to_source(FILE *f, struct boot_info *bi) | |||
281 | 281 | ||
282 | write_tree_source_node(f, bi->dt, 0); | 282 | write_tree_source_node(f, bi->dt, 0); |
283 | } | 283 | } |
284 | |||