From b3d7d47f10842faf2ad6205a5dfbe4b45660ec29 Mon Sep 17 00:00:00 2001 From: cage Date: Sun, 4 Aug 2024 13:59:50 +0200 Subject: [PATCH] - [GUI] prevented stack overflow (ensured TCO) when downloading a non gemini text file. --- src/gui/client/main-window.lisp | 4 ++++ src/software-configuration.lisp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/client/main-window.lisp b/src/gui/client/main-window.lisp index 0c12988..bf24725 100644 --- a/src/gui/client/main-window.lisp +++ b/src/gui/client/main-window.lisp @@ -1177,7 +1177,9 @@ local file paths." (wait-enough-data))) (defun slurp-non-text-data (main-window iri &key (try-to-open t)) + (declare (optimize (debug 0) (speed 3))) (labels ((wait-until-download-complete (stream-info support-file) + (declare (optimize (debug 0) (speed 3))) (if (string-equal (getf stream-info :stream-status) :completed) (if try-to-open @@ -1186,12 +1188,14 @@ local file paths." (getf stream-info :meta))) (wait-enough-data))) (buffer-filled-enough-to-open-p (buffer-size read-so-far) + (declare (optimize (debug 0) (speed 3))) (let ((filled-configuration-threshold (and buffer-size (> read-so-far buffer-size)))) (or filled-configuration-threshold (> read-so-far swconf:+buffer-minimum-size-to-open+)))) (wait-enough-data () + (declare (optimize (debug 0) (speed 3))) (let* ((stream-info (cev:enqueue-request-and-wait-results :gemini-stream-info 1 diff --git a/src/software-configuration.lisp b/src/software-configuration.lisp index 6c2a756..fd2595e 100644 --- a/src/software-configuration.lisp +++ b/src/software-configuration.lisp @@ -1282,7 +1282,7 @@ (defun link-regex->program-to-use-buffer-size (link) (when-let ((found (link-regex->program-to-use-parameters link))) - (buffer-size found))) + (buffer-size found))) (defun use-tinmop-as-external-program-p (program) (cl-ppcre:scan "(^me$)|(^internal$)|(tinmop)" program))