summaryrefslogtreecommitdiff
path: root/desktop/save_pdf.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 /desktop/save_pdf.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 'desktop/save_pdf.c')
-rw-r--r--desktop/save_pdf.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/desktop/save_pdf.c b/desktop/save_pdf.c
index e3f9cbc34..aeec9ce2e 100644
--- a/desktop/save_pdf.c
+++ b/desktop/save_pdf.c
@@ -170,7 +170,7 @@ bool pdf_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *psty
{
DashPattern_e dash;
#ifdef PDF_DEBUG
- LOG(("%d %d %d %d %f %X", x0, y0, x1, y1, page_height - y0, pstyle->fill_colour));
+ LOG("%d %d %d %d %f %X", x0, y0, x1, y1, page_height - y0, pstyle->fill_colour);
#endif
if (pstyle->fill_type != PLOT_OP_TYPE_NONE) {
@@ -261,7 +261,7 @@ bool pdf_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
#ifdef PDF_DEBUG
int pmaxx = p[0], pmaxy = p[1];
int pminx = p[0], pminy = p[1];
- LOG(("."));
+ LOG(".");
#endif
if (n == 0)
return true;
@@ -280,7 +280,7 @@ bool pdf_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
}
#ifdef PDF_DEBUG
- LOG(("%d %d %d %d %f", pminx, pminy, pmaxx, pmaxy, page_height - pminy));
+ LOG("%d %d %d %d %f", pminx, pminy, pmaxx, pmaxy, page_height - pminy);
#endif
HPDF_Page_Fill(pdf_page);
@@ -293,7 +293,7 @@ bool pdf_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
bool pdf_plot_clip(const struct rect *clip)
{
#ifdef PDF_DEBUG
- LOG(("%d %d %d %d", clip->x0, clip->y0, clip->x1, clip->y1));
+ LOG("%d %d %d %d", clip->x0, clip->y0, clip->x1, clip->y1);
#endif
/*Normalize cllipping area - to prevent overflows.
@@ -313,7 +313,7 @@ bool pdf_plot_text(int x, int y, const char *text, size_t length,
const plot_font_style_t *fstyle)
{
#ifdef PDF_DEBUG
- LOG((". %d %d %.*s", x, y, (int)length, text));
+ LOG(". %d %d %.*s", x, y, (int)length, text);
#endif
char *word;
HPDF_Font pdf_font;
@@ -346,7 +346,7 @@ bool pdf_plot_text(int x, int y, const char *text, size_t length,
bool pdf_plot_disc(int x, int y, int radius, const plot_style_t *style)
{
#ifdef PDF_DEBUG
- LOG(("."));
+ LOG(".");
#endif
if (style->fill_type != PLOT_OP_TYPE_NONE) {
apply_clip_and_mode(false,
@@ -377,7 +377,7 @@ bool pdf_plot_disc(int x, int y, int radius, const plot_style_t *style)
bool pdf_plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style)
{
#ifdef PDF_DEBUG
- LOG(("%d %d %d %d %d %X", x, y, radius, angle1, angle2, style->stroke_colour));
+ LOG("%d %d %d %d %d %X", x, y, radius, angle1, angle2, style->stroke_colour);
#endif
/* FIXME: line width 1 is ok ? */
@@ -405,8 +405,7 @@ bool pdf_plot_bitmap_tile(int x, int y, int width, int height,
HPDF_REAL max_width, max_height;
#ifdef PDF_DEBUG
- LOG(("%d %d %d %d %p 0x%x", x, y, width, height,
- bitmap, bg));
+ LOG("%d %d %d %d %p 0x%x", x, y, width, height, bitmap, bg);
#endif
if (width == 0 || height == 0)
return true;
@@ -483,7 +482,7 @@ HPDF_Image pdf_extract_image(struct bitmap *bitmap)
rgb_buffer = (unsigned char *)malloc(3 * img_width * img_height);
alpha_buffer = (unsigned char *)malloc(img_width * img_height);
if (rgb_buffer == NULL || alpha_buffer == NULL) {
- LOG(("Not enough memory to create RGB buffer"));
+ LOG("Not enough memory to create RGB buffer");
free(rgb_buffer);
free(alpha_buffer);
return NULL;
@@ -607,7 +606,7 @@ bool pdf_plot_path(const float *p, unsigned int n, colour fill, float width,
bool empty_path;
#ifdef PDF_DEBUG
- LOG(("."));
+ LOG(".");
#endif
if (n == 0)
@@ -649,7 +648,7 @@ bool pdf_plot_path(const float *p, unsigned int n, colour fill, float width,
i += 7;
empty_path = false;
} else {
- LOG(("bad path command %f", p[i]));
+ LOG("bad path command %f", p[i]);
return false;
}
}
@@ -685,7 +684,7 @@ bool pdf_begin(struct print_settings *print_settings)
HPDF_Free(pdf_doc);
pdf_doc = HPDF_New(error_handler, NULL);
if (!pdf_doc) {
- LOG(("Error creating pdf_doc"));
+ LOG("Error creating pdf_doc");
return false;
}
@@ -708,7 +707,7 @@ bool pdf_begin(struct print_settings *print_settings)
pdf_page = NULL;
#ifdef PDF_DEBUG
- LOG(("pdf_begin finishes"));
+ LOG("pdf_begin finishes");
#endif
return true;
}
@@ -717,7 +716,7 @@ bool pdf_begin(struct print_settings *print_settings)
bool pdf_next_page(void)
{
#ifdef PDF_DEBUG
- LOG(("pdf_next_page begins"));
+ LOG("pdf_next_page begins");
#endif
clip_update_needed = false;
if (pdf_page != NULL) {
@@ -745,7 +744,7 @@ bool pdf_next_page(void)
pdfw_gs_save(pdf_page);
#ifdef PDF_DEBUG
- LOG(("%f %f", page_width, page_height));
+ LOG("%f %f", page_width, page_height);
#endif
return true;
@@ -755,7 +754,7 @@ bool pdf_next_page(void)
void pdf_end(void)
{
#ifdef PDF_DEBUG
- LOG(("pdf_end begins"));
+ LOG("pdf_end begins");
#endif
clip_update_needed = false;
if (pdf_page != NULL) {
@@ -780,7 +779,7 @@ void pdf_end(void)
else
save_pdf(settings->output);
#ifdef PDF_DEBUG
- LOG(("pdf_end finishes"));
+ LOG("pdf_end finishes");
#endif
}
@@ -820,8 +819,7 @@ void save_pdf(const char *path)
static void error_handler(HPDF_STATUS error_no, HPDF_STATUS detail_no,
void *user_data)
{
- LOG(("ERROR:\n\terror_no=%x\n\tdetail_no=%d\n", (HPDF_UINT)error_no,
- (HPDF_UINT)detail_no));
+ LOG("ERROR:\n\terror_no=%x\n\tdetail_no=%d\n", (HPDF_UINT)error_no, (HPDF_UINT)detail_no);
#ifdef PDF_DEBUG
exit(1);
#endif