From: Martin Baute Date: Fri, 25 Mar 2016 17:36:48 +0000 (+0100) Subject: Inlined some of the Cygwin patches. Not nice, but useful as I keep switching platforms. X-Git-Url: https://pd.if.org/git/?p=pdclib;a=commitdiff_plain;h=da0d02da53b8a309d85ae19e6b9e5ff1cde9c4a5 Inlined some of the Cygwin patches. Not nice, but useful as I keep switching platforms. --- diff --git a/platform/example/functions/_PDCLIB/_PDCLIB_allocpages.c b/platform/example/functions/_PDCLIB/_PDCLIB_allocpages.c index 9de9314..c24a6c0 100644 --- a/platform/example/functions/_PDCLIB/_PDCLIB_allocpages.c +++ b/platform/example/functions/_PDCLIB/_PDCLIB_allocpages.c @@ -42,7 +42,11 @@ void * _PDCLIB_allocpages( int const n ) /* increasing or decreasing heap - standard operation */ void * oldbreak = membreak; membreak = (void *)( (char *)membreak + ( n * _PDCLIB_PAGESIZE ) ); +#ifdef __CYGWIN__ + if ( sbrk( (char*)membreak - (char*)oldbreak ) == membreak ) +#else if ( brk( membreak ) == 0 ) +#endif { /* successful */ return oldbreak; diff --git a/platform/example/functions/_PDCLIB/_PDCLIB_seek.c b/platform/example/functions/_PDCLIB/_PDCLIB_seek.c index cafcee8..8c600f6 100644 --- a/platform/example/functions/_PDCLIB/_PDCLIB_seek.c +++ b/platform/example/functions/_PDCLIB/_PDCLIB_seek.c @@ -13,6 +13,7 @@ #include "/usr/include/errno.h" extern _PDCLIB_int64_t lseek64( int fd, _PDCLIB_int64_t offset, int whence ); +extern long lseek( int fd, long offset, int whence ); _PDCLIB_int64_t _PDCLIB_seek( struct _PDCLIB_file_t * stream, _PDCLIB_int64_t offset, int whence ) { @@ -31,7 +32,11 @@ _PDCLIB_int64_t _PDCLIB_seek( struct _PDCLIB_file_t * stream, _PDCLIB_int64_t of return EOF; break; } +#ifdef __CYGWIN__ + _PDCLIB_int64_t rc = lseek( stream->handle, offset, whence ); +#else _PDCLIB_int64_t rc = lseek64( stream->handle, offset, whence ); +#endif if ( rc != EOF ) { stream->ungetidx = 0;