Hi
On Mon, 24 Aug 2015 10:37:38 +0200
Stephan Bergmann <sbergman@redhat.com> wrote:
On 08/21/2015 10:30 PM, Matteo Casalin wrote:
commit eb4cbea657b9038c488f1b1bcf5107cc226a6681
Author: Matteo Casalin <matteo.casalin@yahoo.com>
Date: Sun Aug 16 16:32:13 2015 +0200
Silence some conversion warnings
Change-Id: I676ed010576f3a24b193ffc6c28a319bcc5ac968
[...]
diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx
index 395870f..78a51a1 100644
--- a/store/source/storbase.hxx
+++ b/store/source/storbase.hxx
@@ -512,9 +512,9 @@ struct PageData
void guard (sal_uInt32 nAddr)
{
sal_uInt32 nCRC32 = 0;
- nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic,
static_cast<sal_uInt32>(sizeof(sal_uInt32)));
What compiler/switch is it that warns there? It does not look like that
particular compiler/switch is very useful. sizeof(sal_uInt32) is a
known, small integer at compile time. It should be apparent to both the
compiler and humans that it fits into the sal_uInt32 argument to
rtl_crc32 without needing the static_cast noise.
That's GCC -Wconversion, which I'm using to chase harmful downcasts (e.g. sal_Int32 to sal_uInt16
for OUString length, there are still some of them here and there). The point is that some of these
downcasts, although safe in themselves, introduce a lot of noise in the logs and make the real
issues difficult to detect.
If I remember correctly in this case the warning was probably only in the result of "theSize -
sizeof(G)" some lines below, I just casted both call places for simmetry. If that's undesired I'll
revert the cast for the "sizeof(sal_uInt32)" calls.
Kind regards
Matteo
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.