[PATCH] Compilation break without cast.

Alan Coopersmith alan.coopersmith at oracle.com
Sat Jan 3 14:22:53 PST 2015


The code is currently correct C99, which is what the Xorg code is written in.
This patch is only needed for forks like TigerVNC which use this code in C++
programs.  I don't mind accepting small patches like this, especially since I
made the exact same patch to the Solaris packages so we can build TigerVNC,
but we're not going to guarantee our C code will always be portable to C++.

Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

	-alan-

On 12/30/14 04:37 AM, helio at kde.org wrote:
> From: Helio Chissini de Castro <helio at kde.org>
>
> Missing cast break compilation when base code used for third party
> applications, like tigervnc.
> Usage of -fpermissive solves compilation issue but can mask the problem.
> Red Hat bug https://bugzilla.redhat.com/show_bug.cgi?id=1177687
>
> Signed-off-by: Helio Chissini de Castro <helio at kde.org>
> ---
>   include/regionstr.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/regionstr.h b/include/regionstr.h
> index 079375d..1032358 100644
> --- a/include/regionstr.h
> +++ b/include/regionstr.h
> @@ -144,7 +144,7 @@ RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size)
>           size_t rgnSize;
>           (_pReg)->extents = RegionEmptyBox;
>           if (((_size) > 1) && ((rgnSize = RegionSizeof(_size)) > 0) &&
> -            (((_pReg)->data = malloc(rgnSize)) != NULL)) {
> +            (((_pReg)->data = (RegDataPtr) malloc(rgnSize)) != NULL)) {
>               (_pReg)->data->size = (_size);
>               (_pReg)->data->numRects = 0;
>           }
>


-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list