Issue information

Issue ID
#7
Status
Fixed
Severity
Critical
Started
Hercules Elf Bot
Sep 3, 2007 10:14
Last Post
Hercules Elf Bot
Mar 15, 2012 13:07
Confirmation
N/A

Hercules Elf Bot - Sep 3, 2007 10:14

Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=7

Short summary:
EAPP latest will only compile on Visual Studio. On freebsd and mingw at least, the compilation will fail due to a missing 'strnlen' implementation.

Details:
The Single UNIX Specification doesn't specify 'strnlen'. I hear it's a GNU extension (plus microsoft added it lately).
For example, mingw and freebsd don't implement it (although it can be implemented as a two-liner that utilizes one standard function).

Anyways - I implemented it like this:
CODE
#if !(defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1400) // for older VS and non-windows systems

In eapp, it was implemented like this:
CODE
#if defined(_MSC_VER) && _MSC_VER < 1400 // for older VS

Both are somewhat wrong. Mine will cause a collision on linux, eapp's will only compile on windows and systems that actually implement strnlen.

I noticed that the configure script already checks for strnlen. So either adding it to the condition, or doing
CODE
#if defined(_MSC_VER) && _MSC_VER >= 1400
#define HAVE_STRNLEN
#endif
...
#ifdef HAVE_STRNLEN
<strnlen code>
#endif
should do the trick...

This post has been edited by theultramage: Sep 3 2007, 03:37 AM