diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2013-04-05 00:16:49 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2013-04-05 00:16:49 +0100 |
commit | 5a2f413b691379d24f2ec8158d5de9cbf627547d (patch) | |
tree | 130b7ae60bfca89bd3529c8b92595d9401359d14 /docview/src | |
parent | 1c6b5d4b9f14adc892492b0201eafb2fb09b88ef (diff) | |
download | fpGUI-5a2f413b691379d24f2ec8158d5de9cbf627547d.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! :-/
Diffstat (limited to 'docview/src')
-rw-r--r-- | docview/src/HelpBitmap.pas | 14 |
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; |