pkgsrc-Changes archive

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

CVS commit: pkgsrc/devel/libmtp



Module Name:    pkgsrc
Committed By:   nia
Date:           Fri Dec 19 11:00:46 UTC 2025

Modified Files:
        pkgsrc/devel/libmtp: distinfo
Added Files:
        pkgsrc/devel/libmtp/patches: patch-examples_pathutils.c
            patch-src_ptp-pack.c patch-src_unicode.c

Log Message:
libmtp: Fix code problems revealed by recent gcc.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 pkgsrc/devel/libmtp/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/devel/libmtp/patches/patch-examples_pathutils.c \
    pkgsrc/devel/libmtp/patches/patch-src_ptp-pack.c \
    pkgsrc/devel/libmtp/patches/patch-src_unicode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/devel/libmtp/distinfo
diff -u pkgsrc/devel/libmtp/distinfo:1.19 pkgsrc/devel/libmtp/distinfo:1.20
--- pkgsrc/devel/libmtp/distinfo:1.19   Fri Aug  9 14:15:59 2024
+++ pkgsrc/devel/libmtp/distinfo        Fri Dec 19 11:00:45 2025
@@ -1,10 +1,13 @@
-$NetBSD: distinfo,v 1.19 2024/08/09 14:15:59 ryoon Exp $
+$NetBSD: distinfo,v 1.20 2025/12/19 11:00:45 nia Exp $
 
 BLAKE2s (libmtp-1.1.21.tar.gz) = 53c04b94294f26300d1e2d9e33365fa21148bc1885b7ac863492723a6a4ef350
 SHA512 (libmtp-1.1.21.tar.gz) = 510f01f75de37a07c8ce54957a8fb74724538a7cfbdf1a86c201fda68573ef23fa578ff7baf2d9df938703b5776ded4ab1057c617125f3539e594bb5a1f3146f
 Size (libmtp-1.1.21.tar.gz) = 862703 bytes
 SHA1 (patch-configure) = f57b708684696e496b1d61783e48fe4b63618d65
+SHA1 (patch-examples_pathutils.c) = 6ecbcbb6c7899b49a1dea000be3691ade9a94d68
 SHA1 (patch-hotplug.sh.in) = 72216bb36bd0f6274c16c09d121fcffb567ab120
 SHA1 (patch-m4_byteorder.m4) = e6c1170d9099f13c637b3a73d67618d318c7a73d
 SHA1 (patch-src_libusb1-glue.c) = 2c83f2436a7cbc27c8b03f8d22db9bb446f55446
+SHA1 (patch-src_ptp-pack.c) = 7657d7f5b707c644bb5599f31c0d2c395d43d893
+SHA1 (patch-src_unicode.c) = c38b2070e39e6df088c7e9ec7c3a723e0fcc87ed
 SHA1 (patch-src_util.c) = f7be6760014323dc2b159e1e44f94e40d96f26d0

Added files:

Index: pkgsrc/devel/libmtp/patches/patch-examples_pathutils.c
diff -u /dev/null pkgsrc/devel/libmtp/patches/patch-examples_pathutils.c:1.1
--- /dev/null   Fri Dec 19 11:00:46 2025
+++ pkgsrc/devel/libmtp/patches/patch-examples_pathutils.c      Fri Dec 19 11:00:46 2025
@@ -0,0 +1,14 @@
+$NetBSD: patch-examples_pathutils.c,v 1.1 2025/12/19 11:00:46 nia Exp $
+
+Include <strings.h> for rindex(3).
+
+--- examples/pathutils.c.orig  2025-12-19 10:32:25.953254312 +0000
++++ examples/pathutils.c
+@@ -24,6 +24,7 @@
+ #include <stdlib.h>
+ #include <limits.h>
+ #include <string.h>
++#include <strings.h>
+ #include <libgen.h>
+ 
+ /* Find the folder_id of a given path
Index: pkgsrc/devel/libmtp/patches/patch-src_ptp-pack.c
diff -u /dev/null pkgsrc/devel/libmtp/patches/patch-src_ptp-pack.c:1.1
--- /dev/null   Fri Dec 19 11:00:46 2025
+++ pkgsrc/devel/libmtp/patches/patch-src_ptp-pack.c    Fri Dec 19 11:00:46 2025
@@ -0,0 +1,51 @@
+$NetBSD: patch-src_ptp-pack.c,v 1.1 2025/12/19 11:00:46 nia Exp $
+
+Support non-POSIX iconv in SunOS and old NetBSD.
+
+--- src/ptp-pack.c.orig        2025-12-19 10:49:45.060422671 +0000
++++ src/ptp-pack.c
+@@ -34,6 +34,15 @@
+ #include <iconv.h>
+ #endif
+ 
++#if defined(__NetBSD__)
++#include <sys/param.h>
++#if __NetBSD_Prereq__(9,99,17)
++#define NETBSD_POSIX_ICONV 1
++#else
++#define NETBSD_POSIX_ICONV 0
++#endif
++#endif
++
+ static inline uint16_t
+ htod16p (PTPParams *params, uint16_t var)
+ {
+@@ -174,9 +183,14 @@ ptp_unpack_string(PTPParams *params, unsigned char* da
+       destlen = sizeof(loclstr)-1;
+       nconv = (size_t)-1;
+ #if defined(HAVE_ICONV) && defined(HAVE_LANGINFO_H)
++#if (defined(__NetBSD__) && !NETBSD_POSIX_ICONV) || defined(__sun)
+       if (params->cd_ucs2_to_locale != (iconv_t)-1)
++              nconv = iconv(params->cd_ucs2_to_locale, (const char **)&src, &srclen, &dest, &destlen);
++#else
++      if (params->cd_ucs2_to_locale != (iconv_t)-1)
+               nconv = iconv(params->cd_ucs2_to_locale, &src, &srclen, &dest, &destlen);
+ #endif
++#endif
+       if (nconv == (size_t) -1) { /* do it the hard way */
+               int i;
+               /* try the old way, in case iconv is broken */
+@@ -224,8 +238,13 @@ ptp_pack_string(PTPParams *params, char *string, unsig
+               size_t convmax = PTP_MAXSTRLEN * 2; /* Includes the terminator */
+               char *stringp = string;
+ 
++#if (defined(__NetBSD__) && !NETBSD_POSIX_ICONV) || defined(__sun)
++              nconv = iconv(params->cd_locale_to_ucs2, (const char **)&stringp, &convlen,
++                      &ucs2strp, &convmax);
++#else
+               nconv = iconv(params->cd_locale_to_ucs2, &stringp, &convlen,
+                       &ucs2strp, &convmax);
++#endif
+               if (nconv == (size_t) -1)
+                       ucs2str[0] = 0x0000U;
+       } else
Index: pkgsrc/devel/libmtp/patches/patch-src_unicode.c
diff -u /dev/null pkgsrc/devel/libmtp/patches/patch-src_unicode.c:1.1
--- /dev/null   Fri Dec 19 11:00:46 2025
+++ pkgsrc/devel/libmtp/patches/patch-src_unicode.c     Fri Dec 19 11:00:46 2025
@@ -0,0 +1,46 @@
+$NetBSD: patch-src_unicode.c,v 1.1 2025/12/19 11:00:46 nia Exp $
+
+Support non-POSIX iconv in SunOS and old NetBSD.
+
+--- src/unicode.c.orig 2025-12-19 10:50:53.932872746 +0000
++++ src/unicode.c
+@@ -41,6 +41,15 @@
+ #include "util.h"
+ #include "ptp.h"
+ 
++#if defined(__NetBSD__)
++#include <sys/param.h>
++#if __NetBSD_Prereq__(9,99,17)
++#define NETBSD_POSIX_ICONV 1
++#else
++#define NETBSD_POSIX_ICONV 0
++#endif
++#endif
++
+ /**
+  * The size of the buffer (in characters) used for creating string copies.
+  */
+@@ -81,7 +90,11 @@ char *utf16_to_utf8(LIBMTP_mtpdevice_t *device, const 
+   loclstr[0]='\0';
+   #if defined(HAVE_ICONV) && defined(HAVE_LANGINFO_H)
+   PTPParams *params = (PTPParams *) device->params;
++#if (defined(__NetBSD__) && !NETBSD_POSIX_ICONV) || defined(__sun)
++  const char *stringp = (const char *) unicstr;
++#else
+   char *stringp = (char *) unicstr;
++#endif
+   char *locp = loclstr;
+   size_t nconv;
+   size_t convlen = (ucs2_strlen(unicstr)+1) * sizeof(uint16_t); // UCS-2 is 16 bit wide, include terminator
+@@ -120,7 +133,11 @@ uint16_t *utf8_to_utf16(LIBMTP_mtpdevice_t *device, co
+ 
+   #if defined(HAVE_ICONV) && defined(HAVE_LANGINFO_H)
+   PTPParams *params = (PTPParams *) device->params;
++#if (defined(__NetBSD__) && !NETBSD_POSIX_ICONV) || defined(__sun)
++  const char *stringp = (const char *) localstr;
++#else
+   char *stringp = (char *) localstr; // cast away "const"
++#endif
+   size_t convlen = strlen(localstr)+1; // utf8 bytes, include terminator
+   size_t convmax = STRING_BUFFER_LENGTH*2;
+   /* Do the conversion.  */



Home | Main Index | Thread Index | Old Index