summaryrefslogtreecommitdiff
path: root/plugingui/rcgen.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-04-20 20:01:32 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-04-20 20:13:26 +0200
commit815d4eeae5a10bb1dbdd9e8810523644dfbadc5f (patch)
tree585c252a80d666da7122e4523ada34987a9bc682 /plugingui/rcgen.cc
parent5d6b52c7d4c0cf14d9889d28c94025c231d66b6e (diff)
Fix rcgen code style.
Diffstat (limited to 'plugingui/rcgen.cc')
-rw-r--r--plugingui/rcgen.cc71
1 files changed, 39 insertions, 32 deletions
diff --git a/plugingui/rcgen.cc b/plugingui/rcgen.cc
index 5eb3a4c..a30f7b4 100644
--- a/plugingui/rcgen.cc
+++ b/plugingui/rcgen.cc
@@ -29,43 +29,50 @@
int main(int argc, char *argv[])
{
- printf("/* This file is autogenerated by rcgen. Do not modify! */\n");
- printf("#include \"resource_data.h\"\n");
- printf("\n");
- printf("const rc_data_t rc_data[] =\n");
+ printf("/* This file is autogenerated by rcgen. Do not modify! */\n");
+ printf("#include \"resource_data.h\"\n");
+ printf("\n");
+ printf("const rc_data_t rc_data[] =\n");
printf("{\n");
- int i = 1;
- while(i < argc) {
- printf(" { \":%s\", ", argv[i]);
-
- std::string data;
- FILE *fp = fopen(argv[i], "rb");
- if(!fp) {
- fprintf(stderr, "Could not read file '%s' - quitting\n", argv[i]);
- return 1;
- }
+ int i = 1;
+ while(i < argc)
+ {
+ printf(" {\n \":%s\", ", argv[i]);
- char buf[32];
- while(!feof(fp)) {
- size_t sz = fread(buf, 1, sizeof(buf), fp);
- data.append(buf, sz);
- }
- fclose(fp);
+ std::string data;
+ FILE *fp = fopen(argv[i], "rb");
+ if(!fp)
+ {
+ fprintf(stderr, "Could not read file '%s' - quitting\n", argv[i]);
+ return 1;
+ }
- printf("%d,\n \"", (int)data.length());
- for(size_t j = 0; j < data.length(); j++) {
- if(j != 0 && j % 16 == 0) printf("\"\n \"");
- printf("\\%o", (unsigned char)data[j]);
- }
+ char buf[32];
+ while(!feof(fp))
+ {
+ std::size_t sz = fread(buf, 1, sizeof(buf), fp);
+ data.append(buf, sz);
+ }
+ fclose(fp);
- printf("\" },\n");
-
- i++;
- }
+ printf("%d,\n \"", (int)data.length());
+ for(std::size_t j = 0; j < data.length(); ++j)
+ {
+ if((j != 0) && (j % 16) == 0)
+ {
+ printf("\"\n \"");
+ }
+ printf("\\%o", (unsigned char)data[j]);
+ }
-printf(" { \"\", 0, 0 }\n");
-printf("};\n");
+ printf("\"\n },\n");
- return 0;
+ ++i;
+ }
+
+ printf(" { \"\", 0, 0 }\n");
+ printf("};\n");
+
+ return 0;
}