gst/gsttypes.h: get rid of GST_O_READONLY, GST_FILE_MODE_READ and

Original commit message from CVS:
* gst/gsttypes.h:
get rid of GST_O_READONLY, GST_FILE_MODE_READ and
GST_FILE_MODE_WRITE, I don't want them in the exported headers. It
just causes support madness
* gst/elements/gstfilesrc.c: (gst_filesrc_open_file):
make it work without this
* gst/indexers/gstfileindex.c: (_file_index_id_save_entries),
(gst_file_index_commit):
glib IO channels don't want binary mode
* testsuite/bytestream/filepadsink.c: (main):
* testsuite/bytestream/test1.c: (read_param_file):
use "rb" instead of GST_FILE_MODE_READ, it works on POSIX systems
This commit is contained in:
Benjamin Otte 2004-07-12 21:57:35 +00:00
parent d77dbaac2f
commit f1d9a4c380
10 changed files with 33 additions and 19 deletions

View file

@ -1,3 +1,18 @@
2004-07-12 Benjamin Otte <otte@gnome.org>
* gst/gsttypes.h:
get rid of GST_O_READONLY, GST_FILE_MODE_READ and
GST_FILE_MODE_WRITE, I don't want them in the exported headers. It
just causes support madness
* gst/elements/gstfilesrc.c: (gst_filesrc_open_file):
make it work without this
* gst/indexers/gstfileindex.c: (_file_index_id_save_entries),
(gst_file_index_commit):
glib IO channels don't want binary mode
* testsuite/bytestream/filepadsink.c: (main):
* testsuite/bytestream/test1.c: (read_param_file):
use "rb" instead of GST_FILE_MODE_READ, it works on POSIX systems
2004-07-12 Benjamin Otte <otte@gnome.org>
* gst/gstelement.c: (gst_element_class_init),

View file

@ -51,6 +51,10 @@
#ifndef S_ISSOCK
#define S_ISSOCK(x) (0)
#endif
/* FIXME: is that enough or should we do #ifdef __WIN32__ stuff? */
#ifndef O_BINARY
#define O_BINARY (0)
#endif
/**********************************************************************
* GStreamer Default File Source
@ -756,7 +760,7 @@ gst_filesrc_open_file (GstFileSrc * src)
GST_INFO_OBJECT (src, "opening file %s", src->filename);
/* open the file */
src->fd = open (src->filename, GST_O_READONLY);
src->fd = open (src->filename, O_RDONLY | O_BINARY);
if (src->fd < 0) {
if (errno == ENOENT)
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),

View file

@ -66,15 +66,6 @@ typedef enum {
#define GST_PADDING 4
#define GST_PADDING_INIT { 0 }
#ifdef WIN32
#define GST_FILE_MODE_READ "rb"
#define GST_FILE_MODE_WRITE "wb"
#define GST_O_READONLY O_RDONLY|O_BINARY
#else
#define GST_FILE_MODE_READ "r"
#define GST_FILE_MODE_WRITE "w"
#define GST_O_READONLY O_RDONLY
#endif
G_END_DECLS

View file

@ -543,7 +543,7 @@ _file_index_id_save_entries (gpointer * _key,
err = NULL;
path = g_strdup_printf ("%s/%d", prefix, ii->id);
chan = g_io_channel_new_file (path, GST_FILE_MODE_WRITE, &err);
chan = g_io_channel_new_file (path, "w", &err);
g_free (path);
if (err)
goto fail;
@ -605,7 +605,7 @@ gst_file_index_commit (GstIndex * _index, gint _writer_id)
}
path = g_strdup_printf ("%s/gstindex.xml", index->location);
tocfile = g_io_channel_new_file (path, GST_FILE_MODE_WRITE, &err);
tocfile = g_io_channel_new_file (path, "w", &err);
g_free (path);
if (err) {
GST_ERROR_OBJECT (index, "%s", err->message);

View file

@ -51,6 +51,10 @@
#ifndef S_ISSOCK
#define S_ISSOCK(x) (0)
#endif
/* FIXME: is that enough or should we do #ifdef __WIN32__ stuff? */
#ifndef O_BINARY
#define O_BINARY (0)
#endif
/**********************************************************************
* GStreamer Default File Source
@ -756,7 +760,7 @@ gst_filesrc_open_file (GstFileSrc * src)
GST_INFO_OBJECT (src, "opening file %s", src->filename);
/* open the file */
src->fd = open (src->filename, GST_O_READONLY);
src->fd = open (src->filename, O_RDONLY | O_BINARY);
if (src->fd < 0) {
if (errno == ENOENT)
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),

View file

@ -543,7 +543,7 @@ _file_index_id_save_entries (gpointer * _key,
err = NULL;
path = g_strdup_printf ("%s/%d", prefix, ii->id);
chan = g_io_channel_new_file (path, GST_FILE_MODE_WRITE, &err);
chan = g_io_channel_new_file (path, "w", &err);
g_free (path);
if (err)
goto fail;
@ -605,7 +605,7 @@ gst_file_index_commit (GstIndex * _index, gint _writer_id)
}
path = g_strdup_printf ("%s/gstindex.xml", index->location);
tocfile = g_io_channel_new_file (path, GST_FILE_MODE_WRITE, &err);
tocfile = g_io_channel_new_file (path, "w", &err);
g_free (path);
if (err) {
GST_ERROR_OBJECT (index, "%s", err->message);

View file

@ -259,7 +259,7 @@ main (gint argc, gchar ** argv)
if (!gst_element_link (src, sink))
g_assert_not_reached ();
g_object_set (src, "location", THE_FILE, NULL);
GST_FP_SINK (sink)->stream = fopen (THE_FILE, GST_FILE_MODE_READ);
GST_FP_SINK (sink)->stream = fopen (THE_FILE, "rb");
g_assert (GST_FP_SINK (sink)->stream);
/* check correct file sizes */
if (fseek (GST_FP_SINK (sink)->stream, 0, SEEK_END) != 0)

View file

@ -68,7 +68,7 @@ read_param_file (gchar * filename)
gchar *scan_str;
gboolean res = TRUE;
fp = fopen (filename, GST_FILE_MODE_READ);
fp = fopen (filename, "rb");
if (fp == NULL)
return FALSE;

View file

@ -259,7 +259,7 @@ main (gint argc, gchar ** argv)
if (!gst_element_link (src, sink))
g_assert_not_reached ();
g_object_set (src, "location", THE_FILE, NULL);
GST_FP_SINK (sink)->stream = fopen (THE_FILE, GST_FILE_MODE_READ);
GST_FP_SINK (sink)->stream = fopen (THE_FILE, "rb");
g_assert (GST_FP_SINK (sink)->stream);
/* check correct file sizes */
if (fseek (GST_FP_SINK (sink)->stream, 0, SEEK_END) != 0)

View file

@ -68,7 +68,7 @@ read_param_file (gchar * filename)
gchar *scan_str;
gboolean res = TRUE;
fp = fopen (filename, GST_FILE_MODE_READ);
fp = fopen (filename, "rb");
if (fp == NULL)
return FALSE;