emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Buffer size limitation in insdel.c


From: Eli Zaretskii
Subject: Re: Buffer size limitation in insdel.c
Date: Thu, 23 Sep 2010 15:22:09 +0200

> From: Lars Magne Ingebrigtsen <address@hidden>
> Date: Thu, 23 Sep 2010 14:47:23 +0200
> 
> A few general questions:
> 
> dispnew.c:783: warning: conversion to 'int' from 'Lisp_Object' may alter its 
> value
> 
>       matrix->window_left_col = WINDOW_LEFT_EDGE_COL (w);
> 
> What's the right fix here?  make window_left_col EMACS_INT, and slap an
> XINT around the WINDOW_LEFT_EDGE_COL?

I don't see this warning with "gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4)".
And I don't see how you could possibly get it, since
window_left_edge_col is an int, whereas WINDOW_LEFT_EDGE_COL is
defined like this:

    #define WINDOW_LEFT_EDGE_COL(W) \
      (XFASTINT ((W)->left_col))

So it already extracts the integer from a Lisp_Object.  What am I
missing?


> dispnew.c:2178: warning: conversion to 'long unsigned int' from 'short int' 
> may change the sign of the result
> 
>       size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);

Something like

  size_t nbytes;
  if (from->used[TEXT_AREA] > 0)
    nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
  else
    nbytes = 0;

Or just leave it alone, it obviously isn't in the way of using large
buffers on 64-bit hosts.

And btw, I don't see that warning, either.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]