Fix CXX_BUILD for Apple

This commit is contained in:
Twinaphex 2017-12-27 22:33:32 +01:00
parent 56b4d4917c
commit b1c0fe7d0d
3 changed files with 125 additions and 116 deletions

View File

@ -116,7 +116,7 @@ struct FLAC__BitReader {
static INLINE void crc16_update_word_(FLAC__BitReader *br, brword word)
{
register unsigned crc = br->read_crc16;
unsigned crc = br->read_crc16;
#if FLAC__BYTES_PER_WORD == 4
switch(br->crc16_align) {
case 0: crc = FLAC__CRC16_UPDATE((unsigned)(word >> 24), crc); /* fallthrough */

29
deps/libFLAC/md5.c vendored
View File

@ -53,12 +53,10 @@
*/
static void FLAC__MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16])
{
register FLAC__uint32 a, b, c, d;
a = buf[0];
b = buf[1];
c = buf[2];
d = buf[3];
FLAC__uint32 a = buf[0];
FLAC__uint32 b = buf[1];
FLAC__uint32 c = buf[2];
FLAC__uint32 d = buf[3];
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
@ -138,7 +136,7 @@ static void FLAC__MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16])
//@@@@@@ OPT: use bswap/intrinsics
static void byteSwap(FLAC__uint32 *buf, unsigned words)
{
register FLAC__uint32 x;
FLAC__uint32 x;
do {
x = *buf;
x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
@ -147,12 +145,17 @@ static void byteSwap(FLAC__uint32 *buf, unsigned words)
}
static void byteSwapX16(FLAC__uint32 *buf)
{
register FLAC__uint32 x;
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
FALC__uint32 x = *buf;
x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
x = *buf;
x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
*buf++ = (x >> 16) | (x << 16);
x = *buf;
x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
*buf++ = (x >> 16) | (x << 16);
x = *buf;
x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
*buf++ = (x >> 16) | (x << 16);
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);
x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16);

View File

@ -67,12 +67,12 @@ CFComparisonResult iohidmanager_sort_elements(const void *val1, const void *val2
uint32_t cookie2 = (uint32_t)IOHIDElementGetCookie((IOHIDElementRef)val2);
if (page1 != page2)
return page1 > page2;
return (enum CFComparisonResult)(page1 > page2);
if(use1 != use2)
return use1 > use2;
return (enum CFComparisonResult)(use1 > use2);
return cookie1 > cookie2;
return (enum CFComparisonResult)(cookie1 > cookie2);
}
static bool iohidmanager_check_for_id(apple_input_rec_t *rec, uint32_t id)
@ -86,12 +86,12 @@ static bool iohidmanager_check_for_id(apple_input_rec_t *rec, uint32_t id)
return false;
}
static void iohidmanager_append_record(apple_input_rec_t *rec, apple_input_rec_t *new)
static void iohidmanager_append_record(apple_input_rec_t *rec, apple_input_rec_t *b)
{
apple_input_rec_t *tmp = rec;
while(tmp->next)
tmp = tmp->next;
tmp->next = new;
tmp->next = b;
}
static bool iohidmanager_hid_joypad_query(void *data, unsigned pad)
@ -468,8 +468,13 @@ static void iohidmanager_hid_device_add(void *data, IOReturn result,
int i;
IOReturn ret;
uint16_t dev_vid, dev_pid;
CFArrayRef elements_raw;
int count;
CFMutableArrayRef elements;
CFRange range;
bool found_axis[6] =
{ false, false, false, false, false, false };
apple_input_rec_t *tmp = NULL;
apple_input_rec_t *tmpButtons = NULL;
apple_input_rec_t *tmpAxes = NULL;
iohidmanager_hid_t *hid = (iohidmanager_hid_t*)
@ -522,11 +527,14 @@ static void iohidmanager_hid_device_add(void *data, IOReturn result,
goto error;
/* scan for buttons, axis, hats */
CFArrayRef elements_raw = IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
int count = (int)CFArrayGetCount(elements_raw);
CFMutableArrayRef elements = CFArrayCreateMutableCopy(kCFAllocatorDefault,(CFIndex)count,elements_raw);
CFRange range = CFRangeMake(0,count);
CFArraySortValues(elements,range,iohidmanager_sort_elements,NULL);
elements_raw = IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
count = (int)CFArrayGetCount(elements_raw);
elements = CFArrayCreateMutableCopy(
kCFAllocatorDefault,(CFIndex)count,elements_raw);
range = CFRangeMake(0,count);
CFArraySortValues(elements,
range, iohidmanager_sort_elements, NULL);
for(i=0; i<count; i++)
{
@ -658,11 +666,9 @@ static void iohidmanager_hid_device_add(void *data, IOReturn result,
}
}
apple_input_rec_t *tmp = adapter->buttons;
tmp = adapter->buttons;
while(tmp->next)
{
tmp = tmp->next;
}
while(tmpButtons)
{