Skip to content

Commit

Permalink
libschrift: Fix compile issue
Browse files Browse the repository at this point in the history
Apply fix provided in issue #29 on GitHub:

[guard unix-y implementation
details](tomolt/libschrift#29)
  • Loading branch information
MaxGyver83 committed Jan 10, 2025
1 parent 66decef commit d71389e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/src/main/jni/lib/schrift.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
# define WIN32_LEAN_AND_MEAN 1
# include <windows.h>
#else
# define _POSIX_C_SOURCE 1
# ifndef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 1
# endif
# include <fcntl.h>
# include <sys/mman.h>
# include <sys/stat.h>
Expand Down Expand Up @@ -125,7 +127,9 @@ struct SFT_Font

/* function declarations */
/* generic utility functions */
#ifndef __USE_MISC
static void *reallocarray(void *optr, size_t nmemb, size_t size);
#endif
static inline int fast_floor(double x);
static inline int fast_ceil (double x);
/* file loading */
Expand Down Expand Up @@ -406,6 +410,7 @@ sft_render(const SFT *sft, SFT_Glyph glyph, SFT_Image image)
* if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW */
#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))

#ifndef __USE_MISC
/* OpenBSD's reallocarray() standard libary function.
* A wrapper for realloc() that takes two size args like calloc().
* Useful because it eliminates common integer overflow bugs. */
Expand All @@ -419,6 +424,7 @@ reallocarray(void *optr, size_t nmemb, size_t size)
}
return realloc(optr, size * nmemb);
}
#endif

/* TODO maybe we should use long here instead of int. */
static inline int
Expand Down

0 comments on commit d71389e

Please sign in to comment.