aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndrew Hannam <andrewh@inmarket.com.au>2013-04-04 17:55:45 +1000
committerAndrew Hannam <andrewh@inmarket.com.au>2013-04-04 17:55:45 +1000
commitce9b930af0d242bfc61579f4b9badba7d04c5c8e (patch)
treef83fe472ddc26ec0039b0f00cff1b4c8b17d6619 /tools
parentb95151c7c22eed7336fdef3a3587138cddf070e4 (diff)
downloaduGFX-ce9b930af0d242bfc61579f4b9badba7d04c5c8e.tar.gz
uGFX-ce9b930af0d242bfc61579f4b9badba7d04c5c8e.tar.bz2
uGFX-ce9b930af0d242bfc61579f4b9badba7d04c5c8e.zip
Fix to file2c to ensure valid C identifiers
A couple of small bug fixes.
Diffstat (limited to 'tools')
-rw-r--r--tools/file2c/Binaries - Win32/file2c.exebin9216 -> 9216 bytes
-rw-r--r--tools/file2c/Source/VS 2012 Project/file2c.v11.suobin24064 -> 25600 bytes
-rw-r--r--tools/file2c/Source/file2c.c10
3 files changed, 9 insertions, 1 deletions
diff --git a/tools/file2c/Binaries - Win32/file2c.exe b/tools/file2c/Binaries - Win32/file2c.exe
index 98527955..d1959ad6 100644
--- a/tools/file2c/Binaries - Win32/file2c.exe
+++ b/tools/file2c/Binaries - Win32/file2c.exe
Binary files differ
diff --git a/tools/file2c/Source/VS 2012 Project/file2c.v11.suo b/tools/file2c/Source/VS 2012 Project/file2c.v11.suo
index 72b57521..586b2c04 100644
--- a/tools/file2c/Source/VS 2012 Project/file2c.v11.suo
+++ b/tools/file2c/Source/VS 2012 Project/file2c.v11.suo
Binary files differ
diff --git a/tools/file2c/Source/file2c.c b/tools/file2c/Source/file2c.c
index 2bcb4560..d2b862e6 100644
--- a/tools/file2c/Source/file2c.c
+++ b/tools/file2c/Source/file2c.c
@@ -23,6 +23,13 @@ static char *filenameof(char *fname) {
return fname;
}
+static char *clean4c(char *fname) {
+ char *p;
+
+ while((p = strpbrk(fname, "-+ `~!@#$%^&*(){}[]|:;'\",<>?/|="))) *p = '_';
+ return fname;
+}
+
int main(int argc, char * argv[])
{
char * opt_progname;
@@ -115,6 +122,7 @@ size_t i;
opt_arrayname = filenameof(opt_inputfile);
if (!opt_arrayname || !opt_arrayname[0])
opt_arrayname = "filearray";
+ opt_arrayname = clean4c(opt_arrayname);
}
/* Read the file processing 1K at a time */
@@ -125,7 +133,7 @@ size_t i;
else if (opt_breakblocks)
fprintf(f_output, "\n};\n%s%sunsigned char %s_p%u[] = {", opt_static, opt_const, opt_arrayname, blocknum);
for(i = 0; i < len; i++) {
- fprintf(f_output, (i & 0x0F) ? ", 0x%02X" : "\n\t0x%02X", buf[i]);
+ fprintf(f_output, (i & 0x0F) ? " 0x%02X," : "\n\t0x%02X,", buf[i]);
}
}
fprintf(f_output, "\n};\n");