On Wed, 2009-11-11 at 08:13 +0100, Bert Wesarg wrote:
> On Wed, Nov 11, 2009 at 00:44, Gilles J. Seguin <[email protected]> wrote:
> > warning: cast from pointer to integer of different size
> This warning is a false positive and your proposal is wrong.
>
> The function setFormatCB() gets as clientData an integer pointer, see
> line 1549.
agree
new patch with your proposed change
> If we would apply your proposal we would write 8bytes at
> the position pointed to by clientData, but clientData just points at
> 4bytes. The only values which userData can have are these from enum
> fileFormats. Therefore casting userData to int is safe. The only thing
> we could do is to remove the false warning by first casting to (long),
> ie.:
>
> --- nedit-5.6/source/file.c.yy 2008-11-05 04:17:20.000000000 -0500
> +++ nedit-5.6/source/file.c 2009-11-10 16:20:39.000000000 -0500
> @@ -1914,7 +1914,7 @@
> if (XmToggleButtonGetState(w)) {
> XtPointer userData;
> XtVaGetValues(w, XmNuserData, &userData, NULL);
> - *(int*) clientData = (int) userData;
> - *(int*) clientData = (int) (long) userData;
> }
> }
--- nedit-5.6/source/file.c.yy 2008-11-05 04:17:20.000000000 -0500
+++ nedit-5.6/source/file.c 2009-11-11 05:23:47.000000000 -0500
@@ -1914,7 +1914,7 @@
if (XmToggleButtonGetState(w)) {
XtPointer userData;
XtVaGetValues(w, XmNuserData, &userData, NULL);
- *(int*) clientData = (int) userData;
+ *(int*) clientData = (int)(long) userData;
}
}
--
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop