summaryrefslogtreecommitdiff
path: root/riscos/print.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/print.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/print.c')
-rw-r--r--riscos/print.c65
1 files changed, 22 insertions, 43 deletions
diff --git a/riscos/print.c b/riscos/print.c
index 829029eda..0fb9a9a44 100644
--- a/riscos/print.c
+++ b/riscos/print.c
@@ -196,7 +196,7 @@ void ro_gui_print_prepare(struct gui_window *g)
/* Read Printer Driver name */
error = xpdriver_info(0, 0, 0, 0, &desc, 0, 0, 0);
if (error) {
- LOG(("xpdriver_info: 0x%x: %s", error->errnum, error->errmess));
+ LOG("xpdriver_info: 0x%x: %s", error->errnum, error->errmess);
printers_exists = false;
}
@@ -333,8 +333,7 @@ void print_send_printsave(hlcache_handle *h)
e = xwimp_send_message(wimp_USER_MESSAGE_RECORDED,
(wimp_message *)&m, 0);
if (e) {
- LOG(("xwimp_send_message: 0x%x: %s",
- e->errnum, e->errmess));
+ LOG("xwimp_send_message: 0x%x: %s", e->errnum, e->errmess);
warn_user("WimpError", e->errmess);
ro_print_cleanup();
}
@@ -358,8 +357,7 @@ bool print_send_printtypeknown(wimp_message *m)
m->action = message_PRINT_TYPE_KNOWN;
e = xwimp_send_message(wimp_USER_MESSAGE, m, m->sender);
if (e) {
- LOG(("xwimp_send_message: 0x%x: %s",
- e->errnum, e->errmess));
+ LOG("xwimp_send_message: 0x%x: %s", e->errnum, e->errmess);
warn_user("WimpError", e->errmess);
return false;
}
@@ -465,8 +463,7 @@ bool ro_print_ack(wimp_message *m)
/* read printer driver type */
error = xpdriver_info(&info_type, 0, 0, 0, 0, 0, 0, 0);
if (error) {
- LOG(("xpdriver_info: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xpdriver_info: 0x%x: %s", error->errnum, error->errmess);
warn_user("PrintError", error->errmess);
ro_print_cleanup();
return true;
@@ -491,8 +488,7 @@ bool ro_print_ack(wimp_message *m)
error = xwimp_send_message(wimp_USER_MESSAGE_RECORDED, m, m->sender);
if (error) {
- LOG(("xwimp_send_message: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess);
warn_user("WimpError", error->errmess);
/* and delete temporary file */
xosfile_delete(m->data.data_xfer.file_name,
@@ -564,8 +560,7 @@ bool print_document(struct gui_window *g, const char *filename)
/* read printer driver features */
error = xpdriver_info(0, 0, 0, &features, 0, 0, 0, 0);
if (error) {
- LOG(("xpdriver_info: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xpdriver_info: 0x%x: %s", error->errnum, error->errmess);
warn_user("PrintError", error->errmess);
return false;
}
@@ -573,8 +568,7 @@ bool print_document(struct gui_window *g, const char *filename)
/* read page size */
error = xpdriver_page_size(0, 0, &left, &bottom, &right, &top);
if (error) {
- LOG(("xpdriver_page_size: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xpdriver_page_size: 0x%x: %s", error->errnum, error->errmess);
warn_user("PrintError", error->errmess);
return false;
}
@@ -597,8 +591,7 @@ bool print_document(struct gui_window *g, const char *filename)
error = xosfind_openoutw(osfind_NO_PATH | osfind_ERROR_IF_DIR |
osfind_ERROR_IF_ABSENT, filename, 0, &fhandle);
if (error) {
- LOG(("xosfind_openoutw: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xosfind_openoutw: 0x%x: %s", error->errnum, error->errmess);
warn_user("PrintError", error->errmess);
return false;
}
@@ -606,8 +599,7 @@ bool print_document(struct gui_window *g, const char *filename)
/* select print job */
error = xpdriver_select_jobw(fhandle, "NetSurf", &old_job);
if (error) {
- LOG(("xpdriver_select_jobw: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xpdriver_select_jobw: 0x%x: %s", error->errnum, error->errmess);
warn_user("PrintError", error->errmess);
xosfind_closew(fhandle);
return false;
@@ -667,21 +659,18 @@ bool print_document(struct gui_window *g, const char *filename)
/* give page rectangle */
error = xpdriver_give_rectangle(0, &b, &t, &p, os_COLOUR_WHITE);
if (error) {
- LOG(("xpdriver_give_rectangle: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xpdriver_give_rectangle: 0x%x: %s", error->errnum, error->errmess);
error_message = error->errmess;
goto error;
}
- LOG(("given rectangle: [(%d, %d), (%d, %d)]",
- b.x0, b.y0, b.x1, b.y1));
+ LOG("given rectangle: [(%d, %d), (%d, %d)]", b.x0, b.y0, b.x1, b.y1);
/* and redraw the document */
error = xpdriver_draw_page(print_num_copies, &b, 0, 0,
&more, 0);
if (error) {
- LOG(("xpdriver_draw_page: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xpdriver_draw_page: 0x%x: %s", error->errnum, error->errmess);
error_message = error->errmess;
goto error;
}
@@ -695,8 +684,7 @@ bool print_document(struct gui_window *g, const char *filename)
.plot = &ro_plotters
};
- LOG(("redrawing area: [(%d, %d), (%d, %d)]",
- b.x0, b.y0, b.x1, b.y1));
+ LOG("redrawing area: [(%d, %d), (%d, %d)]", b.x0, b.y0, b.x1, b.y1);
clip.x0 = (b.x0 - ro_plot_origin_x) / 2;
clip.y0 = (ro_plot_origin_y - b.y1) / 2;
clip.x1 = (b.x1 - ro_plot_origin_x) / 2;
@@ -718,8 +706,7 @@ bool print_document(struct gui_window *g, const char *filename)
error = xpdriver_get_rectangle(&b, &more, 0);
if (error) {
- LOG(("xpdriver_get_rectangle: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xpdriver_get_rectangle: 0x%x: %s", error->errnum, error->errmess);
error_message = error->errmess;
goto error;
}
@@ -741,16 +728,14 @@ bool print_document(struct gui_window *g, const char *filename)
error = (os_error *) _swix(PDriver_EndJob, _IN(0), (int) fhandle);
if (error) {
- LOG(("xpdriver_end_jobw: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xpdriver_end_jobw: 0x%x: %s", error->errnum, error->errmess);
error_message = error->errmess;
goto error;
}
error = xosfind_closew(fhandle);
if (error) {
- LOG(("xosfind_closew: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xosfind_closew: 0x%x: %s", error->errnum, error->errmess);
warn_user("PrintError", error->errmess);
return false;
}
@@ -758,8 +743,7 @@ bool print_document(struct gui_window *g, const char *filename)
if (old_job) {
error = xpdriver_select_jobw(old_job, 0, 0);
if (error) {
- LOG(("xpdriver_select_jobw: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xpdriver_select_jobw: 0x%x: %s", error->errnum, error->errmess);
warn_user("PrintError", error->errmess);
/* the printing succeeded anyway */
return true;
@@ -840,20 +824,18 @@ const char *print_declare_fonts(hlcache_handle *h)
}
for (i = 0; i != print_fonts_count; ++i) {
- LOG(("%u %s", i, print_fonts_list[i]));
+ LOG("%u %s", i, print_fonts_list[i]);
error = xpdriver_declare_font(0, print_fonts_list[i],
pdriver_KERNED);
if (error) {
- LOG(("xpdriver_declare_font: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xpdriver_declare_font: 0x%x: %s", error->errnum, error->errmess);
error_message = error->errmess;
goto end;
}
}
error = xpdriver_declare_font(0, 0, 0);
if (error) {
- LOG(("xpdriver_declare_font: 0x%x: %s",
- error->errnum, error->errmess));
+ LOG("xpdriver_declare_font: 0x%x: %s", error->errnum, error->errmess);
error_message = error->errmess;
goto end;
}
@@ -932,13 +914,10 @@ bool print_fonts_plot_text(int x, int y, const char *text, size_t length,
text, length, 0, 0, print_fonts_callback, 0);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR) {
- LOG(("rufl_paint_callback: rufl_FONT_MANAGER_ERROR: "
- "0x%x: %s",
- rufl_fm_error->errnum,
- rufl_fm_error->errmess));
+ LOG("rufl_paint_callback: rufl_FONT_MANAGER_ERROR: ""0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
print_fonts_error = rufl_fm_error->errmess;
} else {
- LOG(("rufl_paint_callback: 0x%x", code));
+ LOG("rufl_paint_callback: 0x%x", code);
}
return false;
}