summaryrefslogtreecommitdiff
path: root/src/rufl_paint.c
diff options
context:
space:
mode:
authorJohn-Mark Bell <jmb@netsurf-browser.org>2022-05-27 13:53:14 +0100
committerJohn-Mark Bell <jmb@netsurf-browser.org>2022-05-27 13:53:14 +0100
commit7f5504490fb8fb7ba3916bef7882bd8860a5c0a5 (patch)
tree0cd214bd7565c037644b9fe8d250d135c3783e16 /src/rufl_paint.c
parent7324abb6b05b6f6703667b39f736d6d958cb9460 (diff)
downloadlibrufl-7f5504490fb8fb7ba3916bef7882bd8860a5c0a5.tar.gz
librufl-7f5504490fb8fb7ba3916bef7882bd8860a5c0a5.tar.bz2
Partially revert public API type changes
a4c41198 made a variety of consistency changes to the public API, including changing the type of the "string" parameter passed to many entry points from const char * to const uint8_t *, as that better reflects the data. However, this then forces the user of the API to explicitly cast when passing string constants, or other strings (which, would be passed to standard library APIs as const char *, even if UTF-8 encoded). Revert this part of the change so the type of "string" is once more const char * and cast to the type we actually want internally.
Diffstat (limited to 'src/rufl_paint.c')
-rw-r--r--src/rufl_paint.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/rufl_paint.c b/src/rufl_paint.c
index 06ed509..9dc0e3f 100644
--- a/src/rufl_paint.c
+++ b/src/rufl_paint.c
@@ -58,12 +58,13 @@ static rufl_code rufl_process_not_available(rufl_action action,
rufl_code rufl_paint(const char *font_family, rufl_style font_style,
unsigned int font_size,
- const uint8_t *string, size_t length,
+ const char *string, size_t length,
int x, int y, unsigned int flags)
{
return rufl_process(rufl_PAINT,
- font_family, font_style, font_size, string,
- length, x, y, flags, 0, 0, 0, 0, 0, 0);
+ font_family, font_style, font_size,
+ (const uint8_t *) string, length,
+ x, y, flags, 0, 0, 0, 0, 0, 0);
}
@@ -73,12 +74,13 @@ rufl_code rufl_paint(const char *font_family, rufl_style font_style,
rufl_code rufl_width(const char *font_family, rufl_style font_style,
unsigned int font_size,
- const uint8_t *string, size_t length,
+ const char *string, size_t length,
int *width)
{
return rufl_process(rufl_WIDTH,
- font_family, font_style, font_size, string,
- length, 0, 0, 0, width, 0, 0, 0, 0, 0);
+ font_family, font_style, font_size,
+ (const uint8_t *) string, length,
+ 0, 0, 0, width, 0, 0, 0, 0, 0);
}
@@ -89,14 +91,14 @@ rufl_code rufl_width(const char *font_family, rufl_style font_style,
rufl_code rufl_x_to_offset(const char *font_family, rufl_style font_style,
unsigned int font_size,
- const uint8_t *string, size_t length,
+ const char *string, size_t length,
int click_x,
size_t *char_offset, int *actual_x)
{
return rufl_process(rufl_X_TO_OFFSET,
- font_family, font_style, font_size, string,
- length, 0, 0, 0, 0,
- click_x, char_offset, actual_x, 0, 0);
+ font_family, font_style, font_size,
+ (const uint8_t *) string, length,
+ 0, 0, 0, 0, click_x, char_offset, actual_x, 0, 0);
}
@@ -106,14 +108,14 @@ rufl_code rufl_x_to_offset(const char *font_family, rufl_style font_style,
rufl_code rufl_split(const char *font_family, rufl_style font_style,
unsigned int font_size,
- const uint8_t *string, size_t length,
+ const char *string, size_t length,
int width,
size_t *char_offset, int *actual_x)
{
return rufl_process(rufl_SPLIT,
- font_family, font_style, font_size, string,
- length, 0, 0, 0, 0,
- width, char_offset, actual_x, 0, 0);
+ font_family, font_style, font_size,
+ (const uint8_t *) string, length,
+ 0, 0, 0, 0, width, char_offset, actual_x, 0, 0);
}
@@ -123,13 +125,14 @@ rufl_code rufl_split(const char *font_family, rufl_style font_style,
rufl_code rufl_paint_callback(const char *font_family, rufl_style font_style,
unsigned int font_size,
- const uint8_t *string, size_t length,
+ const char *string, size_t length,
int x, int y,
rufl_callback_t callback, void *context)
{
return rufl_process(rufl_PAINT_CALLBACK,
- font_family, font_style, font_size, string,
- length, x, y, 0, 0, 0, 0, 0, callback, context);
+ font_family, font_style, font_size,
+ (const uint8_t *) string, length,
+ x, y, 0, 0, 0, 0, 0, callback, context);
}