GNOME Bugzilla – Bug 623875
gstregistrybinary.c compatibility with glib >= 2.25.0
Last modified: 2010-07-16 17:02:28 UTC
Created attachment 165507 [details] [review]
Patch to use the appropriate glib stat struct for the platform
When compiling gst against glib >= 2.25.0 on MSVC, a warning about incompatible pointer types is received.
According to the glib documentation (http://library.gnome.org/devel/glib/unstable/glib-File-Utilities.html#g-stat):
On Windows the Microsoft C libraries have several variants of the stat struct and stat() function with names like "_stat", "_stat32", "_stat32i64" and "_stat64i32". The one used here is for 32-bit code the one with 32-bit size and time fields, specifically called "_stat32".
In Microsoft's compiler, by default "struct stat" means one with 64-bit time fields while in MinGW "struct stat" is the legacy one with 32-bit fields. To hopefully clear up this messs, the gstdio.h header defines a type GStatBuf which is the appropriate struct type depending on the platform and/or compiler being used. On POSIX it is just "struct stat", but note that even on POSIX platforms, "stat" might be a macro.
The attached patch resolves the issue by using GStatBuf in later versions of glib. The warning subsequently goes away.
I apologize for the format of the patch.
Thanks, I'll commit this after the next core release in a few days.
Created attachment 165508 [details] [review]
Fixes the warning in other places as well
Author: David Hoyt <email@example.com>
Date: Thu Jul 8 21:04:54 2010 +0200
registrybinary: Fix compatibility with GLib 2.25 when using MSVC
Newer GLib uses a new type for g_stat() and friends to improve
Windows compatibility. On POSIX this is a typedef to struct stat.
Fixes bug #623875.
I've also committed this, hope things still work:
Author: Tim-Philipp Müller <firstname.lastname@example.org>
Date: Fri Jul 16 17:53:38 2010 +0100
registry: use GStatBuf unconditionally and add typedef for backwards compatibility
No need to clutter the code with #if #else #endif.