bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61394: 30.0.50; [PATCH] Image-dired thumb name based on content


From: Manuel Giraud
Subject: bug#61394: 30.0.50; [PATCH] Image-dired thumb name based on content
Date: Fri, 10 Feb 2023 19:46:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Basil Contovounesios <contovob@tcd.ie> writes:

> Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" [2023-02-09 20:06 +0100] wrote:
>
>> +(defun image-dired-content-sha1 (filename)
>> +  "Compute the SHA-1 of a part of FILENAME."
>> +  (with-temp-buffer
>> +    (let ((file-size (file-attribute-size (file-attributes filename)))
>> +      (chunk-size 4096))
>> +      (insert-file-contents filename nil 0 (min chunk-size file-size))
>
> Can't we unconditionally pass END=chunk-size to insert-file-contents,
> even for smaller files?

>From fileio.c:4076, it seems that you are right:

--8<---------------cut here---------------start------------->8---
      /* The likely offset where we will stop reading.  We could read
         more (or less), if the file grows (or shrinks) as we read it.  */
      off_t likely_end = min (end_offset, st.st_size);
--8<---------------cut here---------------end--------------->8---

So here is an update version of this patch.  I've tested it on small 400
bytes icons and it works also.

Attachment: 0001-Image-dired-thumb-name-based-on-content.patch
Description: Text Data

Thanks,
-- 
Manuel Giraud

reply via email to

[Prev in Thread] Current Thread [Next in Thread]