Better clang compatibility

This commit is contained in:
UnknownShadow200 2024-08-17 15:19:10 +10:00
parent 0e13440f1d
commit 7fc0906751
4 changed files with 18 additions and 26 deletions

View file

@ -4,9 +4,15 @@ C_SOURCES = $(wildcard $(SOURCE_DIR)/*.c)
C_OBJECTS = $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
OBJECTS = $(C_OBJECTS)
ENAME = ClassiCube
CFLAGS = -pipe -fno-math-errno -Werror -Wno-error=missing-braces -Wno-error=strict-aliasing -Wno-error=maybe-uninitialized
# Flags passed to the C compiler
CFLAGS = -pipe -fno-math-errno -Werror -Wno-error=missing-braces -Wno-error=strict-aliasing
# Flags passed to the linker
LDFLAGS = -g -rdynamic
# Name of the main executable
ENAME = ClassiCube
# Name of the final target file
# (usually this is the executable, but e.g. is app bundle on macOS)
TARGET := $(ENAME)
ifndef RM
# No prefined RM variable, try to guess OS default

View file

@ -7,7 +7,7 @@ TARGET := ClassiCube-n64
CFILES := $(notdir $(wildcard src/*.c))
OFILES := $(CFILES:.c=.o)
OBJS := $(addprefix $(BUILD_DIR)/,$(OFILES))
CFLAGS := -Wno-error=missing-braces -Wno-error=strict-aliasing -Wno-error=incompatible-pointer-types -Wno-error=maybe-uninitialized
CFLAGS := -Wno-error=missing-braces -Wno-error=strict-aliasing -Wno-error=incompatible-pointer-types
default: $(TARGET).z64

View file

@ -643,6 +643,10 @@ void Inflate_Process(struct InflateState* s) {
repeatCount = Inflate_ReadBits(s, 7);
repeatCount += 11; repeatValue = 0;
break;
default:
Inflate_Fail(s, INF_ERR_REPEAT_END);
return;
}
count = s->NumLits + s->NumDists;

View file

@ -176,7 +176,6 @@
parse_fond( char* fond_data,
short* have_sfnt,
ResID* sfnt_id,
Str255 lwfn_file_name,
short face_index )
{
AsscEntry* assoc;
@ -184,9 +183,8 @@
FamRec* fond;
*sfnt_id = 0;
*have_sfnt = 0;
lwfn_file_name[0] = 0;
*sfnt_id = 0;
*have_sfnt = 0;
fond = (FamRec*)fond_data;
assoc = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );
@ -217,21 +215,6 @@
}
static short
count_faces( Handle fond,
const UInt8* pathname )
{
ResID sfnt_id;
short have_sfnt;
Str255 lwfn_file_name;
have_sfnt = 0;
parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, 0 );
return count_faces_scalable( *fond );
}
/* Create a new FT_Face from an SFNT resource, specified by res ID. */
static FT_Error
FT_New_Face_From_SFNT( FT_Library library,
@ -335,7 +318,7 @@
if ( ResError() )
break;
num_faces_in_fond = count_faces( fond, pathname );
num_faces_in_fond = count_faces_scalable( *fond );
num_faces_in_res += num_faces_in_fond;
if ( 0 <= face_index && face_index < num_faces_in_fond && error )
@ -363,7 +346,6 @@
ResID sfnt_id, fond_id;
OSType fond_type;
Str255 fond_name;
Str255 lwfn_file_name;
/* check of `library' and `aface' delayed to `FT_New_Face_From_XXX' */
@ -372,7 +354,7 @@
if ( ResError() != noErr || fond_type != TTAG_FOND )
return FT_THROW( Invalid_File_Format );
parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index );
parse_fond( *fond, &have_sfnt, &sfnt_id, face_index );
return FT_New_Face_From_SFNT( library,
sfnt_id,
@ -407,7 +389,7 @@
*aface = NULL;
error = FT_New_Face_From_Suitcase( library, args->pathname, face_index, aface );
error = FT_New_Face_From_Suitcase( library, (const UInt8*)args->pathname, face_index, aface );
if ( *aface )
return FT_Err_Ok;