From 815d4eeae5a10bb1dbdd9e8810523644dfbadc5f Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 20 Apr 2017 20:01:32 +0200 Subject: Fix rcgen code style. --- plugingui/rcgen.cc | 71 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 32 deletions(-) (limited to 'plugingui') 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; } -- cgit v1.2.3