Fix compiler warnings, operating system dependancies, and non-portable code.
This commit is contained in:
parent
3ac4e9e789
commit
12085b8014
9 changed files with 22 additions and 17 deletions
|
@ -50,7 +50,6 @@ static bool_t matchfont(const char *pattern, const char *name) {
|
||||||
|
|
||||||
font_t gdispOpenFont(const char *name) {
|
font_t gdispOpenFont(const char *name) {
|
||||||
const struct mf_font_list_s *fp;
|
const struct mf_font_list_s *fp;
|
||||||
int i;
|
|
||||||
|
|
||||||
fp = mf_get_font_list();
|
fp = mf_get_font_list();
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
|
|
||||||
#include <gfx.h>
|
#include <gfx.h>
|
||||||
|
|
||||||
|
/* Prevent double definitions of standard int types */
|
||||||
|
#define MF_NO_STDINT_H
|
||||||
|
|
||||||
/* Mapping from uGFX settings to mcufont settings */
|
/* Mapping from uGFX settings to mcufont settings */
|
||||||
#if GDISP_NEED_UTF8
|
#if GDISP_NEED_UTF8
|
||||||
#define MF_ENCODING MF_ENCODING_UTF8
|
#define MF_ENCODING MF_ENCODING_UTF8
|
||||||
|
|
|
@ -73,4 +73,14 @@ void mf_rewind(mf_str *str)
|
||||||
(*str)--;
|
(*str)--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
mf_char mf_getchar(mf_str *str) {
|
||||||
|
return *(*str)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mf_rewind(mf_str *str) {
|
||||||
|
(*str)--;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
#define _MF_ENCODING_H_
|
#define _MF_ENCODING_H_
|
||||||
|
|
||||||
#include "mf_config.h"
|
#include "mf_config.h"
|
||||||
|
#ifndef MF_NO_STDINT_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Type used to represent characters internally. */
|
/* Type used to represent characters internally. */
|
||||||
#if MF_ENCODING == MF_ENCODING_ASCII
|
#if MF_ENCODING == MF_ENCODING_ASCII
|
||||||
|
@ -42,19 +44,11 @@ typedef const wchar_t * mf_str;
|
||||||
*
|
*
|
||||||
* Returns: The next character, as unicode codepoint.
|
* Returns: The next character, as unicode codepoint.
|
||||||
*/
|
*/
|
||||||
#if MF_ENCODING == MF_ENCODING_UTF8
|
|
||||||
MF_EXTERN mf_char mf_getchar(mf_str *str);
|
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.
|
/* Moves back the pointer to the beginning of the previous character.
|
||||||
* Be careful not to go beyond the start of the string.
|
* 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);
|
MF_EXTERN void mf_rewind(mf_str *str);
|
||||||
#else
|
|
||||||
static void mf_rewind(mf_str *str) { (*str)--; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -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);
|
MF_EXTERN const struct mf_font_s *mf_find_font(const char *name);
|
||||||
|
|
||||||
/* Get the list of included fonts */
|
/* 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
|
#endif
|
|
@ -82,7 +82,7 @@ static uint16_t strip_spaces(mf_str text, uint16_t count, mf_char *last_char)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
tmp = mf_getchar(&text);
|
tmp = mf_getchar(&text);
|
||||||
if (tmp != ' ' && tmp != 0xA0 && tmp != '\n' &&
|
if (tmp != ' ' && tmp != (mf_char)0xA0 && tmp != '\n' &&
|
||||||
tmp != '\r' && tmp != '\t')
|
tmp != '\r' && tmp != '\t')
|
||||||
{
|
{
|
||||||
result = i;
|
result = i;
|
||||||
|
@ -234,6 +234,7 @@ void mf_render_justified(const struct mf_font_s *font,
|
||||||
mf_character_callback_t callback,
|
mf_character_callback_t callback,
|
||||||
void *state)
|
void *state)
|
||||||
{
|
{
|
||||||
|
(void) width;
|
||||||
mf_render_aligned(font, x0, y0, MF_ALIGN_LEFT, text, count, callback, state);
|
mf_render_aligned(font, x0, y0, MF_ALIGN_LEFT, text, count, callback, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,7 @@
|
||||||
MF_EXTERN int8_t mf_compute_kerning(const struct mf_font_s *font,
|
MF_EXTERN int8_t mf_compute_kerning(const struct mf_font_s *font,
|
||||||
mf_char c1, mf_char c2);
|
mf_char c1, mf_char c2);
|
||||||
#else
|
#else
|
||||||
static int8_t mf_compute_kerning(const struct mf_font_s *font,
|
#define mf_compute_kerning(font, c1, c2) 0
|
||||||
mf_char c1, mf_char c2)
|
|
||||||
{ return 0; }
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -160,6 +160,7 @@ static void write_bin_codeword(const struct mf_rlefont_s *font,
|
||||||
uint8_t bitcount = fillentry_bitcount(code);
|
uint8_t bitcount = fillentry_bitcount(code);
|
||||||
uint8_t byte = code - DICT_START7BIT;
|
uint8_t byte = code - DICT_START7BIT;
|
||||||
uint8_t runlen = 0;
|
uint8_t runlen = 0;
|
||||||
|
(void) font;
|
||||||
|
|
||||||
while (bitcount--)
|
while (bitcount--)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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,
|
void mf_wordwrap(const struct mf_font_s *font, int16_t width,
|
||||||
mf_str text, mf_line_callback_t callback, void *state)
|
mf_str text, mf_line_callback_t callback, void *state)
|
||||||
{
|
{
|
||||||
mf_str orig = text;
|
|
||||||
mf_str linestart;
|
mf_str linestart;
|
||||||
|
|
||||||
/* Current line width and character count */
|
/* Current line width and character count */
|
||||||
|
|
Loading…
Add table
Reference in a new issue