Page 1 of 1

Delphi XE2 Update2: DCC Warning in TeCanvas.pas

Posted: Wed Nov 23, 2011 11:20 am
by 16560356
Hello

When compiling the new version (2011.04.41118) in Win32-bit mode I get a warning in TeCanvas.pas
Could you remove this warning in the next release?

Best regards
Tom

Code: Select all

[DCC Warning] VCLTee.TeCanvas.pas(7623): W1036 Variable 'tmpRes' might not have been initialized
It is on the line 'Assert(tmpRes,'Error transferring internal Bitmap using BitBlt');' in this code:

Code: Select all

Procedure TTeeCanvas3D.TransferBitmap(ALeft,ATop:Integer; ACanvas:TCanvas);
{$IFNDEF FMX}
{$IFOPT C+}
var tmpRes : LongBool;
{$ENDIF}
{$ENDIF}
begin
  {$IFNDEF CLX}

  {$IFDEF MONITOR_REPAINTS}
  Inc(TeeMonitor);
  FBitmap.Canvas.TextOut(0,0,IntToStr(TeeMonitor));
  {$ENDIF}

//  Assert(FBitmap.PixelFormat=pfDevice,'Buffer Bitmap PixelFormat <> pfDevice');

  {$IFDEF LCL}
  ACanvas.Draw(ALeft, ATop, FBitmap);
  {$ELSE}

  {$IFDEF FMX}
  {$ELSE}

  if View3DOptions.Parent.Parent<>nil then
  {$IFOPT C+}
  tmpRes:=
  {$ENDIF}
  BitBlt( ACanvas.Handle,ALeft,ATop,
          FBitmap.Width,
          FBitmap.Height,
          FBitmap.Canvas.Handle,0,0,SRCCOPY);

  {$IFOPT C+}
  {$IFNDEF TEEOCX}
  Assert(tmpRes,'Error transferring internal Bitmap using BitBlt');
  {$ENDIF}
  {$ENDIF}
  {$ENDIF}
  {$ENDIF}

  {$ELSE}
  QPainter_drawPixmap(ACanvas.Handle, ALeft, ATop, FBitmap.Handle, 0, 0,
    FBitmap.Width, FBitmap.Height);
  {$ENDIF}
end;

Re: Delphi XE2 Update2: DCC Warning in TeCanvas.pas

Posted: Thu Nov 24, 2011 8:19 am
by yeray
Hi Tom,

Yes, we are aware of this warning. As you've probably seen looking at the conditions, this variable won't be used without being defined. But anyway, we'll try to clean the warning messages in future releases.

Re: Delphi XE2 Update2: DCC Warning in TeCanvas.pas

Posted: Fri Nov 25, 2011 7:05 am
by 16560356
Hi Yeray,
But anyway, we'll try to clean the warning messages in future releases.
thank you.

In the mean time I suppress the warning by adding the following code at the beginning of the method:

Code: Select all

...
begin
  {$IFNDEF CLX}
// changes start
  {$IFOPT C+}
  tmpRes:= False;
  {$ENDIF}
// changes end
  ...
Best regards
Tom