summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-04-06 17:07:52 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-04-06 17:07:52 +0200
commitb8cbc9f85d459d33243c9d564c01439a21b45f0b (patch)
treed2c67e953ca39433224f77ca11f3143ba42ee1e8
parente87b941b37c07ffa72367e3acafe84fa2cc80928 (diff)
downloadfpGUI-b8cbc9f85d459d33243c9d564c01439a21b45f0b.tar.xz
minor code improvements to docview's SearchTable unit.
-rw-r--r--docview/src/SearchTable.pas17
1 files changed, 14 insertions, 3 deletions
diff --git a/docview/src/SearchTable.pas b/docview/src/SearchTable.pas
index db682c54..079c4c94 100644
--- a/docview/src/SearchTable.pas
+++ b/docview/src/SearchTable.pas
@@ -229,7 +229,6 @@ var
pDataEnd: pointer;
Flags: uint8;
begin
- FillUInt32Array( Results, _TopicCount, 0 );
pWordRecord:= _Entries[ DictIndex ];
// Check search table format
@@ -250,13 +249,14 @@ begin
pDataEnd:= pWordRecord + RecordLen;
case CompressionCode of
0: // word not used anywhere.
- ;
+ ClearUInt32Array( Results, _TopicCount );
1: // used in all panels
FillUInt32Array( Results, _TopicCount, 1 );
2: // RLE
begin
+ ClearUInt32Array( Results, _TopicCount );
DoRLESearch( pData,
pDataEnd,
Results );
@@ -264,6 +264,7 @@ begin
3: // list of topics containing word
begin
+ ClearUInt32Array( Results, _TopicCount );
while pData < pDataEnd do
begin
TopicIndex:= pUInt16( pData )^;
@@ -285,10 +286,13 @@ begin
end;
5, // compressed by truncating bit stream at last byte containing a set bit.
- 6: // same as above but starting at non-zero byte
+ 6: // same as above but starting at non-zero byte (first word contains start topic)
begin
+ ClearUInt32Array( Results, _TopicCount );
if CompressionCode = 5 then
+ begin
TopicIndex:= 0
+ end
else
begin
TopicIndex:= pUInt16( pData )^ * 8;
@@ -305,6 +309,13 @@ begin
inc( pData );
end;
end;
+
+ else { unmatched case items }
+ begin
+// writeln('Unknown search method: Found no topic text match');
+ // unknown method
+ ClearUInt32Array( Results, _TopicCount );
+ end;
end;
end;