From 40fffc8fff1c725add39482785b35386a7f8cf9c Mon Sep 17 00:00:00 2001
From: Amol Deshpande <amol.deshpande@outlook.com>
Date: Sat, 13 Jun 2015 08:55:24 -0700
Subject: [PATCH] fix code formatting and bug with losing enums when using
 --gen-onefile

---
 docs/source/Compiler.md | 2 ++
 src/flatc.cpp           | 4 ++--
 src/idl_gen_general.cpp | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/docs/source/Compiler.md b/docs/source/Compiler.md
index 3ff89edc..957baa5b 100755
--- a/docs/source/Compiler.md
+++ b/docs/source/Compiler.md
@@ -57,6 +57,8 @@ be generated for each file processed:
 -   `--gen-mutable` : Generate additional non-const accessors for mutating
     FlatBuffers in-place.
 
+-   `--gen-onefile` :  Generate single output file (useful for C#)
+
 -   `--raw-binary` : Allow binaries without a file_indentifier to be read.
     This may crash flatc given a mismatched schema.
 
diff --git a/src/flatc.cpp b/src/flatc.cpp
index a332a53e..87f0c72b 100755
--- a/src/flatc.cpp
+++ b/src/flatc.cpp
@@ -141,9 +141,9 @@ int main(int argc, const char *argv[]) {
         opts.mutable_buffer = true;
       } else if(arg == "--gen-includes") {
         opts.include_dependence_headers = true;
-      }else if (arg == "--gen-onefile") {
+      } else if (arg == "--gen-onefile") {
         opts.one_file = true;
-      }else if (arg == "--raw-binary") {
+      } else if (arg == "--raw-binary") {
         raw_binary = true;
       } else if(arg == "--") {  // Separator between text and binary inputs.
         binary_files_from = filenames.size();
diff --git a/src/idl_gen_general.cpp b/src/idl_gen_general.cpp
index 268de64f..00c50fe8 100644
--- a/src/idl_gen_general.cpp
+++ b/src/idl_gen_general.cpp
@@ -901,7 +901,7 @@ bool GenerateGeneral(const Parser &parser,
     std::string enumcode;
     GenEnum(lang, **it, &enumcode);
     if (opts.one_file) {
-      one_file_code = enumcode;
+      one_file_code += enumcode;
     }
     else {
       if (!SaveClass(lang, parser, (**it).name, enumcode, path, false, false))
-- 
GitLab