Ver Fonte

libvips: improve patch (#5337)

star9029 há 10 meses atrás
pai
commit
944d0f0e20

+ 29 - 24
packages/l/libvips/patches/8.15.3/msvc-ssize_t.patch

@@ -1,32 +1,37 @@
+From a1f3bf3c98d21b09a75f57682cdb12a6e48ebb08 Mon Sep 17 00:00:00 2001
+From: Julianiolo <[email protected]>
+Date: Fri, 13 Sep 2024 21:31:02 +0200
+Subject: [PATCH] replace ssize_t with gint64
+
+---
+ libvips/iofuncs/generate.c | 2 +-
+ libvips/iofuncs/util.c     | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
 diff --git a/libvips/iofuncs/generate.c b/libvips/iofuncs/generate.c
-index bb3d1b2d7..8be7ad675 100644
+index bb3d1b2d7..8941762f7 100644
 --- a/libvips/iofuncs/generate.c
 +++ b/libvips/iofuncs/generate.c
-@@ -92,6 +92,11 @@
- #endif /*HAVE_CONFIG_H*/
- #include <glib/gi18n-lib.h>
+@@ -638,7 +638,7 @@ write_vips(VipsRegion *region, VipsRect *area, void *a)
+ 		// write() uses int not size_t on windows, so we need to chunk
+ 		// ... max 1gb, why not
+ 		int chunk_size = VIPS_MIN(1024 * 1024 * 1024, count);
+-		ssize_t nwritten = write(region->im->fd, buf, chunk_size);
++		gint64 nwritten = write(region->im->fd, buf, chunk_size);
  
-+#if defined(_MSC_VER)
-+#include <BaseTsd.h>
-+typedef SSIZE_T ssize_t;
-+#endif
-+
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdarg.h>
+ 		/* n == 0 isn't strictly an error, but we treat it as
+ 		 * one to make sure we don't get stuck in this loop.
 diff --git a/libvips/iofuncs/util.c b/libvips/iofuncs/util.c
-index 047516084..c2049c107 100644
+index 46976ef42..acf78ade8 100644
 --- a/libvips/iofuncs/util.c
 +++ b/libvips/iofuncs/util.c
-@@ -37,6 +37,11 @@
- #endif /*HAVE_CONFIG_H*/
- #include <glib/gi18n-lib.h>
+@@ -468,7 +468,7 @@ vips__write(int fd, const void *buf, size_t count)
+ 		// write() uses int not size_t on windows, so we need to chunk
+ 		// ... max 1gb, why not
+ 		int chunk_size = VIPS_MIN(1024 * 1024 * 1024, count);
+-		ssize_t nwritten = write(fd, buf, chunk_size);
++		gint64 nwritten = write(fd, buf, chunk_size);
+ 
+ 		/* n == 0 isn't strictly an error, but we treat it as
+ 		 * one to make sure we don't get stuck in this loop.
  
-+#if defined(_MSC_VER)
-+#include <BaseTsd.h>
-+typedef SSIZE_T ssize_t;
-+#endif
-+
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>

+ 1 - 1
packages/l/libvips/xmake.lua

@@ -10,7 +10,7 @@ package("libvips")
     add_versions("v8.15.2", "8c3ece7be367636fd676573a8ff22170c07e95e81fd94f2d1eb9966800522e1f")
     add_versions("v8.15.1", "5701445a076465a3402a135d13c0660d909beb8efc4f00fbbe82392e243497f2")
 
-    add_patches("8.15.3", "patches/8.15.3/msvc-ssize_t.patch", "d056a86735c4e05e164ca6fb27999bd98871e3b4de2fce0b792bf936d67ea658")
+    add_patches("8.15.3", "patches/8.15.3/msvc-ssize_t.patch", "1995af657dfd2f4e4f8edec685f67bd473537ff33c42d8329a0df0e0477408b9")
 
     add_configs("c++", { description = "Build C++ API", default = true, type = "boolean" })
     add_configs("deprecated", { description = "Build deprecated components", default = false, type = "boolean" })