summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2011-12-04 19:40:35 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2011-12-04 19:40:35 +0000
commit38890ac6dc1e3cebb90e60d70cea8da8009ee8da (patch)
tree47ac7a259bf7dcd2785170e903695598aa6ccad4
parenta43df152c2adf737208bbeb294a0a13608d3cc43 (diff)
downloadrockbox-38890ac6dc1e3cebb90e60d70cea8da8009ee8da.tar.gz
rockbox-38890ac6dc1e3cebb90e60d70cea8da8009ee8da.zip
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
-rw-r--r--rbutil/sansapatcher/sansaio-posix.c3
-rw-r--r--rbutil/sansapatcher/sansaio-win32.c3
-rw-r--r--rbutil/sansapatcher/sansaio.h9
3 files changed, 14 insertions, 1 deletions
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 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#if !defined(_WIN32) /* all non-Windows platforms supported are POSIX. */
22#include <stdio.h> 23#include <stdio.h>
23#include <unistd.h> 24#include <unistd.h>
24#include <fcntl.h> 25#include <fcntl.h>
@@ -142,3 +143,5 @@ int sansa_write(struct sansa_t* sansa, unsigned char* buf, int nbytes)
142{ 143{
143 return write(sansa->dh, buf, nbytes); 144 return write(sansa->dh, buf, nbytes);
144} 145}
146#endif
147
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 @@
25 * 25 *
26 ****************************************************************************/ 26 ****************************************************************************/
27 27
28#if defined(_WIN32)
28#include <stdio.h> 29#include <stdio.h>
29#include <unistd.h> 30#include <unistd.h>
30#include <fcntl.h> 31#include <fcntl.h>
@@ -199,3 +200,5 @@ int sansa_write(struct sansa_t* sansa, unsigned char* buf, int nbytes)
199 200
200 return count; 201 return count;
201} 202}
203#endif
204
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 @@
25#include <stdint.h> 25#include <stdint.h>
26#include <unistd.h> 26#include <unistd.h>
27 27
28#ifdef __WIN32__ 28#if defined(__WIN32__) || defined(_WIN32)
29#include <windows.h> 29#include <windows.h>
30#define loff_t int64_t 30#define loff_t int64_t
31#else 31#else
@@ -40,6 +40,10 @@
40 40
41#endif 41#endif
42 42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
43struct sansa_partinfo_t { 47struct sansa_partinfo_t {
44 unsigned long start; /* first sector (LBA) */ 48 unsigned long start; /* first sector (LBA) */
45 unsigned long size; /* number of sectors */ 49 unsigned long size; /* number of sectors */
@@ -74,4 +78,7 @@ int sansa_read(struct sansa_t* sansa, unsigned char* buf, int nbytes);
74int sansa_write(struct sansa_t* sansa, unsigned char* buf, int nbytes); 78int sansa_write(struct sansa_t* sansa, unsigned char* buf, int nbytes);
75int sansa_alloc_buffer(unsigned char** sectorbuf, int bufsize); 79int sansa_alloc_buffer(unsigned char** sectorbuf, int bufsize);
76 80
81#ifdef __cplusplus
82}
83#endif
77#endif 84#endif