8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 07:23:03 +01:00

Merge branch 'jrtc27-met-unaligned-access'

This commit is contained in:
Adriano dos Santos Fernandes 2016-06-12 19:46:18 -03:00
parent 4ec694f7cb
commit e1f924fec2

View File

@ -1480,16 +1480,20 @@ Format* MET_format(thread_db* tdbb, jrd_rel* relation, USHORT number)
count = p[0] | (p[1] << 8); count = p[0] | (p[1] << 8);
p += 2; p += 2;
Array<UCHAR> tmpArray; // must be aligned for the maximum datatype align requirement
while (count-- > 0) while (count-- > 0)
{ {
USHORT offset = p[0] | (p[1] << 8); USHORT offset = p[0] | (p[1] << 8);
p += 2; p += 2;
const Ods::Descriptor* odsDflDesc = (Ods::Descriptor*) p; Ods::Descriptor odsDflDesc;
p = (UCHAR*) (odsDflDesc + 1); memcpy(&odsDflDesc, p, sizeof(odsDflDesc));
p += sizeof(Ods::Descriptor);
dsc desc = *odsDflDesc; dsc desc = odsDflDesc;
desc.dsc_address = const_cast<UCHAR*>(p);
desc.dsc_address = tmpArray.getBuffer(desc.dsc_length, false);
memcpy(desc.dsc_address, p, desc.dsc_length);
EVL_make_value(tdbb, &desc, &format->fmt_defaults[offset], relation->rel_pool); EVL_make_value(tdbb, &desc, &format->fmt_defaults[offset], relation->rel_pool);
p += desc.dsc_length; p += desc.dsc_length;