MacOS: FREAD rename to magicFREAD due to sys/fcntl.h definition

Example build issue using MacOS 12 (Xcode 14.2 from MacOSX.platform).

In file included from grTk1.c:23:
In file included from ../utils/main.h:26:
In file included from ../windows/windows.h:26:
../utils/magic.h:143:13: warning: 'FREAD' macro redefined [-Wmacro-redefined]
    #define FREAD(a,b,c,d)    gzread(d,a,b*c)
            ^
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/fcntl.h:110:9: note: previous definition is here
 #define FREAD           0x00000001
This commit is contained in:
Darryl L. Miles 2024-10-08 08:01:17 +01:00 committed by Tim Edwards
parent 48f8707753
commit bfc82e43db
3 changed files with 6 additions and 6 deletions

View File

@ -389,7 +389,7 @@ calmaReadStringRecord(
nbytes -= CALMAHEADERLENGTH;
*str = (char *) mallocMagic(nbytes + 1);
if (FREAD(*str, sizeof (char), nbytes, calmaInputFile) != nbytes)
if (magicFREAD(*str, sizeof (char), nbytes, calmaInputFile) != nbytes)
goto eof;
*(*str + nbytes) = '\0';
@ -428,7 +428,7 @@ calmaReadR8(
double mantissa, d;
bool isneg;
if (FREAD((char *) dchars, sizeof (char), sizeof dchars,
if (magicFREAD((char *) dchars, sizeof (char), sizeof dchars,
calmaInputFile) != sizeof dchars)
return (FALSE);

View File

@ -1091,7 +1091,7 @@ calmaProcessDef(
/* Read the structure name and check against the CellDef name */
defsize = (size_t)(cellstart - structstart);
buffer = (char *)mallocMagic(defsize + 1);
numbytes = FREAD(buffer, sizeof(char), (size_t)defsize, fi);
numbytes = magicFREAD(buffer, sizeof(char), (size_t)defsize, fi);
if (numbytes == defsize)
{
buffer[defsize] = '\0';
@ -1131,7 +1131,7 @@ calmaProcessDef(
defsize = (size_t)(cellend - cellstart);
buffer = (char *)mallocMagic(defsize);
numbytes = FREAD(buffer, sizeof(char), (size_t)defsize, fi);
numbytes = magicFREAD(buffer, sizeof(char), (size_t)defsize, fi);
if (numbytes == defsize)
{

View File

@ -146,7 +146,7 @@ extern char AbortMessage[];
#define FOPEN gzopen
#define FCLOSE gzclose
#define FGETC gzgetc
#define FREAD(a,b,c,d) gzread(d,a,b*c)
#define magicFREAD(a,b,c,d) gzread(d,a,b*c)
#define FEOF gzeof
#define FSEEK gzseek
#define FTELL gztell
@ -157,7 +157,7 @@ extern char AbortMessage[];
#define FOPEN fopen
#define FCLOSE fclose
#define FGETC getc
#define FREAD fread
#define magicFREAD fread
#define FEOF feof
#define FSEEK fseek
#define FTELL ftello