mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
registry: use GStatBuf unconditionally and add typedef for backwards compatibility
No need to clutter the code with #if #else #endif. See #623875.
This commit is contained in:
parent
88ec06f433
commit
b987febf09
4 changed files with 6 additions and 28 deletions
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#if !GLIB_CHECK_VERSION(2,25,0)
|
||||||
|
typedef struct stat GStatBuf;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* copies */
|
/* copies */
|
||||||
|
|
||||||
/* adaptations */
|
/* adaptations */
|
||||||
|
|
|
@ -670,11 +670,7 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
|
||||||
GModule *module;
|
GModule *module;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
gpointer ptr;
|
gpointer ptr;
|
||||||
#if GLIB_CHECK_VERSION(2,25,0)
|
|
||||||
GStatBuf file_status;
|
GStatBuf file_status;
|
||||||
#else
|
|
||||||
struct stat file_status;
|
|
||||||
#endif
|
|
||||||
GstRegistry *registry;
|
GstRegistry *registry;
|
||||||
gboolean new_plugin = TRUE;
|
gboolean new_plugin = TRUE;
|
||||||
|
|
||||||
|
@ -1470,13 +1466,7 @@ gst_plugin_ext_dep_extract_env_vars_paths (GstPlugin * plugin,
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
gst_plugin_ext_dep_get_hash_from_stat_entry (
|
gst_plugin_ext_dep_get_hash_from_stat_entry (GStatBuf * s)
|
||||||
#if GLIB_CHECK_VERSION(2,25,0)
|
|
||||||
GStatBuf * s
|
|
||||||
#else
|
|
||||||
struct stat *s
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (!(s->st_mode & (S_IFDIR | S_IFREG)))
|
if (!(s->st_mode & (S_IFDIR | S_IFREG)))
|
||||||
return (guint) - 1;
|
return (guint) - 1;
|
||||||
|
@ -1533,11 +1523,7 @@ gst_plugin_ext_dep_scan_dir_and_match_names (GstPlugin * plugin,
|
||||||
* the same order, and not in a random order */
|
* the same order, and not in a random order */
|
||||||
while ((entry = g_dir_read_name (dir))) {
|
while ((entry = g_dir_read_name (dir))) {
|
||||||
gboolean have_match;
|
gboolean have_match;
|
||||||
#if GLIB_CHECK_VERSION(2,25,0)
|
|
||||||
GStatBuf s;
|
GStatBuf s;
|
||||||
#else
|
|
||||||
struct stat s;
|
|
||||||
#endif
|
|
||||||
gchar *full_path;
|
gchar *full_path;
|
||||||
guint fhash;
|
guint fhash;
|
||||||
|
|
||||||
|
@ -1594,12 +1580,7 @@ gst_plugin_ext_dep_scan_path_with_filenames (GstPlugin * plugin,
|
||||||
* and going through each entry to see if it matches one of our filenames. */
|
* and going through each entry to see if it matches one of our filenames. */
|
||||||
if (!recurse_into_dirs && !partial_names) {
|
if (!recurse_into_dirs && !partial_names) {
|
||||||
for (i = 0; filenames[i] != NULL; ++i) {
|
for (i = 0; filenames[i] != NULL; ++i) {
|
||||||
#if GLIB_CHECK_VERSION(2,25,0)
|
|
||||||
GStatBuf s;
|
GStatBuf s;
|
||||||
#else
|
|
||||||
struct stat s;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gchar *full_path;
|
gchar *full_path;
|
||||||
guint fhash;
|
guint fhash;
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,7 @@
|
||||||
#include "gst-i18n-lib.h"
|
#include "gst-i18n-lib.h"
|
||||||
|
|
||||||
#include "gst.h"
|
#include "gst.h"
|
||||||
|
#include "glib-compat-private.h"
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -1106,11 +1107,7 @@ gst_registry_scan_path_level (GstRegistryScanContext * context,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
while ((dirent = g_dir_read_name (dir))) {
|
while ((dirent = g_dir_read_name (dir))) {
|
||||||
#if GLIB_CHECK_VERSION(2,25,0)
|
|
||||||
GStatBuf file_status;
|
GStatBuf file_status;
|
||||||
#else
|
|
||||||
struct stat file_status;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
filename = g_build_filename (path, dirent, NULL);
|
filename = g_build_filename (path, dirent, NULL);
|
||||||
if (g_stat (filename, &file_status) < 0) {
|
if (g_stat (filename, &file_status) < 0) {
|
||||||
|
|
|
@ -363,11 +363,7 @@ gst_registry_binary_write_cache (GstRegistry * registry, const char *location)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (plugin->flags & GST_PLUGIN_FLAG_CACHED) {
|
if (plugin->flags & GST_PLUGIN_FLAG_CACHED) {
|
||||||
#if GLIB_CHECK_VERSION(2,25,0)
|
|
||||||
GStatBuf statbuf;
|
GStatBuf statbuf;
|
||||||
#else
|
|
||||||
struct stat statbuf;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (g_stat (plugin->filename, &statbuf) < 0 ||
|
if (g_stat (plugin->filename, &statbuf) < 0 ||
|
||||||
plugin->file_mtime != statbuf.st_mtime ||
|
plugin->file_mtime != statbuf.st_mtime ||
|
||||||
|
|
Loading…
Reference in a new issue