delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/19/22:10:30

From: "A. Sinan Unur" <asu1 AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Blitting warning under GRX 2.0 using GrBitBlt
Date: Sun, 19 Jan 1997 19:04:35 -0500
Organization: Cornell University http://www.cornell.edu
Lines: 46
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <32E2B693.3FD0@cornell.edu>
References: <5brjua$q1q AT news DOT interlog DOT com>
Reply-To: asu1 AT cornell DOT edu
NNTP-Posting-Host: cu-dialup-0010.cit.cornell.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019