Bug 1656285 - libmar: Avoid clobbering ftello() and fseeko() declarations in MinGW's stdio.h. r=mhowell

Include stdio.h before redefining ftello and fseeko to avoid clobbering the ftello() and fseeko() function declarations in MinGW's stdio.h.

I don't know why my change to compile libmar as C11 (bug 1653182) caused this ftello/fseeko problem. From my inspection of MinGW's stdio.h, this problem should have already been happening!

Differential Revision: https://phabricator.services.mozilla.com/D85665
This commit is contained in:
Chris Peterson 2020-08-03 16:05:49 +00:00
parent cd60e96aec
commit 6df09f9c4c

View File

@ -54,6 +54,9 @@ static_assert(sizeof(BLOCKSIZE) < (SIGNATURE_BLOCK_OFFSET + sizeof(uint32_t)),
instead of the NSPR equivalents. */
#ifdef XP_WIN
# include <winsock2.h>
/* Include stdio.h before redefining ftello and fseeko to avoid clobbering
* the ftello() and fseeko() function declarations in MinGW's stdio.h. */
# include <stdio.h>
# ifdef __MINGW32__
/* Avoid MinGW's _ftelli64() and _fseeki64() implementations because they
* are unreliable. */
@ -67,10 +70,9 @@ static_assert(sizeof(BLOCKSIZE) < (SIGNATURE_BLOCK_OFFSET + sizeof(uint32_t)),
# define _FILE_OFFSET_BITS 64
# include <netinet/in.h>
# include <unistd.h>
# include <stdio.h>
#endif
#include <stdio.h>
#define HOST_TO_NETWORK64(x) \
(((((uint64_t)x) & 0xFF) << 56) | ((((uint64_t)x) >> 8) & 0xFF) << 48) | \
(((((uint64_t)x) >> 16) & 0xFF) << 40) | \