Mercurial > libdvdnav.hg
changeset 264:8c86b61eb06f src
fix compiler warnings related to aliasing violations
author | mroi |
---|---|
date | Wed, 20 Apr 2005 16:16:20 +0000 |
parents | d999338cab17 |
children | 99d33725395d |
files | dvdnav.c dvdnav.h |
diffstat | 2 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/dvdnav.c Wed Apr 20 16:05:43 2005 +0000 +++ b/dvdnav.c Wed Apr 20 16:16:20 2005 +0000 @@ -1092,23 +1092,28 @@ * the union of two of those bitfields so to make this quicker * than performing 32 ORs, we will access them as 32bits words. */ - uint32_t ops=0; + union { + user_ops_t ops_struct; + uint32_t ops_int; + } ops; + + ops.ops_int = 0; if(!this) { printerr("Passed a NULL pointer."); - return *(user_ops_t*)&ops; + return ops.ops_struct; } if(!this->started) { printerr("Virtual DVD machine not started."); - return *(user_ops_t*)&ops; + return ops.ops_struct; } pthread_mutex_lock(&this->vm_lock); - ops|=*(uint32_t*)&this->pci.pci_gi.vobu_uop_ctl; + ops.ops_int |= *(uint32_t*)&this->pci.pci_gi.vobu_uop_ctl; if(this->vm && this->vm->state.pgc) - ops|=*(uint32_t*)&this->vm->state.pgc->prohibited_ops; + ops.ops_int |= *(uint32_t*)&this->vm->state.pgc->prohibited_ops; pthread_mutex_unlock(&this->vm_lock); - return *(user_ops_t*)&ops; + return ops.ops_struct; }
--- a/dvdnav.h Wed Apr 20 16:05:43 2005 +0000 +++ b/dvdnav.h Wed Apr 20 16:16:20 2005 +0000 @@ -580,6 +580,7 @@ */ user_ops_t dvdnav_get_restrictions(dvdnav_t *self); + /********************************************************************* * multiple angles * *********************************************************************/