Classic Mac OS: fix socklen_t, curl_off_t, long long#10049
Classic Mac OS: fix socklen_t, curl_off_t, long long#10049ryandesign wants to merge 6 commits intocurl:masterfrom
Conversation
Maybe we should stop using |
|
FWIW, Haiku defines socklen_t as uint32_t in sys/socket.h |
Change "__MWERKS__" to "macintosh". When this block was originally added in 3ac6929 it was probably intended to handle classic Mac OS since the previous classic Mac OS build procedure for curl (which was removed in bf327a9) used Metrowerks CodeWarrior. But there are other classic Mac OS compilers, such as the MPW compilers, that were not handled by this case. For classic Mac OS, CURL_TYPEOF_CURL_SOCKLEN_T needs to match what's provided by the third-party GUSI library, which does not vary by compiler. Meanwhile CodeWarrior works on platforms other than classic Mac OS, and they may need different definitions. Separate blocks could be added later for any of those platforms that curl doesn't already support.
Change CURL_TYPEOF_CURL_SOCKLEN_T from "int" to "unsigned int" when "macintosh" is defined. This fixes a build failure when compiling for classic Mac OS with GUSI.
Not all classic Mac OS compilers support the "long long" data type. Include the <ConditionalMacros.h> system header which defines "TYPE_LONGLONG" to 0 or 1 to indicate whether the current version of the current compiler supports "long long" and define the curl_off_t type / format / suffix based on that.
Not all classic Mac OS compilers support the "long long" data type. Include the <ConditionalMacros.h> system header which defines "TYPE_LONGLONG" to 0 or 1 to indicate whether the current version of the current compiler supports "long long" and define HAVE_LONGLONG if so.
Define SIZEOF_CURL_OFF_T to 4 or 8 for classic Mac OS depending on whether the compiler supports "long long".
Perhaps so. Several of the other top-level conditions in that file are already about operating systems (e.g.
Probably. I've rewritten the PR for this. I've divided it into a few hopefully sensibly distinct changes. |
|
Is SIZEOF_LONG defined for you? I don't see it in config-mac and there are a few places in the library where it's evaluated lib/mprintf.c:#if (SIZEOF_CURL_OFF_T > SIZEOF_LONG) |
|
Good point! I've added a commit to define |
|
Thanks! |
Change
CURL_TYPEOF_CURL_SOCKLEN_Tfrominttounsigned intwhen__MWERKS__is defined (i.e. Metrowerks compilers i.e. CodeWarrior).This fixes a build failure when compiling for classic Mac OS with GUSI with CodeWarrior compilers.
The error was:
It's unclear to me what system was envisioned when the
__MWERKS__block was originally added in 2008 in 3ac6929. Metrowerks CodeWarrior was originally a classic Mac OS compiler in the 90s but, later, versions for BeOS, Windows, and Mac OS X existed, and it could cross-compile code for other systems as well. The Metrowerks company no longer exists today but CodeWarrior still does and is now used for embedded systems. I'm not certain that all of the systems CodeWarrior supports or supported will have the same values for the constants being defined here.For example, POSIX says
socklen_tshould be unsigned.socklen_tin version 2. It is unsigned in the earliest version still posted on the site (2.1.3 from 2000) and in the last version (2.2.3 from 2002).socklen_tin version 10.3 (2003) and it was signed. By Mac OS X 10.4 (2005) it was unsigned.socklen_tat least for a time according to a quick Internet search. Don't know what Haiku (the reimplementation of BeOS) does.I'm not sure how these potential differences should be handled here.