⛏️ index : haiku.git

author Humdinger <humdingerb@gmail.com> 2022-12-08 14:37:17.0 +01:00:00
committer waddlesplash <waddlesplash@gmail.com> 2022-12-08 20:39:58.0 +00:00:00
commit
cba5ecbbb4fddbd3a6a28e618ea62a72a140c4e2 [patch]
tree
ce8888b520e083b2d948fd3e4963c9fad5590dbe
parent
6bfa69ea26e88fb4bc8600e2ee908329017f94f9
download
cba5ecbbb4fddbd3a6a28e618ea62a72a140c4e2.tar.gz

Thumbnail: fix off-by-one of Height/Width attribute

Fixes #18128

Change-Id: I3abe72552657517acece101a1653b2f013b4f23f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5881
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
(cherry picked from commit d3811d00367caaabe90e0c20704b04f51aebd75d)
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5855

Diff

 src/kits/tracker/Thumbnails.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/kits/tracker/Thumbnails.cpp b/src/kits/tracker/Thumbnails.cpp
index 3e7d717..b246bce 100644
--- a/src/kits/tracker/Thumbnails.cpp
+++ b/src/kits/tracker/Thumbnails.cpp
@@ -200,12 +200,12 @@

	// write values to attributes
	bool thumbnailWritten = false;
	const int32 width = image->Bounds().IntegerWidth();
	const int32 width = image->Bounds().IntegerWidth() + 1;
	const size_t written = fFile->WriteAttr("Media:Width", B_INT32_TYPE,
		0, &width, sizeof(int32));
	if (written == sizeof(int32)) {
		// first attribute succeeded, write the rest
		const int32 height = image->Bounds().IntegerHeight();
		const int32 height = image->Bounds().IntegerHeight() + 1;
		fFile->WriteAttr("Media:Height", B_INT32_TYPE, 0, &height, sizeof(int32));

		// convert image into a 128x128 WebP image and stash it