From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alexander Kuleshov Newsgroups: gmane.emacs.devel Subject: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed Date: Fri, 22 Jan 2016 16:54:44 +0600 Message-ID: <1453460084-19646-1-git-send-email-kuleshovmail@gmail.com> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1453474108 17697 80.91.229.3 (22 Jan 2016 14:48:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Jan 2016 14:48:28 +0000 (UTC) Cc: Alexander Kuleshov To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 22 15:48:12 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aMd0S-0006Lr-PY for ged-emacs-devel@m.gmane.org; Fri, 22 Jan 2016 15:48:09 +0100 Original-Received: from localhost ([::1]:54218 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMd0P-000404-3o for ged-emacs-devel@m.gmane.org; Fri, 22 Jan 2016 09:48:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMZQ8-0007fr-MN for emacs-devel@gnu.org; Fri, 22 Jan 2016 05:58:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMZQ5-0006F6-D8 for emacs-devel@gnu.org; Fri, 22 Jan 2016 05:58:24 -0500 Original-Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]:34616) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMZQ4-0006Ec-Uk for emacs-devel@gnu.org; Fri, 22 Jan 2016 05:58:21 -0500 Original-Received: by mail-lf0-x22c.google.com with SMTP id 17so44579427lfz.1 for ; Fri, 22 Jan 2016 02:58:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=jLQErbLzfMAY+GjS/hvJ6WqIpk4oeEKZkfPYMMINpwE=; b=DxhuV17T5bJsZT9QNjL/jsWXQMYp2iue4Coa0ZUJQReDm8qBV7/4Tcgqb9XHYQ7Tlo 6APbJ2nzOmAi2hN8xR4CiHwuBVdl0jdajlvQ3EPN7Vb2uQS0j9KTrRQd5NP9h2NkPSjh EFFY+3eZ4paRYByifqvaRjLTSEkgpv44W766FVLmZQ+HAPhPSdfLhODZ4mjnVL4qZkuw YMMm1vyZsqlkH2RTXcmUvPQnmtG2SHFbBBjCM1TAixPVRDMB0RDI5ADWNl0/UlsJrBfp oaLBmdw2Ezr59jJHvPCBhUvfUqNzT1UGVp3xfCoHa9QsdrZSLb4/sB1XXIPnRMQY+9Az ++HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jLQErbLzfMAY+GjS/hvJ6WqIpk4oeEKZkfPYMMINpwE=; b=Xq46gt117dIZa1/bw7prz/AKJcKpXqIEMwHpUt6EPUEmVvlZ2KS2u4hwUR7pMARq5R PPWWwNa74aAKK7aS9M626f0M4IDhVjs3W9Y/huRZNcJPsLPZJ/Lh/cDecg6NoYwWlHHb aEfXudMTg3LMW8WJ4R8EuUnaztGASI0EaS2117XB7xEs7YZxsFxVWqCdm+huXQo+vqfY Z9hTqXgU2tvTAB3WzPdmwpmhZCILgkgrN/X4X/4WM3/drFZO3nGJTjOhhOJ/sAwoDr5P 3/R2gna6HJrx6h1fqd+8FzAOpZAVDHdM6LAP5D1lOcepD2vJoNDHJfocPLea6FHStSdk o4cg== X-Gm-Message-State: AG10YOTkw1lGldrjEUPY3/yxlSCqJFtMu/SuwJEfvTiZLkrgKuH8qfC3Nt/racvdY6K3Og== X-Received: by 10.25.7.206 with SMTP id 197mr957727lfh.2.1453460299695; Fri, 22 Jan 2016 02:58:19 -0800 (PST) Original-Received: from localhost.localhost ([2.133.31.98]) by smtp.gmail.com with ESMTPSA id r63sm820516lfe.38.2016.01.22.02.58.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jan 2016 02:58:18 -0800 (PST) X-Mailer: git-send-email 2.7.0.25.gfc10eb5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::22c X-Mailman-Approved-At: Fri, 22 Jan 2016 09:47:50 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:198582 Archived-At: This patch does not provide functional changes, but contains fixes for compilation errors if GNU Emacs was configured with the --enable-gcc-warnings option. Mostly "defined but not used" fixed. * src/gtkutil.c: set Qreverse_landscape if orientation symbol not given. Prevents compilation error: orientation_symbol can be not initialzed. * src/image.c: add check that COLOR_TABLE_SUPPORT defined. Prevents compilation error: macro COLOR_TABLE_SUPPORT defined but not used. * src/xterm.c: move 'Window' declaration in the x_draw_fringe_bitmap() to prevent errors "defined but not used". --- src/gtkutil.c | 2 +- src/image.c | 46 +++++++++++++++++++++++++++++----------------- src/xterm.c | 6 +++--- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/gtkutil.c b/src/gtkutil.c index 768df34..bf7a067 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -4096,7 +4096,7 @@ xg_get_page_setup (void) orientation_symbol = Qlandscape; else if (orientation == GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT) orientation_symbol = Qreverse_portrait; - else if (orientation == GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE) + else orientation_symbol = Qreverse_landscape; return listn (CONSTYPE_HEAP, 7, diff --git a/src/image.c b/src/image.c index 8bb5ff7..03b4489 100644 --- a/src/image.c +++ b/src/image.c @@ -75,7 +75,9 @@ typedef struct x_bitmap_record Bitmap_Record; #endif /* W32_TODO : Color tables on W32. */ +#ifdef COLOR_TABLE_SUPPORT #undef COLOR_TABLE_SUPPORT +#endif typedef struct w32_bitmap_record Bitmap_Record; #define GET_PIXEL(ximg, x, y) GetPixel (ximg, x, y) @@ -90,11 +92,16 @@ typedef struct w32_bitmap_record Bitmap_Record; #endif /* HAVE_NTGUI */ #ifdef USE_CAIRO +#ifdef COLOR_TABLE_SUPPORT #undef COLOR_TABLE_SUPPORT #endif +#endif #ifdef HAVE_NS + +#ifdef COLOR_TABLE_SUPPORT #undef COLOR_TABLE_SUPPORT +#endif typedef struct ns_bitmap_record Bitmap_Record; @@ -4615,16 +4622,15 @@ colors_in_color_table (int *n) static unsigned long lookup_rgb_color (struct frame *f, int r, int g, int b) { - unsigned long pixel; - #ifdef HAVE_NTGUI - pixel = PALETTERGB (r >> 8, g >> 8, b >> 8); + return PALETTERGB (r >> 8, g >> 8, b >> 8); #endif /* HAVE_NTGUI */ #ifdef HAVE_NS - pixel = RGB_TO_ULONG (r >> 8, g >> 8, b >> 8); + return RGB_TO_ULONG (r >> 8, g >> 8, b >> 8); #endif /* HAVE_NS */ - return pixel; + + return 0; } static void @@ -7328,10 +7334,10 @@ tiff_load (struct frame *f, struct image *img) for (x = 0; x < width; ++x) { uint32 abgr = row[x]; - int r = TIFFGetR (abgr); - int g = TIFFGetG (abgr); - int b = TIFFGetB (abgr); - int a = TIFFGetA (abgr); + r = TIFFGetR (abgr); + g = TIFFGetG (abgr); + b = TIFFGetB (abgr); + a = TIFFGetA (abgr); *dataptr++ = (a << 24) | (r << 16) | (g << 8) | b; } } @@ -7634,13 +7640,11 @@ gif_load (struct frame *f, struct image *img) { int rc, width, height, x, y, i, j; ColorMapObject *gif_color_map; - unsigned long pixel_colors[256]; GifFileType *gif; gif_memory_source memsrc; Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL); Lisp_Object specified_file = image_spec_value (img->spec, QCfile, NULL); Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL); - unsigned long bgcolor = 0; EMACS_INT idx; int gif_err; @@ -7648,6 +7652,8 @@ gif_load (struct frame *f, struct image *img) unsigned char *data = 0; #else XImagePtr ximg; + unsigned long pixel_colors[256]; + unsigned long bgcolor = 0; #endif if (NILP (specified_data)) @@ -7834,8 +7840,12 @@ gif_load (struct frame *f, struct image *img) init_color_table (); if (STRINGP (specified_bg)) +#ifndef USE_CAIRO bgcolor = x_alloc_image_color (f, img, specified_bg, - FRAME_BACKGROUND_PIXEL (f)); + FRAME_BACKGROUND_PIXEL (f)); +#else + x_alloc_image_color (f, img, specified_bg, FRAME_BACKGROUND_PIXEL (f)); +#endif for (j = 0; j <= idx; ++j) { /* We use a local variable `raster' here because RasterBits is a @@ -9182,11 +9192,13 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. * int height; const guint8 *pixels; int rowstride; - XImagePtr ximg; - Lisp_Object specified_bg; - XColor background; +#ifndef USE_CAIRO int x; int y; + XColor background; + XImagePtr ximg; + Lisp_Object specified_bg; +#endif #if ! GLIB_CHECK_VERSION (2, 36, 0) /* g_type_init is a glib function that must be called prior to @@ -9597,8 +9609,6 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f) 0, 0, img->width, img->height, ~0, ZPixmap); if (ximg) { - int x, y; - /* Initialize the color table. */ init_color_table (); @@ -9606,6 +9616,8 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f) color table. After having done so, the color table will contain an entry for each color used by the image. */ #ifdef COLOR_TABLE_SUPPORT + int x, y; + for (y = 0; y < img->height; ++y) for (x = 0; x < img->width; ++x) { diff --git a/src/xterm.c b/src/xterm.c index 5a6d643..530c918 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1312,7 +1312,6 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring { struct frame *f = XFRAME (WINDOW_FRAME (w)); Display *display = FRAME_X_DISPLAY (f); - Window window = FRAME_X_WINDOW (f); GC gc = f->output_data.x->normal_gc; struct face *face = p->face; @@ -1359,6 +1358,7 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring Pixmap pixmap, clipmask = (Pixmap) 0; int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); XGCValues gcv; + Window window = FRAME_X_WINDOW (f); if (p->wd > 8) bits = (char *) (p->bits + p->dh); @@ -3749,7 +3749,7 @@ x_delete_glyphs (struct frame *f, register int n) emacs_abort (); } - +#if !defined USE_CAIRO || !defined USE_TOOLKIT_SCROLL_BARS /* Like XClearArea, but check that WIDTH and HEIGHT are reasonable. If they are <= 0, this is probably an error. */ @@ -3760,7 +3760,7 @@ x_clear_area1 (Display *dpy, Window window, eassert (width > 0 && height > 0); XClearArea (dpy, window, x, y, width, height, exposures); } - +#endif void x_clear_area (struct frame *f, int x, int y, int width, int height) -- 2.7.0.25.gfc10eb5