|
| 1 | +diff --git a/lib/cdda_interface/utils.c b/lib/cdda_interface/utils.c |
| 2 | +index 9aed89d..59954db 100644 |
| 3 | +--- a/lib/cdda_interface/utils.c |
| 4 | ++++ b/lib/cdda_interface/utils.c |
| 5 | +@@ -26,12 +26,23 @@ |
| 6 | + # include <sys/time.h> |
| 7 | + #endif |
| 8 | + |
| 9 | ++#if defined(_MSC_VER) |
| 10 | ++#include <io.h> |
| 11 | ++#ifndef STDERR_FILENO |
| 12 | ++#define STDERR_FILENO 2 |
| 13 | ++#endif |
| 14 | ++#endif |
| 15 | ++ |
| 16 | + #include "common_interface.h" |
| 17 | + #include "utils.h" |
| 18 | + void |
| 19 | + cderror(cdrom_drive_t *d,const char *s) |
| 20 | + { |
| 21 | ++#ifndef _MSC_VER |
| 22 | + ssize_t bytes_ret __attribute__((unused)); |
| 23 | ++#else |
| 24 | ++ ssize_t bytes_ret; |
| 25 | ++#endif |
| 26 | + if(s && d){ |
| 27 | + switch(d->errordest){ |
| 28 | + case CDDA_MESSAGE_PRINTIT: |
| 29 | +@@ -52,7 +63,11 @@ cderror(cdrom_drive_t *d,const char *s) |
| 30 | + void |
| 31 | + cdmessage(cdrom_drive_t *d, const char *s) |
| 32 | + { |
| 33 | ++#ifndef _MSC_VER |
| 34 | + ssize_t bytes_ret __attribute__((unused)); |
| 35 | ++#else |
| 36 | ++ ssize_t bytes_ret; |
| 37 | ++#endif |
| 38 | + if(s && d){ |
| 39 | + switch(d->messagedest){ |
| 40 | + case CDDA_MESSAGE_PRINTIT: |
| 41 | +@@ -87,7 +102,11 @@ idperror(int messagedest,char **messages,const char *f, |
| 42 | + } |
| 43 | + |
| 44 | + if(buffer){ |
| 45 | ++#ifndef _MSC_VER |
| 46 | + ssize_t bytes_ret __attribute__((unused)); |
| 47 | ++#else |
| 48 | ++ ssize_t bytes_ret; |
| 49 | ++#endif |
| 50 | + switch(messagedest){ |
| 51 | + case CDDA_MESSAGE_PRINTIT: |
| 52 | + bytes_ret = write(STDERR_FILENO,buffer,strlen(buffer)); |
| 53 | +@@ -121,7 +140,11 @@ idmessage(int messagedest,char **messages,const char *f, |
| 54 | + { |
| 55 | + char *buffer; |
| 56 | + int malloced=0; |
| 57 | ++#ifndef _MSC_VER |
| 58 | + ssize_t bytes_ret __attribute__((unused)); |
| 59 | ++#else |
| 60 | ++ ssize_t bytes_ret; |
| 61 | ++#endif |
| 62 | + if(!f) |
| 63 | + buffer=(char *)s; |
| 64 | + else |
| 65 | +diff --git a/lib/cdda_interface/utils.h b/lib/cdda_interface/utils.h |
| 66 | +index 2dd4a3c..bd7c327 100644 |
| 67 | +--- a/lib/cdda_interface/utils.h |
| 68 | ++++ b/lib/cdda_interface/utils.h |
| 69 | +@@ -21,10 +21,18 @@ |
| 70 | + #include <stdio.h> |
| 71 | + #include <time.h> |
| 72 | + |
| 73 | ++#if !defined(HAVE_STRUCT_TIMESPEC) |
| 74 | ++struct timespec |
| 75 | ++{ |
| 76 | ++ time_t tv_sec; /* Seconds */ |
| 77 | ++ long tv_nsec; /* Nanoseconds */ |
| 78 | ++}; |
| 79 | ++#endif |
| 80 | ++ |
| 81 | + /* I wonder how many alignment issues this is gonna trip in the |
| 82 | + future... it shouldn't trip any... I guess we'll find out :) */ |
| 83 | + |
| 84 | +-static inline int |
| 85 | ++static CDIO_INLINE int |
| 86 | + bigendianp(void) |
| 87 | + { |
| 88 | + int test=1; |
| 89 | +@@ -41,32 +49,32 @@ extern int gettime(struct timespec *); |
| 90 | + |
| 91 | + #ifndef WORDS_BIGENDIAN |
| 92 | + |
| 93 | +-static inline int16_t be16_to_cpu(int16_t x){ |
| 94 | ++static CDIO_INLINE int16_t be16_to_cpu(int16_t x){ |
| 95 | + return(UINT16_SWAP_LE_BE_C(x)); |
| 96 | + } |
| 97 | + |
| 98 | +-static inline int16_t le16_to_cpu(int16_t x){ |
| 99 | ++static CDIO_INLINE int16_t le16_to_cpu(int16_t x){ |
| 100 | + return(x); |
| 101 | + } |
| 102 | + |
| 103 | + #else |
| 104 | + |
| 105 | +-static inline int16_t be16_to_cpu(int16_t x){ |
| 106 | ++static CDIO_INLINE int16_t be16_to_cpu(int16_t x){ |
| 107 | + return(x); |
| 108 | + } |
| 109 | + |
| 110 | +-static inline int16_t le16_to_cpu(int16_t x){ |
| 111 | ++static CDIO_INLINE int16_t le16_to_cpu(int16_t x){ |
| 112 | + return(UINT16_SWAP_LE_BE_C(x)); |
| 113 | + } |
| 114 | + |
| 115 | + |
| 116 | + #endif |
| 117 | + |
| 118 | +-static inline int16_t cpu_to_be16(int16_t x){ |
| 119 | ++static CDIO_INLINE int16_t cpu_to_be16(int16_t x){ |
| 120 | + return(be16_to_cpu(x)); |
| 121 | + } |
| 122 | + |
| 123 | +-static inline int16_t cpu_to_le16(int16_t x){ |
| 124 | ++static CDIO_INLINE int16_t cpu_to_le16(int16_t x){ |
| 125 | + return(le16_to_cpu(x)); |
| 126 | + } |
| 127 | + |
| 128 | +diff --git a/lib/paranoia/p_block.h b/lib/paranoia/p_block.h |
| 129 | +index 6e39b48..dcf70e7 100644 |
| 130 | +--- a/lib/paranoia/p_block.h |
| 131 | ++++ b/lib/paranoia/p_block.h |
| 132 | +@@ -43,7 +43,7 @@ typedef struct { |
| 133 | + struct linked_element *head; |
| 134 | + struct linked_element *tail; |
| 135 | + |
| 136 | +- void *(*new_poly)(); |
| 137 | ++ void *(*new_poly)(void); |
| 138 | + void (*free_poly)(void *poly); |
| 139 | + long current; |
| 140 | + long active; |
| 141 | +diff --git a/lib/paranoia/paranoia.c b/lib/paranoia/paranoia.c |
| 142 | +index 4175723..aeb5746 100644 |
| 143 | +--- a/lib/paranoia/paranoia.c |
| 144 | ++++ b/lib/paranoia/paranoia.c |
| 145 | +@@ -94,13 +94,16 @@ |
| 146 | + #ifdef HAVE_STDLIB_H |
| 147 | + #include <stdlib.h> |
| 148 | + #endif |
| 149 | ++#ifdef HAVE_UNISTD_H |
| 150 | + #include <unistd.h> |
| 151 | ++#endif |
| 152 | + #include <stdio.h> |
| 153 | + #include <limits.h> |
| 154 | + #ifdef HAVE_STRING_H |
| 155 | + #include <string.h> |
| 156 | + #endif |
| 157 | + #include <math.h> |
| 158 | ++#include <cdio/bytesex.h> |
| 159 | + #include <cdio/paranoia/cdda.h> |
| 160 | + #include "../cdda_interface/smallft.h" |
| 161 | + #include <cdio/paranoia/version.h> |
| 162 | +@@ -138,7 +141,7 @@ const char *paranoia_cb_mode2str[] = { |
| 163 | + paranoia_mode_t debug_paranoia_mode; |
| 164 | + paranoia_cb_mode_t debug_paranoia_cb_mode; |
| 165 | + |
| 166 | +-static inline long |
| 167 | ++static CDIO_INLINE long |
| 168 | + re(root_block *root) |
| 169 | + { |
| 170 | + if (!root)return(-1); |
| 171 | +@@ -146,7 +149,7 @@ re(root_block *root) |
| 172 | + return(ce(root->vector)); |
| 173 | + } |
| 174 | + |
| 175 | +-static inline long |
| 176 | ++static CDIO_INLINE long |
| 177 | + rb(root_block *root) |
| 178 | + { |
| 179 | + if (!root)return(-1); |
| 180 | +@@ -154,7 +157,7 @@ rb(root_block *root) |
| 181 | + return(cb(root->vector)); |
| 182 | + } |
| 183 | + |
| 184 | +-static inline |
| 185 | ++static CDIO_INLINE |
| 186 | + long rs(root_block *root) |
| 187 | + { |
| 188 | + if (!root)return(-1); |
| 189 | +@@ -162,7 +165,7 @@ long rs(root_block *root) |
| 190 | + return(cs(root->vector)); |
| 191 | + } |
| 192 | + |
| 193 | +-static inline int16_t * |
| 194 | ++static CDIO_INLINE int16_t * |
| 195 | + rv(root_block *root){ |
| 196 | + if (!root)return(NULL); |
| 197 | + if (!root->vector)return(NULL); |
| 198 | +@@ -204,7 +207,7 @@ enum { |
| 199 | + * If (ret_begin) or (ret_end) are not NULL, it fills them with the |
| 200 | + * offsets of the first and last matching samples in A. |
| 201 | + */ |
| 202 | +-static inline long |
| 203 | ++static CDIO_INLINE long |
| 204 | + i_paranoia_overlap(int16_t *buffA,int16_t *buffB, |
| 205 | + long offsetA, long offsetB, |
| 206 | + long sizeA,long sizeB, |
| 207 | +@@ -246,7 +249,7 @@ i_paranoia_overlap(int16_t *buffA,int16_t *buffB, |
| 208 | + * If (ret_begin) or (ret_end) are not NULL, it fills them with the |
| 209 | + * offsets of the first and last matching samples in A. |
| 210 | + */ |
| 211 | +-static inline long |
| 212 | ++static CDIO_INLINE long |
| 213 | + i_paranoia_overlap2(int16_t *buffA,int16_t *buffB, |
| 214 | + unsigned char *flagsA, |
| 215 | + unsigned char *flagsB, |
| 216 | +@@ -325,7 +328,7 @@ i_paranoia_overlap2(int16_t *buffA,int16_t *buffB, |
| 217 | + * (I.e., offset indicates the distance between what A considers sample N |
| 218 | + * on the CD and what B considers sample N.) |
| 219 | + */ |
| 220 | +-static inline long int |
| 221 | ++static CDIO_INLINE long int |
| 222 | + do_const_sync(c_block_t *A, |
| 223 | + sort_info_t *B, |
| 224 | + unsigned char *flagB, |
| 225 | +@@ -395,7 +398,7 @@ do_const_sync(c_block_t *A, |
| 226 | + post from root. Begin, end, offset count from B's frame of |
| 227 | + reference */ |
| 228 | + |
| 229 | +-static inline long int |
| 230 | ++static CDIO_INLINE long int |
| 231 | + try_sort_sync(cdrom_paranoia_t *p, |
| 232 | + sort_info_t *A, unsigned char *Aflags, |
| 233 | + c_block_t *B, |
| 234 | +@@ -546,7 +549,7 @@ afterward. */ |
| 235 | + * into the verified root (and its absolute position determined) in |
| 236 | + * stage 2. |
| 237 | + */ |
| 238 | +-static inline void |
| 239 | ++static CDIO_INLINE void |
| 240 | + stage1_matched(c_block_t *old, c_block_t *new, |
| 241 | + long matchbegin,long matchend, |
| 242 | + long matchoffset, |
| 243 | +diff --git a/src/header.c b/src/header.c |
| 244 | +index e27c217..b0a3172 100644 |
| 245 | +--- a/src/header.c |
| 246 | ++++ b/src/header.c |
| 247 | +@@ -39,7 +39,11 @@ static void PutNum(long num,int f,int endianness,int bytes){ |
| 248 | + void |
| 249 | + WriteWav(int f, long int bytes) |
| 250 | + { |
| 251 | ++#ifndef _MSC_VER |
| 252 | + int dummy __attribute__((unused)); |
| 253 | ++#else |
| 254 | ++ int dummy; |
| 255 | ++#endif |
| 256 | + |
| 257 | + /* quick and dirty */ |
| 258 | + |
| 259 | +@@ -63,7 +67,11 @@ WriteAiff(int f, long int bytes) |
| 260 | + { |
| 261 | + long size=bytes+54; |
| 262 | + long frames=bytes/4; |
| 263 | ++#ifndef _MSC_VER |
| 264 | + int dummy __attribute__((unused)); |
| 265 | ++#else |
| 266 | ++ int dummy; |
| 267 | ++#endif |
| 268 | + |
| 269 | + /* Again, quick and dirty */ |
| 270 | + |
| 271 | +@@ -91,7 +99,11 @@ WriteAifc(int f, long bytes) |
| 272 | + { |
| 273 | + long size=bytes+86; |
| 274 | + long frames=bytes/4; |
| 275 | ++#ifndef _MSC_VER |
| 276 | + int dummy __attribute__((unused)); |
| 277 | ++#else |
| 278 | ++ int dummy; |
| 279 | ++#endif |
| 280 | + |
| 281 | + /* Again, quick and dirty */ |
| 282 | + |
0 commit comments