A bunch of portability fixes, derived from Steve Lhomme's MSVC

Original commit message from CVS:
A bunch of portability fixes, derived from Steve Lhomme's MSVC
patch (bug #141317):
* gst/gst-i18n-lib.h: Allow disabling gettext.
* gst/gstatomic_impl.h: disable warning when it's dumb.
* gst/gstclock.c: fix include
* gst/gstcompat.h: fix variadic macro
* gst/gstinfo.c: fix include
* gst/gstmacros.h: add defines for inlines on MSVC
* gst/gstplugin.c: fix includes
* gst/gstregistry.c: fix includes
* gst/gstregistry.h: use S_IREAD, etc., if S_IRUSR isn't defined
* gst/gstsystemclock.c: fix include
* gst/gsttrace.c: (gst_trace_new), (gst_trace_text_flush): use
S_IREAD if S_IRUSR isn't defined.  fix use of non-portable functions
* gst/registries/gstxmlregistry.c:
(gst_xml_registry_parse_element_factory): fix use of non-portable
functions
* libs/gst/control/dparam.h: Remove trailing comma in enum definition
* libs/gst/control/dparammanager.h: same
This commit is contained in:
David Schleef 2004-04-28 23:26:06 +00:00
parent d27cb929f3
commit a2a974bfae
15 changed files with 88 additions and 14 deletions

View file

@ -1,3 +1,25 @@
2004-04-28 David Schleef <ds@schleef.org>
A bunch of portability fixes, derived from Steve Lhomme's MSVC
patch (bug #141317):
* gst/gst-i18n-lib.h: Allow disabling gettext.
* gst/gstatomic_impl.h: disable warning when it's dumb.
* gst/gstclock.c: fix include
* gst/gstcompat.h: fix variadic macro
* gst/gstinfo.c: fix include
* gst/gstmacros.h: add defines for inlines on MSVC
* gst/gstplugin.c: fix includes
* gst/gstregistry.c: fix includes
* gst/gstregistry.h: use S_IREAD, etc., if S_IRUSR isn't defined
* gst/gstsystemclock.c: fix include
* gst/gsttrace.c: (gst_trace_new), (gst_trace_text_flush): use
S_IREAD if S_IRUSR isn't defined. fix use of non-portable functions
* gst/registries/gstxmlregistry.c:
(gst_xml_registry_parse_element_factory): fix use of non-portable
functions
* libs/gst/control/dparam.h: Remove trailing comma in enum definition
* libs/gst/control/dparammanager.h: same
2004-04-28 David Schleef <ds@schleef.org> 2004-04-28 David Schleef <ds@schleef.org>
Move a bunch of unused files to old/ with names that are Move a bunch of unused files to old/ with names that are

View file

@ -23,15 +23,25 @@
#ifndef __GST_I18N_LIB_H__ #ifndef __GST_I18N_LIB_H__
#define __GST_I18N_LIB_H__ #define __GST_I18N_LIB_H__
#include "gettext.h" /* included with gettext distribution and copied */ #ifndef GST_VERSION
#error You must include config.h before including this header.
#ifndef GETTEXT_PACKAGE
#error You must define GETTEXT_PACKAGE before including this header.
#endif #endif
#ifdef ENABLE_NLS
#include "gettext.h" /* included with gettext distribution and copied */
/* we want to use shorthand _() for translating and N_() for marking */ /* we want to use shorthand _() for translating and N_() for marking */
#define _(String) dgettext (GETTEXT_PACKAGE, String) #define _(String) dgettext (GETTEXT_PACKAGE, String)
#define N_(String) gettext_noop (String) #define N_(String) gettext_noop (String)
/* FIXME: if we need it, we can add Q_ as well, like in glib */ /* FIXME: if we need it, we can add Q_ as well, like in glib */
#else
#define GETTEXT_PACKAGE NULL
#define _(String) String
#define N_(String) String
#endif
#endif /* __GST_I18N_LIB_H__ */ #endif /* __GST_I18N_LIB_H__ */

View file

@ -423,7 +423,11 @@ gst_atomic_int_dec_and_test (GstAtomicInt *aint)
} }
#else #else
/* no need warning about this if we can't do inline assembly */
#ifdef __GNUC__
#warning consider putting your architecture specific atomic implementations here #warning consider putting your architecture specific atomic implementations here
#endif
/* /*
* generic implementation * generic implementation

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include <sys/time.h> #include <time.h>
#include "gst_private.h" #include "gst_private.h"

View file

@ -36,9 +36,11 @@ G_BEGIN_DECLS
gst_element_link_pads(a,b,c,d) gst_element_link_pads(a,b,c,d)
#ifdef G_HAVE_ISO_VARARGS #ifdef G_HAVE_ISO_VARARGS
#define gst_element_connect_many(a,...) gst_element_link_many(a,__VA_ARGS__) #define gst_element_connect_many(a,...) gst_element_link_many(a,__VA_ARGS__)
#else #elif defined(G_HAVE_GNUC_VARARGS)
#define gst_element_connect_many(a,args...) \ #define gst_element_connect_many(a,args...) \
gst_element_link_many(a, ## args) gst_element_link_many(a, ## args)
#else
/* FIXME: need an inline function */
#endif #endif
#define gst_element_connect_filtered(a,b,c) \ #define gst_element_connect_filtered(a,b,c) \
gst_element_link_filtered(a,b,c) gst_element_link_filtered(a,b,c)

View file

@ -34,7 +34,9 @@
#include <printf.h> #include <printf.h>
#endif #endif
#include <stdio.h> /* fprintf */ #include <stdio.h> /* fprintf */
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <string.h> /* G_VA_COPY */ #include <string.h> /* G_VA_COPY */
#include "gstinfo.h" #include "gstinfo.h"
#include "gstlog.h" #include "gstlog.h"

View file

@ -32,6 +32,9 @@ G_BEGIN_DECLS
#if defined (__GNUC__) && !defined (GST_IMPLEMENT_INLINES) #if defined (__GNUC__) && !defined (GST_IMPLEMENT_INLINES)
# define GST_INLINE_FUNC extern __inline__ # define GST_INLINE_FUNC extern __inline__
# define GST_CAN_INLINE 1 # define GST_CAN_INLINE 1
#elif defined(_MSC_VER)
# define GST_INLINE_FUNC extern __inline
# define GST_CAN_INLINE 1
#else #else
# define GST_INLINE_FUNC extern # define GST_INLINE_FUNC extern
# undef GST_CAN_INLINE # undef GST_CAN_INLINE

View file

@ -20,10 +20,17 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h> #include <dirent.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <signal.h> #include <signal.h>
#include "gst_private.h" #include "gst_private.h"
@ -32,7 +39,6 @@
#include "gstversion.h" #include "gstversion.h"
#include "gstregistrypool.h" #include "gstregistrypool.h"
#include "gstinfo.h" #include "gstinfo.h"
#include "config.h"
#include "gstfilter.h" #include "gstfilter.h"

View file

@ -20,10 +20,15 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <glib.h> #include <glib.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View file

@ -34,6 +34,8 @@
#define LOCAL_REGISTRY_FILE LOCAL_REGISTRY_DIR"/registry.xml" #define LOCAL_REGISTRY_FILE LOCAL_REGISTRY_DIR"/registry.xml"
#define LOCAL_REGISTRY_FILE_TMP LOCAL_REGISTRY_DIR"/.registry.xml.tmp" #define LOCAL_REGISTRY_FILE_TMP LOCAL_REGISTRY_DIR"/.registry.xml.tmp"
/* compatibility for pre-POSIX defines */
#ifdef S_IRUSR
#define REGISTRY_DIR_PERMS (S_ISGID | \ #define REGISTRY_DIR_PERMS (S_ISGID | \
S_IRUSR | S_IWUSR | S_IXUSR | \ S_IRUSR | S_IWUSR | S_IXUSR | \
S_IRGRP | S_IXGRP | \ S_IRGRP | S_IXGRP | \
@ -42,6 +44,12 @@
#define REGISTRY_FILE_PERMS (S_IRUSR | S_IWUSR | \ #define REGISTRY_FILE_PERMS (S_IRUSR | S_IWUSR | \
S_IRGRP | S_IWGRP | \ S_IRGRP | S_IWGRP | \
S_IROTH | S_IWOTH) S_IROTH | S_IWOTH)
#else
#define REGISTRY_DIR_PERMS (S_ISGID | \
S_IREAD | S_IWRITE | S_IEXEC)
#define REGISTRY_TMPFILE_PERMS (S_IREAD | S_IWRITE)
#define REGISTRY_FILE_PERMS (S_IREAD | S_IWRITE)
#endif
G_BEGIN_DECLS G_BEGIN_DECLS

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include <sys/time.h> #include <time.h>
#include "gst_private.h" #include "gst_private.h"
#include "gstinfo.h" #include "gstinfo.h"

View file

@ -21,9 +21,13 @@
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #endif
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
@ -67,6 +71,12 @@ gst_trace_new (gchar * filename, gint size)
g_return_val_if_fail (trace != NULL, NULL); g_return_val_if_fail (trace != NULL, NULL);
trace->filename = g_strdup (filename); trace->filename = g_strdup (filename);
g_print ("opening '%s'\n", trace->filename); g_print ("opening '%s'\n", trace->filename);
#ifndef S_IWUSR
#define S_IWUSR S_IWRITE
#endif
#ifndef S_IRUSR
#define S_IDUSR S_IREAD
#endif
trace->fd = trace->fd =
open (trace->filename, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); open (trace->filename, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
perror ("opening trace file"); perror ("opening trace file");
@ -120,7 +130,7 @@ gst_trace_text_flush (GstTrace * trace)
} }
for (i = 0; i < trace->bufoffset; i++) { for (i = 0; i < trace->bufoffset; i++) {
snprintf (str, STRSIZE, "%20" G_GINT64_FORMAT " %10d %10d %s\n", g_snprintf (str, STRSIZE, "%20" G_GINT64_FORMAT " %10d %10d %s\n",
trace->buf[i].timestamp, trace->buf[i].timestamp,
trace->buf[i].sequence, trace->buf[i].data, trace->buf[i].message); trace->buf[i].sequence, trace->buf[i].data, trace->buf[i].message);
write (trace->fd, str, strlen (str)); write (trace->fd, str, strlen (str));

View file

@ -29,7 +29,9 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#include <utime.h> #include <utime.h>
@ -757,9 +759,9 @@ gst_xml_registry_parse_element_factory (GMarkupParseContext * context,
gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), rank); gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), rank);
} }
} else if (!strcmp (tag, "uri_type")) { } else if (!strcmp (tag, "uri_type")) {
if (strncasecmp (text, "sink", 4) == 0) { if (g_ascii_strncasecmp (text, "sink", 4) == 0) {
factory->uri_type = GST_URI_SINK; factory->uri_type = GST_URI_SINK;
} else if (strncasecmp (text, "source", 5) == 0) { } else if (g_ascii_strncasecmp (text, "source", 5) == 0) {
factory->uri_type = GST_URI_SRC; factory->uri_type = GST_URI_SRC;
} }
} else if (!strcmp (tag, "uri_protocol")) { } else if (!strcmp (tag, "uri_protocol")) {

View file

@ -58,7 +58,7 @@ typedef struct _GstDParamClass GstDParamClass;
typedef enum { typedef enum {
GST_DPARAM_UPDATE_FIRST, GST_DPARAM_UPDATE_FIRST,
GST_DPARAM_UPDATE_NORMAL, GST_DPARAM_UPDATE_NORMAL
} GstDParamUpdateInfo; } GstDParamUpdateInfo;
typedef void (*GstDParamDoUpdateFunction) (GstDParam *dparam, gint64 timestamp, GValue *value, GstDParamUpdateInfo update_info); typedef void (*GstDParamDoUpdateFunction) (GstDParam *dparam, gint64 timestamp, GValue *value, GstDParamUpdateInfo update_info);

View file

@ -49,7 +49,7 @@ G_BEGIN_DECLS
typedef enum { typedef enum {
GST_DPMAN_CALLBACK, GST_DPMAN_CALLBACK,
GST_DPMAN_DIRECT, GST_DPMAN_DIRECT,
GST_DPMAN_ARRAY, GST_DPMAN_ARRAY
} GstDPMUpdateMethod; } GstDPMUpdateMethod;
typedef struct _GstDParamManagerClass GstDParamManagerClass; typedef struct _GstDParamManagerClass GstDParamManagerClass;