summaryrefslogtreecommitdiff
path: root/riscos/font.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-05-28 16:08:46 +0100
committerVincent Sanders <vince@kyllikki.org>2015-05-28 16:08:46 +0100
commitc105738fa36bb2400adc47399c5b878d252d1c86 (patch)
tree138eeb449e1bf51ee1726b5f820740aada0ccd0b /riscos/font.c
parent20f2c86a511f7913cf858e7bd3668b0b59663ba0 (diff)
downloadnetsurf-c105738fa36bb2400adc47399c5b878d252d1c86.tar.gz
netsurf-c105738fa36bb2400adc47399c5b878d252d1c86.tar.bz2
Change LOG() macro to be varadic
This changes the LOG macro to be varadic removing the need for all callsites to have double bracketing and allows for future improvement on how we use the logging macros. The callsites were changed with coccinelle and the changes checked by hand. Compile tested for several frontends but not all. A formatting annotation has also been added which allows the compiler to check the parameters and types passed to the logging.
Diffstat (limited to 'riscos/font.c')
-rw-r--r--riscos/font.c67
1 files changed, 24 insertions, 43 deletions
diff --git a/riscos/font.c b/riscos/font.c
index db6376a88..7947365f9 100644
--- a/riscos/font.c
+++ b/riscos/font.c
@@ -79,19 +79,17 @@ void nsfont_init(void)
nsfont_check_fonts();
- LOG(("Initialise RUfl"));
+ LOG("Initialise RUfl");
code = rufl_init();
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG(("rufl_init: rufl_FONT_MANAGER_ERROR: 0x%x: %s",
- rufl_fm_error->errnum,
- rufl_fm_error->errmess));
+ LOG("rufl_init: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
else
- LOG(("rufl_init: 0x%x", code));
+ LOG("rufl_init: 0x%x", code);
die("The Unicode font library could not be initialized. "
"Please report this to the developers.");
}
- LOG(("RUfl initialised"));
+ LOG("RUfl initialised");
if (rufl_family_list_entries == 0)
die("No fonts could be found. At least one font must be "
@@ -125,9 +123,9 @@ const char *nsfont_fallback_font(void)
const char *fallback = "Homerton";
if (!nsfont_exists(fallback)) {
- LOG(("Homerton not found, dumping RUfl family list"));
+ LOG("Homerton not found, dumping RUfl family list");
for (unsigned int i = 0; i < rufl_family_list_entries; i++) {
- LOG(("'%s'", rufl_family_list[i]));
+ LOG("'%s'", rufl_family_list[i]);
}
fallback = rufl_family_list[0];
}
@@ -203,8 +201,7 @@ void nsfont_check_fonts(void)
"<NetSurf$Dir>.FixFonts", 0);
die("FontBadInst");
} else {
- LOG(("xfont_find_font: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xfont_find_font: 0x%x: %s", error->errnum, error->errmess);
snprintf(s, sizeof s, messages_get("FontError"),
error->errmess);
die(s);
@@ -213,8 +210,7 @@ void nsfont_check_fonts(void)
error = xfont_lose_font(font);
if (error) {
- LOG(("xfont_lose_font: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xfont_lose_font: 0x%x: %s", error->errnum, error->errmess);
snprintf(s, sizeof s, messages_get("FontError"),
error->errmess);
die(s);
@@ -252,11 +248,9 @@ bool nsfont_width(const plot_font_style_t *fstyle,
width);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG(("rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s",
- rufl_fm_error->errnum,
- rufl_fm_error->errmess));
+ LOG("rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
else
- LOG(("rufl_width: 0x%x", code));
+ LOG("rufl_width: 0x%x", code);
/* warn_user("MiscError", "font error"); */
*width = 0;
return false;
@@ -300,12 +294,9 @@ bool nsfont_position_in_string(const plot_font_style_t *fstyle,
x * 2, char_offset, actual_x);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG(("rufl_x_to_offset: rufl_FONT_MANAGER_ERROR: "
- "0x%x: %s",
- rufl_fm_error->errnum,
- rufl_fm_error->errmess));
+ LOG("rufl_x_to_offset: rufl_FONT_MANAGER_ERROR: ""0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
else
- LOG(("rufl_x_to_offset: 0x%x", code));
+ LOG("rufl_x_to_offset: 0x%x", code);
/* warn_user("MiscError", "font error"); */
*char_offset = 0;
*actual_x = 0;
@@ -361,12 +352,9 @@ bool nsfont_split(const plot_font_style_t *fstyle,
x * 2, char_offset, actual_x);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG(("rufl_split: rufl_FONT_MANAGER_ERROR: "
- "0x%x: %s",
- rufl_fm_error->errnum,
- rufl_fm_error->errmess));
+ LOG("rufl_split: rufl_FONT_MANAGER_ERROR: ""0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
else
- LOG(("rufl_split: 0x%x", code));
+ LOG("rufl_split: 0x%x", code);
/* warn_user("MiscError", "font error"); */
*char_offset = 0;
*actual_x = 0;
@@ -395,11 +383,9 @@ bool nsfont_split(const plot_font_style_t *fstyle,
actual_x);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG(("rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s",
- rufl_fm_error->errnum,
- rufl_fm_error->errmess));
+ LOG("rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
else
- LOG(("rufl_width: 0x%x", code));
+ LOG("rufl_width: 0x%x", code);
/* warn_user("MiscError", "font error"); */
*char_offset = 0;
*actual_x = 0;
@@ -442,11 +428,9 @@ bool nsfont_paint(const plot_font_style_t *fstyle, const char *string,
string, length, x, y, flags);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG(("rufl_paint: rufl_FONT_MANAGER_ERROR: 0x%x: %s",
- rufl_fm_error->errnum,
- rufl_fm_error->errmess));
+ LOG("rufl_paint: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
else
- LOG(("rufl_paint: 0x%x", code));
+ LOG("rufl_paint: 0x%x", code);
}
return true;
@@ -539,8 +523,7 @@ void ro_gui_wimp_desktop_font(char *family, size_t family_size, int *psize,
error = xwimpreadsysinfo_font(&font_handle, NULL);
if (error) {
- LOG(("xwimpreadsysinfo_font: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimpreadsysinfo_font: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
goto failsafe;
}
@@ -552,22 +535,20 @@ void ro_gui_wimp_desktop_font(char *family, size_t family_size, int *psize,
error = xfont_read_identifier(font_handle, NULL, &used);
if (error) {
- LOG(("xfont_read_identifier: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xfont_read_identifier: 0x%x: %s", error->errnum, error->errmess);
warn_user("MiscError", error->errmess);
goto failsafe;
}
if (family_size < (size_t) used + 1) {
- LOG(("desktop font name too long"));
+ LOG("desktop font name too long");
goto failsafe;
}
error = xfont_read_defn(font_handle, (byte *) family,
&ptx, &pty, NULL, NULL, NULL, NULL);
if (error) {
- LOG(("xfont_read_defn: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xfont_read_defn: 0x%x: %s", error->errnum, error->errmess);
warn_user("MiscError", error->errmess);
goto failsafe;
}
@@ -579,7 +560,7 @@ void ro_gui_wimp_desktop_font(char *family, size_t family_size, int *psize,
}
}
- LOG(("desktop font \"%s\"", family));
+ LOG("desktop font \"%s\"", family);
if (strcasestr(family, ".Medium"))
style = rufl_WEIGHT_500;
@@ -595,7 +576,7 @@ void ro_gui_wimp_desktop_font(char *family, size_t family_size, int *psize,
*psize = max(ptx, pty);
*pstyle = style;
- LOG(("family \"%s\", size %i, style %i", family, *psize, style));
+ LOG("family \"%s\", size %i, style %i", family, *psize, style);
return;