From d58aed1bd1e82193bab4c9156198804d556dca82 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 9 Feb 2005 15:01:24 +0000 Subject: [PATCH] Fix compilation on non-gcc platforms 2005-02-09 Marco Pesenti Gritti * lib/ev-debug.c: * lib/ev-debug.h: * ps/ps-document.c: (ps_document_finalize), (set_up_page), (start_interpreter), (stop_interpreter), (document_load), (ps_document_next_page), (ps_document_goto_page), (ps_document_set_page_size), (ps_document_widget_event), (ps_document_render): * shell/ev-page-view.c: (ev_page_view_dispose): * shell/ev-view.c: (ev_view_finalize), (expose_bin_window): Fix compilation on non-gcc platforms --- ChangeLog | 14 ++++++++++++++ lib/ev-debug.h | 22 +++++++++++++++++----- ps/ps-document.c | 30 +++++++++++++++--------------- shell/ev-page-view.c | 2 +- shell/ev-view.c | 4 ++-- 5 files changed, 49 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5769f4b3..a6f14b71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-02-09 Marco Pesenti Gritti + + * lib/ev-debug.c: + * lib/ev-debug.h: + * ps/ps-document.c: (ps_document_finalize), (set_up_page), + (start_interpreter), (stop_interpreter), (document_load), + (ps_document_next_page), (ps_document_goto_page), + (ps_document_set_page_size), (ps_document_widget_event), + (ps_document_render): + * shell/ev-page-view.c: (ev_page_view_dispose): + * shell/ev-view.c: (ev_view_finalize), (expose_bin_window): + + Fix compilation on non-gcc platforms + 2005-02-09 Marco Pesenti Gritti * NEWS: diff --git a/lib/ev-debug.h b/lib/ev-debug.h index 2c4c521f..53c1e61b 100644 --- a/lib/ev-debug.h +++ b/lib/ev-debug.h @@ -32,13 +32,25 @@ G_BEGIN_DECLS #define DISABLE_PROFILING #endif +#if defined(G_HAVE_GNUC_VARARGS) + #ifdef DISABLE_LOGGING -#define LOG(msg, args...) +#define LOG(msg, args...) G_STMT_START { } G_STMT_END #else -#define LOG(msg, args...) \ -g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - "[ %s ] " msg, \ - __FILE__ , ## args); +#define LOG(msg, args...) \ +g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ + "[ %s ] " msg, \ + __FILE__ , ## args) +#endif + +#elif defined(G_HAVE_ISO_VARARGS) + +#define LOG(...) G_STMT_START { } G_STMT_END + +#else /* no varargs macros */ + +static void LOG(const char *format, ...) {} + #endif #ifdef DISABLE_PROFILING diff --git a/ps/ps-document.c b/ps/ps-document.c index 0afb79c1..1f29c761 100644 --- a/ps/ps-document.c +++ b/ps/ps-document.c @@ -396,7 +396,7 @@ ps_document_finalize (GObject * object) g_return_if_fail (object != NULL); g_return_if_fail (GTK_IS_GS (object)); - LOG ("Finalize") + LOG ("Finalize"); gs = PS_DOCUMENT (object); @@ -487,7 +487,7 @@ set_up_page(PSDocument * gs) GdkColor white = { 0, 0xFFFF, 0xFFFF, 0xFFFF }; /* pixel, r, g, b */ GdkColormap *colormap; - LOG ("Setup the page") + LOG ("Setup the page"); #ifdef HAVE_LOCALE_H char *savelocale; @@ -518,7 +518,7 @@ set_up_page(PSDocument * gs) gs->bpixmap = NULL; } - LOG ("Create our internal pixmap") + LOG ("Create our internal pixmap"); gs->bpixmap = gdk_pixmap_new(gs->pstarget, gs->width, gs->height, -1); gdk_draw_rectangle(gs->bpixmap, fill, TRUE, @@ -554,7 +554,7 @@ set_up_page(PSDocument * gs) gs->left_margin, gs->bottom_margin, gs->right_margin, gs->top_margin); - LOG ("GS property %s", buf) + LOG ("GS property %s", buf); #ifdef HAVE_LOCALE_H setlocale(LC_NUMERIC, savelocale); @@ -720,7 +720,7 @@ start_interpreter(PSDocument * gs) int std_out[2]; /* pipe from interp stdout */ int std_err[2]; /* pipe from interp stderr */ - LOG ("Start the interpreter") + LOG ("Start the interpreter"); #define NUM_ARGS 100 #define NUM_GS_ARGS (NUM_ARGS - 20) @@ -790,7 +790,7 @@ start_interpreter(PSDocument * gs) gdk_x11_drawable_get_xid(gs->pstarget), gdk_x11_drawable_get_xid(gs->bpixmap)); - LOG ("Launching ghostview with env %s", gv_env) + LOG ("Launching ghostview with env %s", gv_env); gs->busy = TRUE; gs->interpreter_pid = fork(); @@ -876,7 +876,7 @@ stop_interpreter(PSDocument * gs) { if(gs->interpreter_pid > 0) { int status = 0; - LOG ("Stop the interpreter") + LOG ("Stop the interpreter"); kill(gs->interpreter_pid, SIGTERM); while((wait(&status) == -1) && (errno == EINTR)) ; gs->interpreter_pid = -1; @@ -1300,7 +1300,7 @@ document_load(PSDocument * gs, const gchar * fname) g_return_val_if_fail(gs != NULL, FALSE); g_return_val_if_fail(GTK_IS_GS(gs), FALSE); - LOG ("Load the document") + LOG ("Load the document"); /* clean up previous document */ ps_document_cleanup(gs); @@ -1408,7 +1408,7 @@ ps_document_next_page(PSDocument * gs) { XEvent event; - LOG ("Make ghostscript render next page") + LOG ("Make ghostscript render next page"); g_return_val_if_fail(gs != NULL, FALSE); g_return_val_if_fail(GTK_IS_GS(gs), FALSE); @@ -1443,7 +1443,7 @@ ps_document_goto_page(PSDocument * gs, gint page) g_return_val_if_fail(gs != NULL, FALSE); g_return_val_if_fail(GTK_IS_GS(gs), FALSE); - LOG ("Go to page %d", page) + LOG ("Go to page %d", page); if(!gs->gs_filename) { return FALSE; @@ -1455,7 +1455,7 @@ ps_document_goto_page(PSDocument * gs, gint page) if(gs->structured_doc && gs->doc) { - LOG ("It's a structured document, let's send one page to gs") + LOG ("It's a structured document, let's send one page to gs"); if(page >= gs->doc->numpages) page = gs->doc->numpages - 1; @@ -1498,7 +1498,7 @@ ps_document_goto_page(PSDocument * gs, gint page) case, ggv restarts GS again and the first page is displayed. */ - LOG ("It's an unstructured document, gs will just read the file") + LOG ("It's an unstructured document, gs will just read the file"); if(page == gs->current_page && !gs->changed) return TRUE; @@ -1532,7 +1532,7 @@ ps_document_set_page_size(PSDocument * gs, gint new_pagesize, gint pageid) gint new_ury = 0; GtkGSPaperSize *papersizes = gtk_gs_defaults_get_paper_sizes(); - LOG ("Set the page size") + LOG ("Set the page size"); g_return_val_if_fail(gs != NULL, FALSE); g_return_val_if_fail(GTK_IS_GS(gs), FALSE); @@ -1752,7 +1752,7 @@ ps_document_widget_event (GtkWidget *widget, GdkEvent *event, gpointer data) gs->message_window = event->client.data.l[0]; if (event->client.message_type == gs_class->page_atom) { - LOG ("GS rendered the document") + LOG ("GS rendered the document"); gs->busy = FALSE; ev_document_changed (EV_DOCUMENT (gs)); } @@ -1857,7 +1857,7 @@ ps_document_render (EvDocument *document, LOG ("Copy the internal pixmap: %d %d %d %d %d %d", draw.x - page.x, draw.y - page.y, - draw.x, draw.y, draw.width, draw.height) + draw.x, draw.y, draw.width, draw.height); g_object_unref (gc); } diff --git a/shell/ev-page-view.c b/shell/ev-page-view.c index 17359521..55f275e6 100644 --- a/shell/ev-page-view.c +++ b/shell/ev-page-view.c @@ -103,7 +103,7 @@ ev_page_view_dispose (GObject *object) { EvPageView *view = EV_PAGE_VIEW (object); - LOG ("dispose") + LOG ("dispose"); if (view->priv->document) { g_object_unref (view->priv->document); diff --git a/shell/ev-view.c b/shell/ev-view.c index 51c7bb20..8fd87238 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -183,7 +183,7 @@ ev_view_finalize (GObject *object) { EvView *view = EV_VIEW (object); - LOG ("Finalize") + LOG ("Finalize"); if (view->document) g_object_unref (view->document); @@ -412,7 +412,7 @@ expose_bin_window (GtkWidget *widget, y_offset + 1); LOG ("Render area %d %d %d %d", event->area.x, event->area.y, - event->area.width, event->area.height) + event->area.width, event->area.height); ev_document_render (view->document, event->area.x, event->area.y, -- 2.43.5