]> pd.if.org Git - pdclib/commitdiff
Inlined some of the Cygwin patches. Not nice, but useful as I keep switching platforms.
authorMartin Baute <solar@rootdirectory.de>
Fri, 25 Mar 2016 17:36:48 +0000 (18:36 +0100)
committerMartin Baute <solar@rootdirectory.de>
Fri, 25 Mar 2016 17:36:48 +0000 (18:36 +0100)
platform/example/functions/_PDCLIB/_PDCLIB_allocpages.c
platform/example/functions/_PDCLIB/_PDCLIB_seek.c

index 9de9314ea64cc733de4ec3c02dbb73167902e158..c24a6c0a2ac226900bb42ce558a10a677a72d491 100644 (file)
@@ -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 ) );
     /* 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 )
     if ( brk( membreak ) == 0 )
+#endif
     {
         /* successful */
         return oldbreak;
     {
         /* successful */
         return oldbreak;
index cafcee8ddc2cfd64db234c335ca00e9754667321..8c600f6790f969e2b5a4d4356b5d780691b6cc09 100644 (file)
@@ -13,6 +13,7 @@
 #include "/usr/include/errno.h"
 
 extern _PDCLIB_int64_t lseek64( int fd, _PDCLIB_int64_t offset, int whence );
 #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 )
 {
 
 _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;
     }
             return EOF;
             break;
     }
+#ifdef __CYGWIN__
+    _PDCLIB_int64_t rc = lseek( stream->handle, offset, whence );
+#else
     _PDCLIB_int64_t rc = lseek64( stream->handle, offset, whence );
     _PDCLIB_int64_t rc = lseek64( stream->handle, offset, whence );
+#endif
     if ( rc != EOF )
     {
         stream->ungetidx = 0;
     if ( rc != EOF )
     {
         stream->ungetidx = 0;