diff options
-rwxr-xr-x | lxr-genxref | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lxr-genxref b/lxr-genxref index 782ad9f..599f202 100755 --- a/lxr-genxref +++ b/lxr-genxref @@ -280,16 +280,22 @@ sub reference_file($$$) { sub hash_file($$$) { my ($file, $fileid, $rels) = @_; - return 0 if - defined($context->config->{'search_size_limit'}) and + if (defined($context->config->{'search_size_limit'}) and $context->config->{'search_size_limit'} > 0 and - $file->size > $context->config->{'search_size_limit'}; + $file->size > $context->config->{'search_size_limit'}) + { + $index->to_hash($fileid); + $index->to_reference($fileid); + return 0; + } my $docid; if ($index->to_hash($fileid)) { my $handle; sysopen($handle, $file->phys_path, 0) || die($!); unless (-T $handle) { + # Non-text file. Mark as referenced as well. + $index->to_reference($fileid); $handle->close(); return 0; } @@ -323,7 +329,10 @@ sub hash_file($$$) { } else { $docid = $index->get_hashed_document($fileid); - return 0 unless $docid; + unless ($docid) { + $index->to_reference($fileid); + return 0; + } my $doc = $hash->get_document($docid); if (reference_file($file, $fileid, $doc)) { $hash->save_document($docid, $doc); |