Skip to content

Commit

Permalink
fix RFONT_UNUSED, added typedefs for msvc
Browse files Browse the repository at this point in the history
  • Loading branch information
ColleagueRiley committed Jul 4, 2024
1 parent 957027c commit b539e39
Showing 1 changed file with 28 additions and 15 deletions.
43 changes: 28 additions & 15 deletions RFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,32 @@ int main () {
#include <string.h>

#if !defined(u8)
#include <stdint.h>

typedef uint8_t u8;
typedef int8_t i8;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint64_t u64;
typedef int64_t i64;
typedef u8 b8;
#if defined(_MSC_VER) || defined(__SYMBIAN32__)
typedef unsigned char u8;
typedef signed char i8;
typedef unsigned short u16;
typedef signed short i16;
typedef unsigned int u32;
typedef signed int i32;
typedef unsigned long u64;
typedef signed long i64;
#else
#include <stdint.h>

typedef uint8_t u8;
typedef int8_t i8;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint64_t u64;
typedef int64_t i64;
#endif
#endif

#ifndef RFONT_UNUSED
#define RFONT_UNUSED(x) if (x){}
#if !defined(b8)
typedef u8 b8;
#endif

/*
You can define these yourself if
you want to change anything
Expand Down Expand Up @@ -136,6 +145,10 @@ you want to change anything
#define RFONT_VSNPRINTF vsnprintf
#endif

#ifndef RFONT_UNUSED
#define RFONT_UNUSED(x) (void) (x);
#endif

/* make sure RFont declares aren't declared twice */
#ifndef RFONT_H
#define RFONT_H
Expand Down Expand Up @@ -465,7 +478,7 @@ RFont_font* RFont_font_init(const char* font_name) {
char* ttf_buffer = (char*)malloc(sizeof(char) * size);
fseek(ttf_file, 0U, SEEK_SET);

RFONT_UNUSED( fread(ttf_buffer, 1, size, ttf_file) )
RFONT_UNUSED(fread(ttf_buffer, 1, size, ttf_file))


return RFont_font_init_data((u8*)ttf_buffer, 1);
Expand Down

0 comments on commit b539e39

Please sign in to comment.