Minor tweaks to fix the build after the last commit.

* firewire and freebsd_network expect the macros come from
   sys/param.h, as this is one of the places FreeBSD defines them
 * All others are Haiku-native and can use Be-style macros.
This commit is contained in:
Augustin Cavalier 2019-03-26 19:50:13 -04:00
parent 9cb15d72bd
commit fb52ab82d2
6 changed files with 70 additions and 54 deletions

View File

@ -458,6 +458,13 @@ struct fw_crom_buf {
#define FWMAXNDMA 0x100 /* 8 bits DMA channel id. in device No. */
#ifndef htonl
# define htonl(x) B_HOST_TO_BENDIAN_INT32(x)
# define ntohl(x) B_BENDIAN_TO_HOST_INT32(x)
# define htons(x) B_HOST_TO_BENDIAN_INT16(x)
# define ntohs(x) B_BENDIAN_TO_HOST_INT16(x)
#endif
#ifndef __HAIKU__
#if defined(__DragonFly__) || __FreeBSD_version < 500000
#define dev2unit(x) ((minor(x) & 0xff) | (minor(x) >> 8))

View File

@ -1195,8 +1195,9 @@ usb_disk_update_capacity(device_lun *lun)
lun->media_present = true;
lun->media_changed = false;
lun->block_size = ntohl(parameter.logical_block_length);
lun->block_count = ntohl(parameter.last_logical_block_address) + 1;
lun->block_size = B_BENDIAN_TO_HOST_INT32(parameter.logical_block_length);
lun->block_count =
B_BENDIAN_TO_HOST_INT32(parameter.last_logical_block_address) + 1;
return B_OK;
}

View File

@ -189,7 +189,7 @@ aue_read_eeprom(pegasus_dev *sc, caddr_t dest, int off, int cnt, int swap)
aue_eeprom_getword(sc, off + i, &word);
ptr = (u_int16_t *)(dest + (i * 2));
if (swap)
*ptr = ntohs(word);
*ptr = B_BENDIAN_TO_HOST_INT16(word);
else
*ptr = word;
}

View File

@ -359,7 +359,7 @@ wb_read_eeprom(wb_device *device, void* dest,
wb_eeprom_getword(device, offset + i, &word);
ptr = (uint16 *)((uint8 *)dest + (i * 2));
if (swap)
*ptr = ntohs(word);
*ptr = B_BENDIAN_TO_HOST_INT16(word);
else
*ptr = word;
}

View File

@ -19,7 +19,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
//#define TRACE(x) printf x
@ -2022,7 +2021,7 @@ DCRaw::_ConvertToRGB()
}
}
for (i = 0; i < phead[0]/4; i++) {
fOutputProfile[i] = htonl(fOutputProfile[i]);
fOutputProfile[i] = B_HOST_TO_BENDIAN_INT32(fOutputProfile[i]);
}
strcpy((char *)fOutputProfile + pbody[2] + 8,
"auto-generated by dcraw");

View File

@ -8,6 +8,7 @@
#include <posix/sys/param.h>
#include <ByteOrder.h>
#include <sys/types.h>
#include <sys/cdefs.h>
@ -94,4 +95,12 @@
#define isclr(a,i) \
((((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
/* byteswap macros */
#ifndef htonl
# define htonl(x) B_HOST_TO_BENDIAN_INT32(x)
# define ntohl(x) B_BENDIAN_TO_HOST_INT32(x)
# define htons(x) B_HOST_TO_BENDIAN_INT16(x)
# define ntohs(x) B_BENDIAN_TO_HOST_INT16(x)
#endif
#endif /* _FBSD_COMPAT_SYS_PARAM_H_ */