~mcf/oasis

b7fa94c171d8ab43cf78d40acf2f2d468a465026 — Michael Forney 1 year, 7 months ago d8f6cfa
transmission: Fix overflow in previous patch
M pkg/transmission/patch/0002-Choose-larger-pieces-for-larger-sizes.patch => pkg/transmission/patch/0002-Choose-larger-pieces-for-larger-sizes.patch +15 -9
@@ 1,20 1,27 @@
From 4c111db979c3bec7496bdb856d3819591d5d85c6 Mon Sep 17 00:00:00 2001
From ed525431bbe23d61c4c8dd4664c13bc19b4db889 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Mon, 24 Apr 2023 21:09:06 -0700
Subject: [PATCH] Choose larger pieces for larger sizes

---
 libtransmission/makemeta.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 libtransmission/makemeta.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/libtransmission/makemeta.c b/libtransmission/makemeta.c
index 713f3e5cb..0ebb6d720 100644
index 713f3e5cb..ae422395d 100644
--- a/libtransmission/makemeta.c
+++ b/libtransmission/makemeta.c
@@ -92,6 +92,21 @@ static uint32_t bestPieceSize(uint64_t totalSize)
     uint32_t const MiB = 1048576;
     uint32_t const GiB = 1073741824;
@@ -88,9 +88,24 @@ static struct FileList* getFiles(char const* dir, char const* base, struct FileL
 
 static uint32_t bestPieceSize(uint64_t totalSize)
 {
-    uint32_t const KiB = 1024;
-    uint32_t const MiB = 1048576;
-    uint32_t const GiB = 1073741824;
+    uint64_t const KiB = 1024;
+    uint64_t const MiB = 1048576;
+    uint64_t const GiB = 1073741824;
+
+    if (totalSize >= 16 * GiB)
+    {
+        return 16 * MiB;


@@ 29,10 36,9 @@ index 713f3e5cb..0ebb6d720 100644
+    {
+        return 4 * MiB;
+    }
+
 
     if (totalSize >= 2 * GiB)
     {
         return 2 * MiB;
-- 
2.37.3


M pkg/transmission/ver => pkg/transmission/ver +1 -1
@@ 1,1 1,1 @@
3.00 r1
3.00 r2