Changeset 325


Ignore:
Timestamp:
Aug 16, 2008, 6:07:02 PM (17 years ago)
Author:
RBRi
Message:

#37 fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.19_branch/NewView/HelpFile.pas

    r307 r325  
    373373  pEntry: pTTOCEntryStart;
    374374  pEnd: pTTOCEntryStart;
     375  tmpSizeAsLongword : longword;
    375376begin
    376377  LogEvent(LogParse, 'Read contents');
    377378
    378379  if _pHeader^.ntoc = 0 then
     380  begin
    379381    exit; // explicit check required since ntoc is unsigned
     382  end;
    380383
    381384  // Presize the topics list to save reallocation time
    382385  _Topics.Capacity := _pHeader^.ntoc;
     386
     387  // this has to be used because we multiply a longword with
     388  // this; otherwise the compiler generates code that
     389  // calculates the wrong value
     390  tmpSizeAsLongword := sizeof(uint32);
    383391
    384392  // read slots first so that Topics can refer to it.
    385393  ReadFileBlock( _pSlotOffsets,
    386394                 _pHeader^.slotsstart,
    387                  _pHeader^.nslots * sizeof( uint32 ) );
     395                 _pHeader^.nslots *  tmpSizeAsLongword);
    388396
    389397  ReadFileBlock( _pContentsData,
     
    496504  begin
    497505    if p >= pEnd then
     506    begin
    498507      // ran off end of data
    499508      raise EHelpFileException.Create( ErrorCorruptHelpFile );
     509    end;
    500510
    501511    pEntryHeader := p;
     
    505515    GetMemString( p, EntryText, IndexTitleLen );
    506516    if ( pEntryHeader^.flags and 2 ) > 0 then
     517    begin
    507518      EntryText := '- ' + EntryText;
     519    end;
    508520    if pEntryHeader^.TOCIndex < _Topics.Count then
    509521      _Index.AddObject( EntryText, _Topics[ pEntryHeader^.TOCIndex ] )
Note: See TracChangeset for help on using the changeset viewer.