Project

General

Profile

Bug #1702

endian.h doesn't define htonl/ntohl

Added by Andrew Twyman over 2 years ago. Updated over 2 years ago.

Status:
Open
Priority:
High
Category:
libcrystax
Target version:
Start date:
02/16/2017
Due date:
% Done:

0%

Estimated time:
CPU Architecture:
arm, x86
Host OS:
OS X
Toolchain:
gcc-4.9
Android version:
4.1 (android-16)
CrystaX Version:

Description

For context: I'm giving the CrystaX NDK a try on our cross-platform C++ code at Dropbox, previously built with NDK r11c, GCC 4.9, with GNU STL. I'm not sure if all of the issues I ran into will be considered bugs, but since your stated goal is to be a drop-in replacement I thought it worth sharing them as differences which an adopter has to deal with. We run with -Werror so any warnings will block our build.

The CrystaX version of endian.h doesn't define htonl() and friends, which we'd been making use of on Android. Using endian.h for this is non-standard, so may not be something you want to support, but it has worked on both Android and iOS in the past. The reason we make use of this rather than using arpa/inet.h is that other contents of that header trigger warnings if compiled with strict warnings. Specifically, socket.h triggers -Wcast-align. We've worked around this for files which only need ntohl() and htonl() by usingendian.h`.

I've worked around this by providing my own definitions using bswap32(), since the Android architectures we care about all have the same endianness anyway.

History

#1 Updated by Dmitry Moskalchuk over 2 years ago

  • Category set to libcrystax
  • Assignee set to Dmitry Moskalchuk
  • Priority changed from Normal to High

Also available in: Atom PDF