summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-01-23 16:51:56 +0100
committerHaru <haru@dotalux.com>2014-01-23 17:14:09 +0100
commite68d860dbaa6b1bcf8104463cd3001ae946b7d4e (patch)
tree38f6757fbc2d4ad34e89b3d48d5ed221a3125147 /src
parent22b7f90297184775ad94d8cb4806e8664c78d934 (diff)
downloadhercules-e68d860dbaa6b1bcf8104463cd3001ae946b7d4e.tar.gz
hercules-e68d860dbaa6b1bcf8104463cd3001ae946b7d4e.tar.bz2
hercules-e68d860dbaa6b1bcf8104463cd3001ae946b7d4e.tar.xz
hercules-e68d860dbaa6b1bcf8104463cd3001ae946b7d4e.zip
Compatibility fixes for NetBSD and Solaris
- Fixed some warnings in NetBSD (5.x and 6.x) and Solaris (11) Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r--src/common/cbasetypes.h5
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/npc.c4
-rw-r--r--src/map/packets_struct.h4
4 files changed, 15 insertions, 2 deletions
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h
index 120f4f861..977897506 100644
--- a/src/common/cbasetypes.h
+++ b/src/common/cbasetypes.h
@@ -42,6 +42,11 @@
#define __DARWIN__
#endif
+// Necessary for __NetBSD_Version__ (defined as VVRR00PP00) on NetBSD
+#ifdef __NETBSD__
+#include <sys/param.h>
+#endif // __NETBSD__
+
// 64bit OS
#if defined(_M_IA64) || defined(_M_X64) || defined(_WIN64) || defined(_LP64) || defined(_ILP64) || defined(__LP64__) || defined(__ppc64__)
#define __64BIT__
diff --git a/src/map/clif.c b/src/map/clif.c
index 5f835a8ab..fe3e7cfe9 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -12959,14 +12959,18 @@ bool clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) {
BITMAP_WIDTH = 24,
BITMAP_HEIGHT = 24,
};
+#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(push, 1)
+#endif // not NetBSD < 6 / Solaris
struct s_bitmaptripple {
//uint8 b;
//uint8 g;
//uint8 r;
unsigned int rgb:24;
} __attribute__((packed));
+#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(pop)
+#endif // not NetBSD < 6 / Solaris
uint8 buf[1800]; // no well-formed emblem bitmap is larger than 1782 (24 bit) / 1654 (8 bit) bytes
unsigned long buf_len = sizeof(buf);
int header = 0, bitmap = 0, offbits = 0, palettesize = 0, i = 0;
diff --git a/src/map/npc.c b/src/map/npc.c
index 722e5199c..458fc52ed 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2432,7 +2432,7 @@ int npc_parseview(const char* w4, const char* start, const char* buffer, const c
// Extract view ID / constant
while (w4[i] != '\0') {
- if (isspace(w4[i]) || w4[i] == '/' || w4[i] == ',')
+ if (ISSPACE(w4[i]) || w4[i] == '/' || w4[i] == ',')
break;
i++;
@@ -2464,7 +2464,7 @@ bool npc_viewisid(const char * viewid)
{
// Loop through view, looking for non-numeric character.
while (*viewid) {
- if (isdigit(*viewid++) == 0) return false;
+ if (ISDIGIT(*viewid++) == 0) return false;
}
}
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 8f0989f3d..1156f4465 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -205,7 +205,9 @@ enum packet_headers {
npcmarketopenType = 0x9d5,
};
+#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(push, 1)
+#endif // not NetBSD < 6 / Solaris
/**
* structs for data
@@ -939,6 +941,8 @@ struct packet_npc_market_open {
} list[1000];/* TODO: whats the actual max of this? */
} __attribute__((packed));
+#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(pop)
+#endif // not NetBSD < 6 / Solaris
#endif /* _PACKETS_STRUCT_H_ */