From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Terje Rosten Newsgroups: gmane.emacs.devel Subject: Re: Let's tell we are using GTK+ Date: Tue, 19 Aug 2003 12:46:33 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1061604484 22644 80.91.224.253 (23 Aug 2003 02:08:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 23 Aug 2003 02:08:04 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Aug 23 04:08:02 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19qNow-0001pw-00 for ; Sat, 23 Aug 2003 04:08:02 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19qNtN-00075P-00 for ; Sat, 23 Aug 2003 04:12:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19p7EQ-0008No-Vu for emacs-devel@quimby.gnus.org; Tue, 19 Aug 2003 10:13:06 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19p4qS-0001zC-RS for emacs-devel@gnu.org; Tue, 19 Aug 2003 07:40:12 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19p4Zg-00069I-4k for emacs-devel@gnu.org; Tue, 19 Aug 2003 07:23:23 -0400 Original-Received: from [129.241.48.108] (helo=igor.phys.ntnu.no) by monty-python.gnu.org with esmtp (Exim 4.20) id 19p40c-0000pv-Im for emacs-devel@gnu.org; Tue, 19 Aug 2003 06:46:38 -0400 Original-Received: from igor.phys.ntnu.no (localhost.localdomain [127.0.0.1]) by igor.phys.ntnu.no (8.12.8/8.12.8) with ESMTP id h7JAkYQo021550; Tue, 19 Aug 2003 12:46:34 +0200 Original-Received: (from terjeros@localhost) by igor.phys.ntnu.no (8.12.8/8.12.8/Submit) id h7JAkY05021548; Tue, 19 Aug 2003 12:46:34 +0200 X-Authentication-Warning: igor.phys.ntnu.no: terjeros set sender to terjeros@phys.ntnu.no using -f Original-To: Lute Kamstra In-Reply-To: User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:16083 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:16083 * Lute Kamstra | | > + { | > + char gtk_version[8]; | > + sprintf (gtk_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, | > + GTK_MICRO_VERSION); | > + Vgtk_version_string = build_string (gtk_version); | > + } | | this seems vulnerable to a buffer overflow. That's right. In a updated patch I increased to gtk_version[12], but that's not large enough if a GTK+ release is named e.g 2.2.cvs20030819. | It is acceptable to use snprintf instead, or isn't that portable | enough? (I'm not really intimate with C.) What could be used | instead, a larger string? What about using glib? If GTK+ is available then is glib available too. A updated patch using the glib function g_snprintf is included. - Terje Index: lisp/ChangeLog =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.5348 diff -c -r1.5348 ChangeLog *** lisp/ChangeLog 18 Aug 2003 22:46:02 -0000 1.5348 --- lisp/ChangeLog 19 Aug 2003 10:42:16 -0000 *************** *** 1,3 **** --- 1,8 ---- + 2003-08-18 Terje Rosten + + * version.el (emacs-version): Check for gtk. Include gtk version + info. + 2003-08-18 Luc Teirlinck * wid-edit.el (widget-echo-help): Make it handle expressions that Index: lisp/version.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/version.el,v retrieving revision 2.32 diff -c -r2.32 version.el *** lisp/version.el 4 Feb 2003 12:12:31 -0000 2.32 --- lisp/version.el 19 Aug 2003 10:42:16 -0000 *************** *** 62,67 **** --- 62,69 ---- (cond ((featurep 'motif) (concat ", " (substring motif-version-string 4))) ((featurep 'x-toolkit) ", X toolkit") + ((featurep 'gtk) + (concat ", GTK+ " gtk-version-string)) (t "")) (if (and (boundp 'x-toolkit-scroll-bars) (memq x-toolkit-scroll-bars '(xaw xaw3d))) Index: src/ChangeLog =================================================================== RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v retrieving revision 1.3335 diff -c -r1.3335 ChangeLog *** src/ChangeLog 17 Aug 2003 00:25:37 -0000 1.3335 --- src/ChangeLog 19 Aug 2003 10:42:18 -0000 *************** *** 1,3 **** --- 1,8 ---- + 2003-08-18 Terje Rosten + + * xfns.c (Vgtk_version_string): New variable. + (syms_of_xfns): DEFVAR_LISP it. Provide gtk. + 2003-08-16 Richard M. Stallman * editfns.c (Fencode_time): Doc fix. Index: src/xfns.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/xfns.c,v retrieving revision 1.590 diff -c -r1.590 xfns.c *** src/xfns.c 31 Jul 2003 16:10:53 -0000 1.590 --- src/xfns.c 19 Aug 2003 10:42:19 -0000 *************** *** 125,130 **** --- 125,138 ---- #endif /* USE_X_TOOLKIT */ + #ifdef USE_GTK + + /* GTK+ version info */ + + static Lisp_Object Vgtk_version_string; + + #endif /* USE_GTK */ + #ifdef HAVE_X11R4 #define MAXREQUEST(dpy) (XMaxRequestSize (dpy)) #else *************** *** 10885,10890 **** --- 10893,10911 ---- Vmotif_version_string = build_string (XmVERSION_STRING); #endif /* USE_MOTIF */ #endif /* USE_X_TOOLKIT */ + + #ifdef USE_GTK + Fprovide (intern ("gtk"), Qnil); + + DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string, + doc: /* Version info for GTK+. */); + { + char gtk_version[12]; + g_snprintf (gtk_version, sizeof (gtk_version), "%d.%d.%d", + GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); + Vgtk_version_string = build_string (gtk_version); + } + #endif /* USE_GTK */ /* X window properties. */ defsubr (&Sx_change_window_property);