From b573020a72b108364df42018135bb1295b3082c8 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Mon, 4 Mar 2024 22:06:10 +0100 Subject: max file size setting --- src/search.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/search.cpp') diff --git a/src/search.cpp b/src/search.cpp index 82ffc64..1e7241c 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -311,7 +311,9 @@ keep_going:; int read_cursor = new_result->file_list_read_cursor+1; if (read_cursor >= new_result->files.length) { ts_mutex_unlock(&new_result->files.mutex); - continue; + + if (!new_result->done_finding_files) continue; + else break; } new_result->file_count++; new_result->file_list_read_cursor++; @@ -320,7 +322,14 @@ keep_going:; ts_found_file *f = *(ts_found_file **)ts_array_at(&new_result->files, read_cursor); ts_file_content content = ts_platform_read_file(f->path, "rb, ccs=UTF-8"); - _ts_search_file(f, content, new_result); + if (content.file_error != FILE_ERROR_NONE) { + f->error = content.file_error; + } + if (content.content_length > megabytes(new_result->max_file_size)) { + f->error = FILE_ERROR_TOO_BIG; + } + + if (f->error == FILE_ERROR_NONE) _ts_search_file(f, content, new_result); free(content.content); } -- cgit v1.2.3-70-g09d2