diff options
author | jstebbins <[email protected]> | 2014-02-18 22:33:39 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2014-02-18 22:33:39 +0000 |
commit | dcfe8545b8bf8a9a32be87f847959137c0a251d2 (patch) | |
tree | 02d82922de8bb53224686a37a2cb0e125b89cc83 | |
parent | c59e8c81a797deda9966f3ac22cfc7c7c5b8e4d5 (diff) |
libhb: fix compiler warning with cpuid usage
fixes "dereferencing type-punned pointer will break strict-aliasing rules"
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6045 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/ports.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/libhb/ports.c b/libhb/ports.c index fc9d8922d..6348ceb9d 100644 --- a/libhb/ports.c +++ b/libhb/ports.c @@ -223,7 +223,11 @@ struct { enum hb_cpu_platform platform; const char *name; - char buf[48]; + union + { + char buf[48]; + uint32_t buf4[12]; + }; int count; } hb_cpu_info; @@ -346,20 +350,20 @@ static void init_cpu_info() if ((eax & 0x80000004) < 0x80000004) { cpuid(0x80000002, - (int*)&hb_cpu_info.buf[ 0], - (int*)&hb_cpu_info.buf[ 4], - (int*)&hb_cpu_info.buf[ 8], - (int*)&hb_cpu_info.buf[12]); + &hb_cpu_info.buf4[ 0], + &hb_cpu_info.buf4[ 1], + &hb_cpu_info.buf4[ 2], + &hb_cpu_info.buf4[ 3]); cpuid(0x80000003, - (int*)&hb_cpu_info.buf[16], - (int*)&hb_cpu_info.buf[20], - (int*)&hb_cpu_info.buf[24], - (int*)&hb_cpu_info.buf[28]); + &hb_cpu_info.buf4[ 4], + &hb_cpu_info.buf4[ 5], + &hb_cpu_info.buf4[ 6], + &hb_cpu_info.buf4[ 7]); cpuid(0x80000004, - (int*)&hb_cpu_info.buf[32], - (int*)&hb_cpu_info.buf[36], - (int*)&hb_cpu_info.buf[40], - (int*)&hb_cpu_info.buf[44]); + &hb_cpu_info.buf4[ 8], + &hb_cpu_info.buf4[ 9], + &hb_cpu_info.buf4[10], + &hb_cpu_info.buf4[11]); hb_cpu_info.name = hb_cpu_info.buf; hb_cpu_info.buf[47] = '\0'; // just in case |