summaryrefslogtreecommitdiffstats
path: root/scripts/dtc/treesource.c
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2015-04-29 17:00:05 -0400
committerRob Herring <robh@kernel.org>2015-04-29 18:17:27 -0400
commit4760597116e34bd58f670d008ae7323653268fb4 (patch)
tree2b27799a1dfc5171c7d502cb2ffe094d93ecf7f8 /scripts/dtc/treesource.c
parentf1ec7187167ce225d2744b20a90afef5f10fd6cd (diff)
scripts/dtc: Update to upstream version 9d3649bd3be245c9
Sync dtc with upstream as of commit 9d3649bd3be2 (Add testcases for fdt_path_offset_namelen()). Signed-off-by: Rob Herring <robh@kernel.org> Cc: Grant Likely <grant.likely@linaro.org> Cc: devicetree@vger.kernel.org
Diffstat (limited to 'scripts/dtc/treesource.c')
-rw-r--r--scripts/dtc/treesource.c15
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);
26extern YYLTYPE yylloc; 26extern YYLTYPE yylloc;
27 27
28struct boot_info *the_boot_info; 28struct boot_info *the_boot_info;
29int treesource_error; 29bool treesource_error;
30 30
31struct boot_info *dt_from_source(const char *fname) 31struct 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
57static int isstring(char c) 57static 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