Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1990

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/90/1990/1

write double/float via union with unsigned type for strict-aliasing

Change-Id: Ie4dd1d41e5cde27ec5b144ca4b7c97276ff62479
---
M registry/tools/reg2bin.cxx
1 file changed, 2 insertions(+), 12 deletions(-)



diff --git a/registry/tools/reg2bin.cxx b/registry/tools/reg2bin.cxx
index be8fead..5983b56 100644
--- a/registry/tools/reg2bin.cxx
+++ b/registry/tools/reg2bin.cxx
@@ -1196,6 +1196,7 @@
                         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,19 +1205,8 @@
                         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

-- 
To view, visit https://gerrit.libreoffice.org/1990
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4dd1d41e5cde27ec5b144ca4b7c97276ff62479
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Caolán McNamara <caolanm@redhat.com>

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.