From e5a05f1c0e1bb7e7388d4fedb584d8ec71be6628 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 28 Apr 2016 19:07:06 +0100 Subject: [PATCH] Fix Amiga build following recent API change --- amiga/font.h | 7 ++++--- amiga/font_bullet.c | 24 ++++++++++++------------ amiga/font_diskfont.c | 30 +++++++++++++++--------------- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/amiga/font.h b/amiga/font.h index a0b63d060..cd526057f 100755 --- a/amiga/font.h +++ b/amiga/font.h @@ -20,6 +20,7 @@ #define AMIGA_FONT_H #include "desktop/plotters.h" +#include "utils/errors.h" #include #include @@ -37,15 +38,15 @@ void ami_font_close_disk_font(struct TextFont *tfont); /* Font engine tables */ struct ami_font_functions { - bool (*width)(const plot_font_style_t *fstyle, + nserror (*width)(const plot_font_style_t *fstyle, const char *string, size_t length, int *width); - bool (*posn)(const plot_font_style_t *fstyle, + nserror (*posn)(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x); - bool (*split)(const plot_font_style_t *fstyle, + nserror (*split)(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x); diff --git a/amiga/font_bullet.c b/amiga/font_bullet.c index f63455257..81d41ddc9 100644 --- a/amiga/font_bullet.c +++ b/amiga/font_bullet.c @@ -155,7 +155,7 @@ static inline uint32 amiga_nsfont_decode_surrogate(const uint16 *char1) } } -static bool amiga_nsfont_width(const plot_font_style_t *fstyle, +static nserror amiga_nsfont_width(const plot_font_style_t *fstyle, const char *string, size_t length, int *width) { @@ -163,7 +163,7 @@ static bool amiga_nsfont_width(const plot_font_style_t *fstyle, if(*width <= 0) *width == length; // fudge - return true; + return NSERROR_OK; } /** @@ -178,7 +178,7 @@ static bool amiga_nsfont_width(const plot_font_style_t *fstyle, * \return true on success, false on error and error reported */ -static bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle, +static nserror amiga_nsfont_position_in_string(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) { @@ -191,9 +191,9 @@ static bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle, ULONG emwidth = (ULONG)NSA_FONT_EMWIDTH(fstyle->size); int32 tempx; - if(utf8_to_enc(string,"UTF-16",length,(char **)&utf16) != NSERROR_OK) return false; + if(utf8_to_enc(string,"UTF-16",length,(char **)&utf16) != NSERROR_OK) return NSERROR_INVALID; outf16 = utf16; - if(!(ofont = ami_open_outline_font(fstyle, 0))) return false; + if(!(ofont = ami_open_outline_font(fstyle, 0))) return NSERROR_INVALID; *char_offset = 0; *actual_x = 0; @@ -226,7 +226,7 @@ static bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle, *char_offset = utf8_pos; } free(outf16); - return true; + return NSERROR_OK; } } @@ -234,7 +234,7 @@ static bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle, *char_offset = length; free(outf16); - return true; + return NSERROR_OK; } @@ -261,7 +261,7 @@ static bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle, * Returning char_offset == length means no split possible */ -static bool amiga_nsfont_split(const plot_font_style_t *fstyle, +static nserror amiga_nsfont_split(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) { @@ -277,11 +277,11 @@ static bool amiga_nsfont_split(const plot_font_style_t *fstyle, /* Get utf16 conversion of string for glyph measuring routines */ if (utf8_to_enc(string, "UTF-16", length, (char **)&utf16_str) != NSERROR_OK) - return false; + return NSERROR_INVALID; utf16 = utf16_str; if (!(ofont = ami_open_outline_font(fstyle, 0))) - return false; + return NSERROR_INVALID; *char_offset = 0; *actual_x = 0; @@ -317,7 +317,7 @@ static bool amiga_nsfont_split(const plot_font_style_t *fstyle, /* Reached available width, and a space was found; * split there. */ free(utf16_str); - return true; + return NSERROR_OK; } utf16 = utf16next; @@ -331,7 +331,7 @@ static bool amiga_nsfont_split(const plot_font_style_t *fstyle, *char_offset = length; *actual_x = tx; - return true; + return NSERROR_OK; } /** diff --git a/amiga/font_diskfont.c b/amiga/font_diskfont.c index 91bec20d3..a64674ba2 100644 --- a/amiga/font_diskfont.c +++ b/amiga/font_diskfont.c @@ -111,21 +111,21 @@ static size_t ami_font_bm_convert_local_to_utf8_offset(const char *utf8string, s } -static bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle, +static nserror amiga_bm_nsfont_width(const plot_font_style_t *fstyle, const char *string, size_t length, int *width) { char *localtext = NULL; - if((glob == NULL) || (glob->rp == NULL)) return false; + if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID; *width = length; struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle); - if(bmfont == NULL) return false; + if(bmfont == NULL) return NSERROR_INVALID; if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) { ami_font_bm_close(bmfont); - return false; + return NSERROR_INVALID; } *width = TextLength(glob->rp, localtext, (UWORD)strlen(localtext)); @@ -133,7 +133,7 @@ static bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle, ami_font_bm_close(bmfont); - return true; + return NSERROR_OK; } /** @@ -148,7 +148,7 @@ static bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle, * \return true on success, false on error and error reported */ -static bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle, +static nserror amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) { @@ -157,14 +157,14 @@ static bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle, char *localtext = NULL; UWORD co = 0; - if((glob == NULL) || (glob->rp == NULL)) return false; + if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID; bmfont = ami_font_bm_open(glob->rp, fstyle); - if(bmfont == NULL) return false; + if(bmfont == NULL) return NSERROR_INVALID; if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) { ami_font_bm_close(bmfont); - return false; + return NSERROR_INVALID; } co = TextFit(glob->rp, localtext, (UWORD)strlen(localtext), @@ -175,7 +175,7 @@ static bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle, free(localtext); ami_font_bm_close(bmfont); - return true; + return NSERROR_OK; } @@ -202,7 +202,7 @@ static bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle, * Returning char_offset == length means no split possible */ -static bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle, +static nserror amiga_bm_nsfont_split(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) { @@ -211,14 +211,14 @@ static bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle, char *charp; char *localtext; - if((glob == NULL) || (glob->rp == NULL)) return false; + if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID; struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle); - if(bmfont == NULL) return false; + if(bmfont == NULL) return NSERROR_INVALID; if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) { ami_font_bm_close(bmfont); - return false; + return NSERROR_INVALID; } offset = TextFit(glob->rp, localtext, (UWORD)strlen(localtext), @@ -253,7 +253,7 @@ static bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle, free(localtext); ami_font_bm_close(bmfont); - return true; + return NSERROR_OK; } static ULONG amiga_bm_nsfont_text(struct RastPort *rp, const char *string, ULONG length,