Mail Archives: djgpp/1997/01/19/22:10:30
Gautam N. Lad wrote:
>
> Hi,
> I was pleased with Hartmut Schirmer's reply concerning
> getimage() / putimate() equivalent functions under GRX (blitting).
> Unfotrunately, since I like my compiles to be Warnings/Errors
> free, I have a problem. Here's the snippet I used that Harmut
> gave me (I filled in the variables for the x1,y1, and the width,height
> that are required for the size of the portion of the screen):
>
> /* Global variables */
> GrContext ic;
> char *memory[4]; /* 4 is magic */
> int planes, planesze, i;
>
> void GetBuf()
> {
> planes = GrNumPlanes();
> planesze = GrPlaneSize(400,175);
> for (i=0; i < planes; ++i)
> memory[i] = malloc(planesze);
> while (i<4) memory[i++] = NULL;
> GrCreateContext(420,195, memory, &ic);
> GrBitBlt(&ic, 0, 0, NULL, 190,170, 610,365, GrWRITE);
> }
>
> And here's the warning I get after compilation:
>
> tb.cpp: In function `void GetBuf()':
> tb.cpp:390: warning: ANSI C++ forbids implicit conversion from
> `void *' in assignment
>
> Any suggestions?
>
the message says it all, you need to cast the result of malloc to the
appropriate pointer type, i guess in this case it is char *.
sinan.
--
*******************************************************************
A. Sinan Unur WWWWWW
|--O+O
mailto:asu1 AT cornell DOT edu C ^
mailto:sinan AT econ DOT cit DOT cornell DOT edu \ ~/
http://www.bqnet.com/sinan/
*******************************************************************
- Raw text -