unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 109626 GTK3 issue
@ 2012-08-15  8:57 Dmitry Antipov
  2012-08-15  9:39 ` Chong Yidong
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Antipov @ 2012-08-15  8:57 UTC (permalink / raw)
  To: Emacs development discussions

An attempt to compile 109626 with GCC 4.7.1 and --enable-gcc-warnings causes
the following error:

/home/dima/work/stuff/emacs/trunk/src/gtkutil.c: In function 'xg_get_font':
/home/dima/work/stuff/emacs/trunk/src/gtkutil.c:2111:27: error: cast from function
call of type 'gint' to non-matching type 'double' [-Werror=bad-function-cast]

I'm not familiar with GTK stuff, but shouldn't it be:

=== modified file 'src/gtkutil.c'
--- src/gtkutil.c	2012-08-15 07:58:34 +0000
+++ src/gtkutil.c	2012-08-15 08:52:04 +0000
@@ -2103,13 +2103,13 @@
  	  const char *name   = pango_font_description_get_family (desc);
  	  PangoWeight weight = pango_font_description_get_weight (desc);
  	  PangoStyle   style = pango_font_description_get_style (desc);
+	  gint          size = pango_font_description_get_size (desc);

  	  args[0] = QCname;
  	  args[1] = build_string (name);

  	  args[2] = QCsize;
-	  args[3] = make_float (((double) pango_font_description_get_size (desc))
-				/ PANGO_SCALE);
+	  args[3] = make_float (pango_units_to_double (size) / PANGO_SCALE);

  	  args[4] = QCweight;
  	  args[5] = XG_WEIGHT_TO_SYMBOL (weight);

Dmitry



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: 109626 GTK3 issue
  2012-08-15  8:57 109626 GTK3 issue Dmitry Antipov
@ 2012-08-15  9:39 ` Chong Yidong
  0 siblings, 0 replies; 2+ messages in thread
From: Chong Yidong @ 2012-08-15  9:39 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Emacs development discussions

Dmitry Antipov <dmantipov@yandex.ru> writes:

> - args[3] = make_float (((double) pango_font_description_get_size
> (desc))
> -				/ PANGO_SCALE);
> +	  args[3] = make_float (pango_units_to_double (size) / PANGO_SCALE);

Thanks, committed with a minor fix (there's no need to divide by
PANGO_SCALE if using pango_units_to_double).



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-15  9:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-15  8:57 109626 GTK3 issue Dmitry Antipov
2012-08-15  9:39 ` Chong Yidong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).