/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
#endif
*/
+/* Determine endiannes */
+static inline bool bigendian() { return htonl(1) == 1L; }
+
#endif /* _BACONFIG_H */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
void byteReverse(unsigned char *buf, unsigned longs)
{
uint32_t t;
- if (htonl(1) == 1L) {
+ if (bigendian()) {
do {
t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]);
void serial_int64(uint8_t * * const ptr, const int64_t v)
{
- if (htonl(1) == 1L) {
+ if (bigendian()) {
memcpy(*ptr, &v, sizeof(int64_t));
} else {
int i;
void serial_uint64(uint8_t * * const ptr, const uint64_t v)
{
- if (htonl(1) == 1L) {
+ if (bigendian()) {
memcpy(*ptr, &v, sizeof(uint64_t));
} else {
int i;
void serial_btime(uint8_t * * const ptr, const btime_t v)
{
- if (htonl(1) == 1L) {
+ if (bigendian()) {
memcpy(*ptr, &v, sizeof(btime_t));
} else {
int i;
void serial_float64(uint8_t * * const ptr, const float64_t v)
{
- if (htonl(1) == 1L) {
+ if (bigendian()) {
memcpy(*ptr, &v, sizeof(float64_t));
} else {
int i;
{
uint64_t v;
- if (htonl(1) == 1L) {
+ if (bigendian()) {
memcpy(&v, *ptr, sizeof(uint64_t));
} else {
int i;
{
btime_t v;
- if (htonl(1) == 1L) {
+ if (bigendian()) {
memcpy(&v, *ptr, sizeof(btime_t));
} else {
int i;
{
float64_t v;
- if (htonl(1) == 1L) {
+ if (bigendian()) {
memcpy(&v, *ptr, sizeof(float64_t));
} else {
int i;