From 38890ac6dc1e3cebb90e60d70cea8da8009ee8da Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 4 Dec 2011 19:40:35 +0000 Subject: [PATCH] sansapatcher: guard platform specific files. Use the preprocessor to make platform specific files compile as empty files if built for a different platform. This removes the need to distinguish in the Makefile and simplifies creating a libsansapatcher. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31143 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/sansapatcher/sansaio-posix.c | 3 +++ rbutil/sansapatcher/sansaio-win32.c | 3 +++ rbutil/sansapatcher/sansaio.h | 9 ++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/rbutil/sansapatcher/sansaio-posix.c b/rbutil/sansapatcher/sansaio-posix.c index 56f755ab9a..cb169ce309 100644 --- a/rbutil/sansapatcher/sansaio-posix.c +++ b/rbutil/sansapatcher/sansaio-posix.c @@ -19,6 +19,7 @@ * ****************************************************************************/ +#if !defined(_WIN32) /* all non-Windows platforms supported are POSIX. */ #include #include #include @@ -142,3 +143,5 @@ int sansa_write(struct sansa_t* sansa, unsigned char* buf, int nbytes) { return write(sansa->dh, buf, nbytes); } +#endif + diff --git a/rbutil/sansapatcher/sansaio-win32.c b/rbutil/sansapatcher/sansaio-win32.c index 5797eae2aa..196ee1c636 100644 --- a/rbutil/sansapatcher/sansaio-win32.c +++ b/rbutil/sansapatcher/sansaio-win32.c @@ -25,6 +25,7 @@ * ****************************************************************************/ +#if defined(_WIN32) #include #include #include @@ -199,3 +200,5 @@ int sansa_write(struct sansa_t* sansa, unsigned char* buf, int nbytes) return count; } +#endif + diff --git a/rbutil/sansapatcher/sansaio.h b/rbutil/sansapatcher/sansaio.h index 9563b572a7..d705c121b8 100644 --- a/rbutil/sansapatcher/sansaio.h +++ b/rbutil/sansapatcher/sansaio.h @@ -25,7 +25,7 @@ #include #include -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(_WIN32) #include #define loff_t int64_t #else @@ -40,6 +40,10 @@ #endif +#ifdef __cplusplus +extern "C" { +#endif + struct sansa_partinfo_t { unsigned long start; /* first sector (LBA) */ unsigned long size; /* number of sectors */ @@ -74,4 +78,7 @@ int sansa_read(struct sansa_t* sansa, unsigned char* buf, int nbytes); int sansa_write(struct sansa_t* sansa, unsigned char* buf, int nbytes); int sansa_alloc_buffer(unsigned char** sectorbuf, int bufsize); +#ifdef __cplusplus +} +#endif #endif -- 2.11.4.GIT