diff options
author | inmarket <andrewh@inmarket.com.au> | 2013-07-29 16:25:20 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2013-07-29 16:25:20 +1000 |
commit | 12085b8014234b10739d5cf22ed6c6d055ce8741 (patch) | |
tree | 97cdf7ab1afe7ab6c8db761154618e779761fdb9 /src/gdisp/mcufont | |
parent | 3ac4e9e789b7f0d5a9d18f9073a09d4e7a4fd3f0 (diff) | |
download | uGFX-12085b8014234b10739d5cf22ed6c6d055ce8741.tar.gz uGFX-12085b8014234b10739d5cf22ed6c6d055ce8741.tar.bz2 uGFX-12085b8014234b10739d5cf22ed6c6d055ce8741.zip |
Fix compiler warnings, operating system dependancies, and non-portable code.
Diffstat (limited to 'src/gdisp/mcufont')
-rw-r--r-- | src/gdisp/mcufont/mf_config.h | 3 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_encoding.c | 10 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_encoding.h | 10 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_font.h | 4 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_justify.c | 3 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_kerning.h | 6 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_rlefont.c | 1 | ||||
-rw-r--r-- | src/gdisp/mcufont/mf_wordwrap.c | 1 |
8 files changed, 22 insertions, 16 deletions
diff --git a/src/gdisp/mcufont/mf_config.h b/src/gdisp/mcufont/mf_config.h index f9210123..4614fb0c 100644 --- a/src/gdisp/mcufont/mf_config.h +++ b/src/gdisp/mcufont/mf_config.h @@ -12,6 +12,9 @@ #include <gfx.h> +/* Prevent double definitions of standard int types */ +#define MF_NO_STDINT_H + /* Mapping from uGFX settings to mcufont settings */ #if GDISP_NEED_UTF8 #define MF_ENCODING MF_ENCODING_UTF8 diff --git a/src/gdisp/mcufont/mf_encoding.c b/src/gdisp/mcufont/mf_encoding.c index f736651b..2c8abf3a 100644 --- a/src/gdisp/mcufont/mf_encoding.c +++ b/src/gdisp/mcufont/mf_encoding.c @@ -73,4 +73,14 @@ void mf_rewind(mf_str *str) (*str)--; } +#else + +mf_char mf_getchar(mf_str *str) { + return *(*str)++; +} + +void mf_rewind(mf_str *str) { + (*str)--; +} + #endif diff --git a/src/gdisp/mcufont/mf_encoding.h b/src/gdisp/mcufont/mf_encoding.h index d2673d16..d8b7b70e 100644 --- a/src/gdisp/mcufont/mf_encoding.h +++ b/src/gdisp/mcufont/mf_encoding.h @@ -13,7 +13,9 @@ #define _MF_ENCODING_H_ #include "mf_config.h" +#ifndef MF_NO_STDINT_H #include <stdint.h> +#endif /* Type used to represent characters internally. */ #if MF_ENCODING == MF_ENCODING_ASCII @@ -42,19 +44,11 @@ typedef const wchar_t * mf_str; * * Returns: The next character, as unicode codepoint. */ -#if MF_ENCODING == MF_ENCODING_UTF8 MF_EXTERN mf_char mf_getchar(mf_str *str); -#else -static mf_char mf_getchar(mf_str *str) { return *(*str)++; } -#endif /* Moves back the pointer to the beginning of the previous character. * Be careful not to go beyond the start of the string. */ -#if MF_ENCODING == MF_ENCODING_UTF8 MF_EXTERN void mf_rewind(mf_str *str); -#else -static void mf_rewind(mf_str *str) { (*str)--; } -#endif #endif diff --git a/src/gdisp/mcufont/mf_font.h b/src/gdisp/mcufont/mf_font.h index 0e5612ce..1166fa3b 100644 --- a/src/gdisp/mcufont/mf_font.h +++ b/src/gdisp/mcufont/mf_font.h @@ -120,6 +120,6 @@ MF_EXTERN uint8_t mf_character_width(const struct mf_font_s *font, MF_EXTERN const struct mf_font_s *mf_find_font(const char *name); /* Get the list of included fonts */ -MF_EXTERN const struct mf_font_list_s *mf_get_font_list(); +MF_EXTERN const struct mf_font_list_s *mf_get_font_list(void); -#endif
\ No newline at end of file +#endif diff --git a/src/gdisp/mcufont/mf_justify.c b/src/gdisp/mcufont/mf_justify.c index 072eef0c..488478ef 100644 --- a/src/gdisp/mcufont/mf_justify.c +++ b/src/gdisp/mcufont/mf_justify.c @@ -82,7 +82,7 @@ static uint16_t strip_spaces(mf_str text, uint16_t count, mf_char *last_char) { i++; tmp = mf_getchar(&text); - if (tmp != ' ' && tmp != 0xA0 && tmp != '\n' && + if (tmp != ' ' && tmp != (mf_char)0xA0 && tmp != '\n' && tmp != '\r' && tmp != '\t') { result = i; @@ -234,6 +234,7 @@ void mf_render_justified(const struct mf_font_s *font, mf_character_callback_t callback, void *state) { + (void) width; mf_render_aligned(font, x0, y0, MF_ALIGN_LEFT, text, count, callback, state); } diff --git a/src/gdisp/mcufont/mf_kerning.h b/src/gdisp/mcufont/mf_kerning.h index 1014c8dd..043265c7 100644 --- a/src/gdisp/mcufont/mf_kerning.h +++ b/src/gdisp/mcufont/mf_kerning.h @@ -28,9 +28,7 @@ MF_EXTERN int8_t mf_compute_kerning(const struct mf_font_s *font, mf_char c1, mf_char c2); #else -static int8_t mf_compute_kerning(const struct mf_font_s *font, - mf_char c1, mf_char c2) -{ return 0; } +#define mf_compute_kerning(font, c1, c2) 0 #endif -#endif
\ No newline at end of file +#endif diff --git a/src/gdisp/mcufont/mf_rlefont.c b/src/gdisp/mcufont/mf_rlefont.c index ec0025dd..ca628674 100644 --- a/src/gdisp/mcufont/mf_rlefont.c +++ b/src/gdisp/mcufont/mf_rlefont.c @@ -160,6 +160,7 @@ static void write_bin_codeword(const struct mf_rlefont_s *font, uint8_t bitcount = fillentry_bitcount(code); uint8_t byte = code - DICT_START7BIT; uint8_t runlen = 0; + (void) font; while (bitcount--) { diff --git a/src/gdisp/mcufont/mf_wordwrap.c b/src/gdisp/mcufont/mf_wordwrap.c index 4650c24a..ebf3a537 100644 --- a/src/gdisp/mcufont/mf_wordwrap.c +++ b/src/gdisp/mcufont/mf_wordwrap.c @@ -227,7 +227,6 @@ void mf_wordwrap(const struct mf_font_s *font, int16_t width, void mf_wordwrap(const struct mf_font_s *font, int16_t width, mf_str text, mf_line_callback_t callback, void *state) { - mf_str orig = text; mf_str linestart; /* Current line width and character count */ |