Hello, gcc complains about this both in SVN and Erik's git repo. Using a union is supposedly safe for gcc at least, but I don't know about other compilers. I think the bitfield is simply a bad idea in general... An alternative would be to use memcpy. Index: libdvdnav/dvdnav.c =================================================================== --- libdvdnav/dvdnav.c (revision 1243) +++ libdvdnav/dvdnav.c (working copy) @@ -1162,7 +1161,7 @@ union { user_ops_t ops_struct; uint32_t ops_int; - } ops; + } ops, tmp; ops.ops_int = 0; @@ -1172,10 +1171,12 @@ } pthread_mutex_lock(&this->vm_lock); - ops.ops_int |= *(uint32_t*)&this->pci.pci_gi.vobu_uop_ctl; + ops.ops_struct = this->pci.pci_gi.vobu_uop_ctl; - if(this->vm && this->vm->state.pgc) - ops.ops_int |= *(uint32_t*)&this->vm->state.pgc->prohibited_ops; + if(this->vm && this->vm->state.pgc) { + tmp.ops_struct = this->vm->state.pgc->prohibited_ops; + ops.ops_int |= tmp.ops_int; + } pthread_mutex_unlock(&this->vm_lock); return ops.ops_struct;
On Tuesday, 06 November 2012 at 20:52, Reimar Döffinger wrote:
Hello, gcc complains about this both in SVN and Erik's git repo. Using a union is supposedly safe for gcc at least, but I don't know about other compilers. I think the bitfield is simply a bad idea in general... An alternative would be to use memcpy.
Patch applied. Regards, Dominik -- Fedora http://fedoraproject.org/wiki/User:Rathann RPMFusion http://rpmfusion.org | MPlayer http://mplayerhq.hu "Faith manages." -- Delenn to Lennier in Babylon 5:"Confessions and Lamentations"
participants (2)
-
Dominik 'Rathann' Mierzejewski -
Reimar Döffinger