On 2015-Jul-16 22:07:14 +0000, "Pedro F. Giffuni" <p...@freebsd.org> wrote: >Log: ... > sqlite: clean a couple of invocations of memcpy(3) > > Found almost accidentally by our native gcc when enhanced with > FORTIFY_SOURCE. ... >- memcpy((void *)&aHdr[1], (void *)&pWal->hdr, sizeof(WalIndexHdr)); >+ memcpy((void *)&aHdr[1], (const void *)&pWal->hdr, sizeof(WalIndexHdr)); > walShmBarrier(pWal); >- memcpy((void *)&aHdr[0], (void *)&pWal->hdr, sizeof(WalIndexHdr)); >+ memcpy((void *)&aHdr[0], (const void *)&pWal->hdr, sizeof(WalIndexHdr));
If the compiler complained about that, the compiler is broken. 'const' is a promise to the caller that the given parameter will not be modified by the callee. There's no requirement that the passed argument be const. As bde commented, the casts are all spurious. -- Peter Jeremy
pgpPxoiGTYYng.pgp
Description: PGP signature