[libdvdcss-devel] Win32: kill warnings about strict-aliasing rules in ioctl.c

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Mar 12 14:21:44 CET 2013


git at videolan.org wrote:

>libdvdcss | branch: master | Jean-Baptiste Kempf <jb at videolan.org> |
>Tue Mar 12 13:27:36 2013 +0100|
>[dc2155d210c80aee6a197af0dbb50a7f00adf3b3] | committer: Jean-Baptiste
>Kempf
>
>Win32: kill warnings about strict-aliasing rules in ioctl.c
>
>warning: dereferencing type-punned pointer will break strict-aliasing
>rules [-Wstrict-aliasing]
>
>>
>http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=dc2155d210c80aee6a197af0dbb50a7f00adf3b3
>---
>
> src/ioctl.c |   13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
>diff --git a/src/ioctl.c b/src/ioctl.c
>index 61a924e..7e3568e 100644
>--- a/src/ioctl.c
>+++ b/src/ioctl.c
>@@ -927,7 +927,8 @@ int ioctl_ReportASF( int i_fd, int *pi_remove_me,
>int *pi_asf )
>         key->KeyType    = DvdAsf;
>         key->KeyFlags   = 0;
> 
>-        ((PDVD_ASF)key->KeyData)->SuccessFlag = *pi_asf;
>+        PDVD_ASF keyData = (PDVD_ASF)key->KeyData;
>+        keyData->SuccessFlag = *pi_asf;

Isn't this still an aliasing violation, just that the compiler is too stupid to see it now?
If so I am not so sure hiding the warning is a great solution.



More information about the libdvdcss-devel mailing list