svn commit: r285644 - head/contrib/sqlite3

Peter Jeremy peter at rulingia.com
Fri Jul 17 22:26:56 UTC 2015


On 2015-Jul-16 22:07:14 +0000, "Pedro F. Giffuni" <pfg at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 949 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20150718/496e1b59/attachment.bin>


More information about the svn-src-head mailing list