summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-04-05 00:16:49 +0100
committerDavid Laurence Emerson <dle3ab@angelbase.com>2013-05-28 00:42:51 -0700
commitdbbb2bd44cb5d96a693f78aa6fbc5ddc8aee8af5 (patch)
tree3513724c91d65f7f855e3d9d3e68a94e0bce1d2b
parentc1b355588ffdd76402e380e6006756fb585aca3f (diff)
downloadfpGUI-dbbb2bd44cb5d96a693f78aa6fbc5ddc8aee8af5.tar.xz
docview: simple pointer usage issues.
The program was overwriting the pointer itself, and not the location the pointer is pointing too. Simple mistake! :-/
-rw-r--r--docview/src/HelpBitmap.pas14
1 files changed, 9 insertions, 5 deletions
diff --git a/docview/src/HelpBitmap.pas b/docview/src/HelpBitmap.pas
index 0931ce82..eb2d9190 100644
--- a/docview/src/HelpBitmap.pas
+++ b/docview/src/HelpBitmap.pas
@@ -180,7 +180,7 @@ begin
if _Header.cBitCount <= 8 then
begin
_pPalette := GetMem( GetPaletteSize );
- bytes := FileHandle.Read(_pPalette, GetPaletteSize);
+ bytes := FileHandle.Read(_pPalette^, GetPaletteSize);
if bytes <> GetPaletteSize then
raise EHelpBitmapException.Create( 'Failed to read Palette.' );
end;
@@ -214,7 +214,7 @@ begin
// Now read the block
Block._Data := GetMem( Block._Size );
- FileHandle.Read(Block._Data, Block._Size);
+ FileHandle.Read(Block._Data^, Block._Size);
inc( BytesRead, Block._Size );
Blocks.Add( Block );
@@ -484,15 +484,19 @@ var
BitmapData: PBYTE;
ptr: PByte;
begin
+ BitmapOutputPointer := nil;
+ BitmapData := nil;
+ ptr := nil;
+
// Allocate memory to store the bitmap
Bitmapdata := GetMem( TotalSize );
// Copy header to bitmap
- MemCopy( _Header, BitmapData, sizeof( _Header ) );
+ MemCopy( _Header, BitmapData^, sizeof( _Header ) );
// Copy palette into bitmap
ptr := BitmapData + sizeof( _Header );
- MemCopy( _pPalette, ptr, GetPaletteSize );
+ MemCopy( _pPalette^, ptr^, GetPaletteSize );
BytesWritten := 0;
@@ -506,7 +510,7 @@ begin
case Block._CompressionType of
0,1: // uncompressed (I'm not sure about 1)
begin
- MemCopy( Block._Data, BitmapOutputPointer, Block._Size );
+ MemCopy( Block._Data^, BitmapOutputPointer^, Block._Size );
BytesWrittenFromBlock := Block._Size;
inc( BytesWritten, BytesWrittenFromBlock );
end;