From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: Building trunk fails in x_check_image_size Date: Thu, 28 Jul 2011 02:44:33 -0700 Organization: UCLA Computer Science Department Message-ID: <4E312F81.8060705@cs.ucla.edu> References: <4E3106C7.2000400@gmx.at> <4E311950.3000408@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1311846294 512 80.91.229.12 (28 Jul 2011 09:44:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 28 Jul 2011 09:44:54 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 28 11:44:50 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QmN98-0002VU-1n for ged-emacs-devel@m.gmane.org; Thu, 28 Jul 2011 11:44:50 +0200 Original-Received: from localhost ([::1]:42181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmN97-0003kk-In for ged-emacs-devel@m.gmane.org; Thu, 28 Jul 2011 05:44:49 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmN94-0003kf-R4 for emacs-devel@gnu.org; Thu, 28 Jul 2011 05:44:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QmN93-0004PP-SW for emacs-devel@gnu.org; Thu, 28 Jul 2011 05:44:46 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:35660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmN91-0004Om-14; Thu, 28 Jul 2011 05:44:43 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 5B9C839E8106; Thu, 28 Jul 2011 02:44:40 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id feEjzYPD28BK; Thu, 28 Jul 2011 02:44:39 -0700 (PDT) Original-Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id B1EBA39E80D2; Thu, 28 Jul 2011 02:44:39 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 In-Reply-To: <4E311950.3000408@gmx.at> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 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:142442 Archived-At: On 07/28/11 01:09, martin rudalics wrote: > But the consequences of doing that seem too unpredictable to me. > I'll wait till Paul fixes it. Sorry about that. I fixed it for now as follows. Doing it "right" requires more expertise in Windows and NS than I have right now, but at least this fix should let things compile, and the code will be no worse off than before (when it didn't check image sizes on any platform). * image.c (x_check_image_size) [!HAVE_X_WINDOWS]: Return 1. In other words, assume that every image size is allowed, on non-X hosts. This assumption is probably wrong, but it lets Emacs compile. === modified file 'src/image.c' --- src/image.c 2011-07-14 06:20:53 +0000 +++ src/image.c 2011-07-28 09:35:15 +0000 @@ -1906,16 +1906,17 @@ static void x_destroy_x_image (XImagePtr); static void x_put_x_image (struct frame *, XImagePtr, Pixmap, int, int); -/* Return nonzero if XIMG's size WIDTH x HEIGHT doesn't break X. +/* Return nonzero if XIMG's size WIDTH x HEIGHT doesn't break the + windowing system. WIDTH and HEIGHT must both be positive. If XIMG is null, assume it is a bitmap. */ static int x_check_image_size (XImagePtr ximg, int width, int height) { +#ifdef HAVE_X_WINDOWS /* Respect Xlib's limits: it cannot deal with images that have more than INT_MAX (and/or UINT_MAX) bytes. And respect Emacs's limits - of PTRDIFF_MAX (and/or SIZE_MAX) bytes for any object. For now, - assume all windowing systems have the same limits that X does. */ + of PTRDIFF_MAX (and/or SIZE_MAX) bytes for any object. */ enum { XLIB_BYTES_MAX = min (INT_MAX, UINT_MAX), @@ -1937,6 +1938,11 @@ } return (width <= (INT_MAX - (bitmap_pad - 1)) / depth && height <= X_IMAGE_BYTES_MAX / bytes_per_line); +#else + /* FIXME: Implement this check for the HAVE_NS and HAVE_NTGUI cases. + For now, assume that every image size is allowed on these systems. */ + return 1; +#endif } /* Create an XImage and a pixmap of size WIDTH x HEIGHT for use on