diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-02-05 10:25:42 +0000 |
---|---|---|
committer | David Ostrovsky <David.Ostrovsky@gmx.de> | 2013-02-05 11:08:31 +0000 |
commit | df42c435f62528c1b7ae7ca3b8f8d2afa7196045 (patch) | |
tree | bfbcb4478e0302c7a731b1e34d32bc1b7a57ca56 /registry | |
parent | 6d0f1f66392515a0789f15c90a430b7047ca1f04 (diff) |
write double/float via union with unsigned type for strict-aliasing
Change-Id: Ie4dd1d41e5cde27ec5b144ca4b7c97276ff62479
Reviewed-on: https://gerrit.libreoffice.org/1990
Reviewed-by: David Ostrovsky <David.Ostrovsky@gmx.de>
Tested-by: David Ostrovsky <David.Ostrovsky@gmx.de>
Diffstat (limited to 'registry')
-rw-r--r-- | registry/tools/reg2bin.cxx | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/registry/tools/reg2bin.cxx b/registry/tools/reg2bin.cxx index be8fead9bdc4..5983b5629937 100644 --- a/registry/tools/reg2bin.cxx +++ b/registry/tools/reg2bin.cxx @@ -1196,6 +1196,7 @@ sal_uInt64 writeMap( static_cast< sal_uInt32 >(j->second.constantValue.l)); break; case CONSTANT_TYPE_UNSIGNED_LONG: + case CONSTANT_TYPE_FLOAT: //access through union for strict-aliasing write32(file, j->second.constantValue.ul); break; case CONSTANT_TYPE_HYPER: @@ -1204,20 +1205,9 @@ sal_uInt64 writeMap( static_cast< sal_uInt64 >(j->second.constantValue.h)); break; case CONSTANT_TYPE_UNSIGNED_HYPER: + case CONSTANT_TYPE_DOUBLE: //access through union for strict-aliasing write64(file, j->second.constantValue.uh); break; - case CONSTANT_TYPE_FLOAT: - write32( - file, - *reinterpret_cast< sal_uInt32 const * >( - &j->second.constantValue.f)); - break; - case CONSTANT_TYPE_DOUBLE: - write64( - file, - *reinterpret_cast< sal_uInt64 const * >( - &j->second.constantValue.d)); - break; default: std::abort(); // this cannot happen } |