Update of /cvsroot/pure-data/externals/pdogg/oggwrite~
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23207/oggwrite~
Modified Files:
oggwrite~.c
Log Message:
fixes for MinGW
Index: oggwrite~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/pdogg/oggwrite~/oggwrite~.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** oggwrite~.c 27 Nov 2005 07:11:07 -0000 1.7
--- oggwrite~.c 12 Dec 2005 06:39:07 -0000 1.8
***************
*** 28,32 ****
! #ifdef NT
#pragma warning( disable : 4244 )
#pragma warning( disable : 4305 )
--- 28,32 ----
! #ifdef _MSC_VER
#pragma warning( disable : 4244 )
#pragma warning( disable : 4305 )
***************
*** 45,49 ****
#include <ctype.h>
#include <time.h>
! #ifdef UNIX
#include <unistd.h>
#include <sys/socket.h>
--- 45,54 ----
#include <ctype.h>
#include <time.h>
! #ifdef WIN32
! #include <io.h>
! #include <windows.h>
! #include <winsock.h>
! #include <windef.h>
! #else
#include <unistd.h>
#include <sys/socket.h>
***************
*** 52,60 ****
#include <sys/time.h>
#define SOCKET_ERROR -1
- #else
- #include <io.h>
- #include <windows.h>
- #include <winsock.h>
- #include <windef.h>
#endif
--- 57,60 ----
***************
*** 127,135 ****
static void sys_closesocket(int fd)
{
! #ifdef UNIX
! close(fd);
! #endif
! #ifdef NT
closesocket(fd);
#endif
}
--- 127,134 ----
static void sys_closesocket(int fd)
{
! #ifdef WIN32
closesocket(fd);
+ #else
+ close(fd);
#endif
}
***************
*** 148,152 ****
int result=ogg_stream_pageout(&(x->x_os),&(x->x_og));
if(result==0)break;
! #ifndef UNIX
err = _write(x->x_fd, x->x_og.header, x->x_og.header_len);
#else
--- 147,151 ----
int result=ogg_stream_pageout(&(x->x_os),&(x->x_og));
if(result==0)break;
! #ifdef WIN32
err = _write(x->x_fd, x->x_og.header, x->x_og.header_len);
#else
***************
*** 159,163 ****
return err;
}
! #ifndef UNIX
err = _write(x->x_fd, x->x_og.body, x->x_og.body_len);
#else
--- 158,162 ----
return err;
}
! #ifdef WIN32
err = _write(x->x_fd, x->x_og.body, x->x_og.body_len);
#else
***************
*** 222,226 ****
if(x->x_fd > 0)
{
! #ifndef UNIX
if(_close(x->x_fd) < 0)
#else
--- 221,225 ----
if(x->x_fd > 0)
{
! #ifdef WIN32
if(_close(x->x_fd) < 0)
#else
***************
*** 376,380 ****
int result=ogg_stream_flush(&(x->x_os),&(x->x_og));
if(result==0)break;
! #ifndef UNIX
err = _write(x->x_fd, x->x_og.header, x->x_og.header_len);
#else
--- 375,379 ----
int result=ogg_stream_flush(&(x->x_os),&(x->x_og));
if(result==0)break;
! #ifdef WIN32
err = _write(x->x_fd, x->x_og.header, x->x_og.header_len);
#else
***************
*** 388,392 ****
if(x->x_fd > 0)
{
! #ifndef UNIX
if(_close(x->x_fd) < 0)
#else
--- 387,391 ----
if(x->x_fd > 0)
{
! #ifdef WIN32
if(_close(x->x_fd) < 0)
#else
***************
*** 400,404 ****
return;
}
! #ifndef UNIX
err = _write(x->x_fd, x->x_og.body, x->x_og.body_len);
#else
--- 399,403 ----
return;
}
! #ifdef WIN32
err = _write(x->x_fd, x->x_og.body, x->x_og.body_len);
#else
***************
*** 412,416 ****
if(x->x_fd > 0)
{
! #ifndef UNIX
if(_close(x->x_fd) < 0)
#else
--- 411,415 ----
if(x->x_fd > 0)
{
! #ifdef WIN32
if(_close(x->x_fd) < 0)
#else
***************
*** 452,456 ****
if(x->x_fd > 0)
{
! #ifndef UNIX
if(_close(x->x_fd) < 0)
#else
--- 451,455 ----
if(x->x_fd > 0)
{
! #ifdef WIN32
if(_close(x->x_fd) < 0)
#else
***************
*** 468,472 ****
}
! #ifndef UNIX
if((x->x_fd = _open( sfile->s_name, x->x_file_open_mode, _S_IREAD|_S_IWRITE)) < 0)
#else
--- 467,471 ----
}
! #ifdef WIN32
if((x->x_fd = _open( sfile->s_name, x->x_file_open_mode, _S_IREAD|_S_IWRITE)) < 0)
#else
***************
*** 493,497 ****
static void oggwrite_append(t_oggwrite *x)
{
! #ifndef UNIX
x->x_file_open_mode = _O_CREAT|_O_WRONLY|_O_APPEND|_O_BINARY;
#else
--- 492,496 ----
static void oggwrite_append(t_oggwrite *x)
{
! #ifdef WIN32
x->x_file_open_mode = _O_CREAT|_O_WRONLY|_O_APPEND|_O_BINARY;
#else
***************
*** 504,508 ****
static void oggwrite_truncate(t_oggwrite *x)
{
! #ifndef UNIX
x->x_file_open_mode = _O_CREAT|_O_WRONLY|_O_TRUNC|_O_BINARY;
#else
--- 503,507 ----
static void oggwrite_truncate(t_oggwrite *x)
{
! #ifdef WIN32
x->x_file_open_mode = _O_CREAT|_O_WRONLY|_O_TRUNC|_O_BINARY;
#else
***************
*** 683,687 ****
if(x->x_fd >= 0)
{ /* close file */
! #ifndef UNIX
_close(x->x_fd);
#else
--- 682,686 ----
if(x->x_fd >= 0)
{ /* close file */
! #ifdef WIN32
_close(x->x_fd);
#else
***************
*** 700,704 ****
x->x_outpages = outlet_new(&x->x_obj, gensym("float"));
x->x_fd = -1;
! #ifndef UNIX
x->x_file_open_mode = _O_CREAT|_O_WRONLY|_O_APPEND|_O_BINARY;
#else
--- 699,703 ----
x->x_outpages = outlet_new(&x->x_obj, gensym("float"));
x->x_fd = -1;
! #ifdef WIN32
x->x_file_open_mode = _O_CREAT|_O_WRONLY|_O_APPEND|_O_BINARY;
#else