Re: kernel32: implement CPU detection for OpenBSD
On Fri, 2 Jan 2009, Austin English wrote: @@ -544,7 +544,7 @@ VOID WINAPI GetSystemInfo( } fclose (f); } -#elif defined (__NetBSD__) +#elif defined (__NetBSD__) || defined(__OpenBSD__) { int mib[2]; int value[2]; @@ -557,31 +557,55 @@ VOID WINAPI GetSystemInfo( #ifdef CPU_FPU_PRESENT mib[1] = CPU_FPU_PRESENT; value[1] = sizeof(int); - if (sysctl(mib, 2, value, value+1, NULL, 0) >= 0) +#ifdef __OpenBSD__ + if (sysctl(mib, 2, value, (size_t *)(value+1), NULL, 0) >= 0) { +#else + if (sysctl(mib, 2, value, value+1, NULL, 0) >= 0) { +#endif This was wrong to start with because even if size_t is 8 bytes, value+1 will only have space for 4. Plus the code tests whether value changed instead of testing *value! I'm sending a patch to fix that. Then you can resend your patch adding just the defined(__OpenBSD__). -- Francois Gouget <fgouget(a)free.fr> http://fgouget.free.fr/ A polar bear is a cartesian bear after a coordinate transform.
participants (1)
-
Francois Gouget