From d97f628703b365491825acabf0ba798e1dfff800 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Wed, 19 Aug 2015 11:06:38 -0700 Subject: [PATCH] Clarified choice of types in Java/C# codegen. Change-Id: I1f094f350145d13b12cbe367bae7c623cfbbd8d3 --- src/idl_gen_general.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/idl_gen_general.cpp b/src/idl_gen_general.cpp index b2b7146..00580d4 100644 --- a/src/idl_gen_general.cpp +++ b/src/idl_gen_general.cpp @@ -252,6 +252,8 @@ static Type DestinationType(const LanguageParameters &lang, const Type &type, bool vectorelem) { if (lang.language != GeneratorOptions::kJava) return type; switch (type.base_type) { + // We use int for both uchar/ushort, since that generally means less casting + // than using short for uchar. case BASE_TYPE_UCHAR: return Type(BASE_TYPE_INT); case BASE_TYPE_USHORT: return Type(BASE_TYPE_INT); case BASE_TYPE_UINT: return Type(BASE_TYPE_LONG); @@ -943,8 +945,8 @@ static bool SaveClass(const LanguageParameters &lang, const Parser &parser, std::string code = "// automatically generated, do not modify\n\n"; if (!namespace_general.empty()) { - code += lang.namespace_ident + namespace_general + lang.namespace_begin; - code += "\n\n"; + code += lang.namespace_ident + namespace_general + lang.namespace_begin; + code += "\n\n"; } if (needs_includes) code += lang.includes; code += classcode; -- 2.7.4