Commit f079b4f8 authored by conrad's avatar conrad

clean away #ifdef _WIN32 portions:

	- #include <fcntl.h> even on non-WIN32, where needed
	- put setting of stdin, stdout binary modes into ot_init()
 abstract out into ot_init()


git-svn-id: http://svn.annodex.net/liboggz/trunk@1087 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 31010d99
......@@ -33,10 +33,10 @@ oggzinfo_LDADD = $(OGGZ_LIBS) -lm
oggzed_SOURCES = oggzed.c
oggzed_LDADD = $(OGGZ_LIBS)
oggzdump_SOURCES = oggzdump.c
oggzdump_SOURCES = oggzdump.c oggz_tools.c
oggzdump_LDADD = $(OGGZ_LIBS)
oggzmerge_SOURCES = oggzmerge.c
oggzmerge_SOURCES = oggzmerge.c oggz_tools.c
oggzmerge_LDADD = $(OGGZ_LIBS)
oggzrip_SOURCES = oggzrip.c oggz_tools.c
......
......@@ -249,3 +249,14 @@ ot_print_time (double seconds)
return printf ("%s%02d:%02d:%02.3f", sign, hrs, min, sec);
}
}
void
ot_init (void)
{
#ifdef _WIN32
/* We need to set stdin/stdout to binary mode */
_setmode( _fileno( stdin ), _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
#endif
}
......@@ -52,4 +52,10 @@ int ot_print_bitrate (long bps);
int ot_print_time (double seconds);
/*
* Tool initialization function. Sets stdin, stdio to binary on windows etc.
* Call this at the beginning of main().
*/
void ot_init (void);
#endif /* __OGGZ_TOOLS_H__ */
......@@ -47,6 +47,7 @@
#include <errno.h>
#include <oggz/oggz.h>
#include "oggz_tools.h"
#define DEBUG
......@@ -377,6 +378,8 @@ main (int argc, char ** argv)
int i, size;
long n;
ot_init ();
progname = argv[0];
if (argc < 2) {
......
......@@ -41,10 +41,10 @@
#include <oggz/oggz.h>
#include "oggz_tools.h"
#ifndef WIN32
#include <inttypes.h>
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#else
#define PRId64 "ld"
# define PRId64 "I64d"
#endif
static void
......
......@@ -35,17 +35,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <getopt.h>
#include <errno.h>
#include <oggz/oggz.h>
#ifdef _WIN32
/* Supply missing headers and functions for Win32 */
#include <fcntl.h>
#endif
#include "oggz_tools.h"
#define READ_SIZE 4096
......@@ -245,12 +241,7 @@ main (int argc, char * argv[])
OMData * omdata;
int i;
#ifdef _WIN32
/* We need to set stdin/stdout to binary mode */
_setmode( _fileno( stdin ), _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
#endif
ot_init ();
progname = argv[0];
......
......@@ -39,6 +39,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <getopt.h>
......@@ -47,12 +48,6 @@
#include <oggz/oggz.h>
#include "oggz_tools.h"
#ifdef _WIN32
/* Supply missing headers and functions for Win32 */
#include <fcntl.h>
#endif
#define READ_SIZE 4096
#define WRITE_SIZE 4096
......@@ -305,12 +300,7 @@ main (int argc, char * argv[])
long l;
int i, n;
#ifdef _WIN32
/* We need to set stdin/stdout to binary mode */
_setmode( _fileno( stdin ), _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
#endif
ot_init();
progname = argv[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment