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

Jean-Baptiste Kempf git at videolan.org
Tue Mar 12 13:41:39 CET 2013


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;
 
         i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
                 key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
@@ -937,7 +938,8 @@ int ioctl_ReportASF( int i_fd, int *pi_remove_me, int *pi_asf )
             return i_ret;
         }
 
-        *pi_asf = ((PDVD_ASF)key->KeyData)->SuccessFlag;
+        keyData = (PDVD_ASF)key->KeyData;
+        *pi_asf = keyData->SuccessFlag;
     }
     else
     {
@@ -1580,9 +1582,10 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
             return i_ret;
         }
 
-        *p_type = ((PDVD_RPC_KEY)key->KeyData)->TypeCode;
-        *p_mask = ((PDVD_RPC_KEY)key->KeyData)->RegionMask;
-        *p_scheme = ((PDVD_RPC_KEY)key->KeyData)->RpcScheme;
+        PDVD_RPC_KEY keyData = (PDVD_RPC_KEY)key->KeyData;
+        *p_type = keyData->TypeCode;
+        *p_mask = keyData->RegionMask;
+        *p_scheme = keyData->RpcScheme;
     }
     else
     {



More information about the libdvdcss-devel mailing list