fix array of scalar xcode

This commit is contained in:
Michael Davidsaver
2020-05-18 19:01:37 -07:00
parent 609768a33d
commit a556e7e290
2 changed files with 31 additions and 5 deletions
+28 -4
View File
@@ -353,23 +353,35 @@ void to_wire_field(Buffer& buf, const FieldDesc* desc, const std::shared_ptr<con
to_wire<bool, uint8_t>(buf, fld);
return;
case TypeCode::Int8A:
to_wire<int8_t>(buf, fld);
return;
case TypeCode::UInt8A:
to_wire<uint8_t>(buf, fld);
return;
case TypeCode::Int16A:
to_wire<int16_t>(buf, fld);
return;
case TypeCode::UInt16A:
to_wire<uint16_t>(buf, fld);
return;
case TypeCode::Int32A:
to_wire<int32_t>(buf, fld);
return;
case TypeCode::UInt32A:
case TypeCode::Float32A:
to_wire<uint32_t>(buf, fld);
return;
case TypeCode::Float32A:
to_wire<float>(buf, fld);
return;
case TypeCode::Int64A:
to_wire<int64_t>(buf, fld);
return;
case TypeCode::UInt64A:
case TypeCode::Float64A:
to_wire<uint64_t>(buf, fld);
return;
case TypeCode::Float64A:
to_wire<double>(buf, fld);
return;
case TypeCode::StringA:
to_wire<std::string, const std::string&>(buf, fld);
return;
@@ -587,23 +599,35 @@ void from_wire_field(Buffer& buf, TypeStore& ctxt, const FieldDesc* desc, const
from_wire<bool, uint8_t>(buf, fld);
return;
case TypeCode::Int8A:
from_wire<int8_t>(buf, fld);
return;
case TypeCode::UInt8A:
from_wire<uint8_t>(buf, fld);
return;
case TypeCode::Int16A:
from_wire<int16_t>(buf, fld);
return;
case TypeCode::UInt16A:
from_wire<uint16_t>(buf, fld);
return;
case TypeCode::Int32A:
from_wire<int32_t>(buf, fld);
return;
case TypeCode::UInt32A:
case TypeCode::Float32A:
from_wire<uint32_t>(buf, fld);
return;
case TypeCode::Float32A:
from_wire<float>(buf, fld);
return;
case TypeCode::Int64A:
from_wire<int64_t>(buf, fld);
return;
case TypeCode::UInt64A:
case TypeCode::Float64A:
from_wire<uint64_t>(buf, fld);
return;
case TypeCode::Float64A:
from_wire<double>(buf, fld);
return;
case TypeCode::StringA:
from_wire<std::string>(buf, fld);
return;
+3 -1
View File
@@ -548,7 +548,9 @@ void testArrayXCode()
testDiag("%s", __func__);
testArrayXCodeT<uint32_t>("\x01\x02\x00", {});
testArrayXCodeT<uint32_t>("\x01\x02\x01\x12\x34\x56\x78", {0x12345678});
testArrayXCodeT<uint16_t>("\x01\x02\x02\x00\x01\xff\xff", {1u, 0xffff});
testArrayXCodeT<double>("\x01\x02\x01?\xf0\x00\x00\x00\x00\x00\x00", {1.0});
testArrayXCodeT<std::string>("\x01\x02\x02\x05hello\x05world", {"hello", "world"});
}
@@ -950,7 +952,7 @@ void testEmptyRequest()
MAIN(testxcode)
{
testPlan(110);
testPlan(116);
testSerialize1();
testDeserialize1();
testSimpleDef();