summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2011-09-28 15:15:49 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2011-09-28 15:15:49 +0200
commit4a4e0d4b20447e75ed23f5f285c17ada0e12f82e (patch)
tree6f9d876ab4a85bd83399862d659a9b62df7d6e35
parent4e7d1bcb60de6a6920f6cede0c84cb32b9d9eb0a (diff)
Fix warning that dereferencing type-punned pointer will break strict-aliasing rules
-rw-r--r--src/lib/libvisio_utils.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libvisio_utils.cpp b/src/lib/libvisio_utils.cpp
index 4dd4a80..10cab2d 100644
--- a/src/lib/libvisio_utils.cpp
+++ b/src/lib/libvisio_utils.cpp
@@ -74,9 +74,9 @@ uint64_t libvisio::readU64(WPXInputStream *input)
double libvisio::readDouble(WPXInputStream *input)
{
- uint64_t value = readU64(input);
+ union { uint64_t u; double d; } tmpUnion;
- double *doublePointer = reinterpret_cast<double *>(&value);
-
- return *doublePointer;
+ tmpUnion.u = readU64(input);
+
+ return tmpUnion.d;
}