diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-07-19 22:05:57 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-07-19 22:05:57 +0200 |
commit | ea3de25ff722577efcf32f70d9bbda4b4b0ab2c0 (patch) | |
tree | aacd22b2d30a2c5664b99b490fbcec57aa55d812 /libuniso.c | |
parent | 711f6fb1caa0861d1b3504d53c7f44c0582cbc97 (diff) | |
download | alpine-usb-creator-ea3de25ff722577efcf32f70d9bbda4b4b0ab2c0.tar.bz2 alpine-usb-creator-ea3de25ff722577efcf32f70d9bbda4b4b0ab2c0.tar.xz |
Make libuniso compile on windows
Diffstat (limited to 'libuniso.c')
-rw-r--r-- | libuniso.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -28,7 +28,20 @@ #include <stddef.h> #include <stdlib.h> #include <string.h> +#if defined(_WIN32) || \ + ( defined(__MWERKS__) && defined(__INTEL__) ) // windows case +#define __LITTLE_ENDIAN 1234 +#define __BYTE_ORDER __LITTLE_ENDIAN + +#define mkdir(x,y) mkdir(x) +#define u_int16_t uint16_t +#define u_int32_t uint32_t +#define EMEDIUMTYPE 124 /* Wrong medium type */ +#define be16toh(x) x = ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8)) + +#else #include <endian.h> +#endif #include <sys/stat.h> #include "uniso.h" @@ -228,6 +241,9 @@ static void update_progress(struct uniso_context *ctx) static int do_splice(struct uniso_context *ctx, int to_fd, int bytes) { +#if defined(_WIN32) + return -1; +#else int r; do { @@ -242,6 +258,7 @@ static int do_splice(struct uniso_context *ctx, int to_fd, int bytes) } while (bytes != 0); return 0; +#endif } static int do_read(struct uniso_context *ctx, unsigned char *buf, int bytes) @@ -388,8 +405,10 @@ static int link_or_clone(const char *src, const char *dst, size_t bytes) int r; static char buf[ISOFS_TMPBUF_SIZE]; +#if !defined(_WIN32) if (link(src, dst) == 0) return 0; +#endif src_fd = open(src, O_RDONLY); if (src_fd < 0) |