Commits


Allen Reese authored and GitHub committed 4a3a624509f
If avrogencpp encounters a schema with reserved words in it, it will happily generate a header with fields that are reserved words. (#1071) The decorate function in avrogencpp was overloaded a reference to an std::string or const avro::Name& to allow this. The existing decorate function is only called on types, but it should also be called on names as well, which this patch fixes For example: { "type" : "record", "name" : "Words", "namespace" : "org.apache.avro.example", "fields" : [ { "name" : "alignas", "type" : "string" }, { "name" : "alignof", "type" : "string" }, { "name" : "and", "type" : "string" } ] } Will generate the following header file: struct Words { std::string alignas; std::string alignof; std::string and; Words() : alignas(std::string()), alignof(std::string()), and(std::string()) { } }; Which cannot be compiled by c++ With this fix, the following will be generated: struct Words { std::string alignas_; std::string alignof_; std::string and_; Words() : alignas_(std::string()), alignof_(std::string()), and_(std::string()) { } }; Co-authored-by: Allen Reese <areese999@apple.com>