Commit 4026117b authored by TGIshib's avatar TGIshib

Correct idl_gen_general

parent 7c69c5dc
...@@ -1237,11 +1237,13 @@ void GenStruct(StructDef &struct_def, std::string *code_ptr) { ...@@ -1237,11 +1237,13 @@ void GenStruct(StructDef &struct_def, std::string *code_ptr) {
code += "ookupByKey(" + GenVectorOffsetType(); code += "ookupByKey(" + GenVectorOffsetType();
code += " vectorOffset, " + GenTypeGet(key_field->value.type); code += " vectorOffset, " + GenTypeGet(key_field->value.type);
code += " key, ByteBuffer bb) {\n"; code += " key, ByteBuffer bb) {\n";
code += " byte[] byteKey = "; if (key_field->value.type.base_type == BASE_TYPE_STRING) {
if (lang_.language == IDLOptions::kJava) code += " byte[] byteKey = ";
code += "key.getBytes(StandardCharsets.UTF_8);\n"; if (lang_.language == IDLOptions::kJava)
else code += "key.getBytes(StandardCharsets.UTF_8);\n";
code += "System.Text.Encoding.UTF8.GetBytes(key);\n"; else
code += "System.Text.Encoding.UTF8.GetBytes(key);\n";
}
code += " int vectorLocation = " + GenByteBufferLength("bb"); code += " int vectorLocation = " + GenByteBufferLength("bb");
code += " - vectorOffset.Value;\n int span = "; code += " - vectorOffset.Value;\n int span = ";
code += "bb." + FunctionStart('G') + "etInt(vectorLocation), "; code += "bb." + FunctionStart('G') + "etInt(vectorLocation), ";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment