X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=formats%2Fctf%2Ftypes%2Ffloat.c;h=9ad4e602f0df705276ee45bbf92cfe7b154e921e;hb=b448902b7c2d8fa734e0d5cb1e6acbb009db97e4;hp=0a9535923d09de5346773a46968e1f92235b1c1b;hpb=f72803caba1da2c19dc1c1f024a1462dc54d4fbf;p=babeltrace.git diff --git a/formats/ctf/types/float.c b/formats/ctf/types/float.c index 0a953592..9ad4e602 100644 --- a/formats/ctf/types/float.c +++ b/formats/ctf/types/float.c @@ -24,7 +24,7 @@ #include #include /* C99 floating point definitions */ #include /* C99 limits */ -#include +#include /* * This library is limited to binary representation of floating point values. @@ -145,6 +145,7 @@ int ctf_float_read(struct stream_pos *ppos, struct definition *definition) struct definition *tmpdef; struct definition_float *tmpfloat; struct ctf_stream_pos destp; + struct mmap_align mma; int ret; switch (float_declaration->mantissa->len + 1) { @@ -162,8 +163,10 @@ int ctf_float_read(struct stream_pos *ppos, struct definition *definition) return -EINVAL; } tmpfloat = container_of(tmpdef, struct definition_float, p); + memset(&destp, 0, sizeof(destp)); ctf_init_pos(&destp, -1, O_RDWR); - destp.base = (char *) u.bits; + mmap_align_set_addr(&mma, (char *) u.bits); + destp.base_mma = &mma; destp.packet_size = sizeof(u) * CHAR_BIT; ctf_align_pos(pos, float_declaration->p.alignment); ret = _ctf_float_copy(&destp.parent, tmpfloat, ppos, float_definition); @@ -192,6 +195,7 @@ int ctf_float_write(struct stream_pos *ppos, struct definition *definition) struct definition *tmpdef; struct definition_float *tmpfloat; struct ctf_stream_pos srcp; + struct mmap_align mma; int ret; switch (float_declaration->mantissa->len + 1) { @@ -210,7 +214,8 @@ int ctf_float_write(struct stream_pos *ppos, struct definition *definition) } tmpfloat = container_of(tmpdef, struct definition_float, p); ctf_init_pos(&srcp, -1, O_RDONLY); - srcp.base = (char *) u.bits; + mmap_align_set_addr(&mma, (char *) u.bits); + srcp.base_mma = &mma; srcp.packet_size = sizeof(u) * CHAR_BIT; switch (float_declaration->mantissa->len + 1) { case FLT_MANT_DIG: