mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-13 23:30:04 +02:00
695 lines
20 KiB
Plaintext
695 lines
20 KiB
Plaintext
From 3014ad83f4bc3bb56a0273c4b397b5496370535a Mon Sep 17 00:00:00 2001
|
|
From: Robert Kausch <robert.kausch@freac.org>
|
|
Date: Thu, 13 Oct 2022 00:05:46 +0000
|
|
Subject: gcc2 fixes
|
|
|
|
|
|
diff --git a/srclib/canonicalize-lgpl.c b/srclib/canonicalize-lgpl.c
|
|
index efd79ce..b8566d5 100644
|
|
--- a/srclib/canonicalize-lgpl.c
|
|
+++ b/srclib/canonicalize-lgpl.c
|
|
@@ -195,6 +195,10 @@ realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs)
|
|
char const *start;
|
|
char const *end;
|
|
int num_links = 0;
|
|
+ char *rname = bufs->rname.data;
|
|
+ bool end_in_extra_buffer = false;
|
|
+ bool failed = true;
|
|
+ idx_t prefix_len;
|
|
|
|
if (name == NULL)
|
|
{
|
|
@@ -214,13 +218,9 @@ realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs)
|
|
return NULL;
|
|
}
|
|
|
|
- char *rname = bufs->rname.data;
|
|
- bool end_in_extra_buffer = false;
|
|
- bool failed = true;
|
|
-
|
|
/* This is always zero for Posix hosts, but can be 2 for MS-Windows
|
|
and MS-DOS X:/foo/bar file names. */
|
|
- idx_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
|
|
+ prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
|
|
|
|
if (!IS_ABSOLUTE_FILE_NAME (name))
|
|
{
|
|
@@ -255,6 +255,7 @@ realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs)
|
|
|
|
for ( ; *start; start = end)
|
|
{
|
|
+ idx_t startlen;
|
|
/* Skip sequence of multiple file name separators. */
|
|
while (ISSLASH (*start))
|
|
++start;
|
|
@@ -265,7 +266,7 @@ realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs)
|
|
|
|
/* Length of this file name component; it can be zero if a file
|
|
name ends in '/'. */
|
|
- idx_t startlen = end - start;
|
|
+ startlen = end - start;
|
|
|
|
if (startlen == 0)
|
|
break;
|
|
@@ -299,13 +300,13 @@ realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs)
|
|
|
|
dest = __mempcpy (dest, start, startlen);
|
|
*dest = '\0';
|
|
-
|
|
+ {
|
|
char *buf;
|
|
ssize_t n;
|
|
while (true)
|
|
{
|
|
- buf = bufs->link.data;
|
|
idx_t bufsize = bufs->link.length;
|
|
+ buf = bufs->link.data;
|
|
n = __readlink (rname, buf, bufsize - 1);
|
|
if (n < bufsize - 1)
|
|
break;
|
|
@@ -314,6 +315,9 @@ realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs)
|
|
}
|
|
if (0 <= n)
|
|
{
|
|
+ char *extra_buf = bufs->extra.data;
|
|
+ idx_t end_idx IF_LINT (= 0);
|
|
+ size_t len;
|
|
if (++num_links > __eloop_threshold ())
|
|
{
|
|
__set_errno (ELOOP);
|
|
@@ -322,11 +326,9 @@ realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs)
|
|
|
|
buf[n] = '\0';
|
|
|
|
- char *extra_buf = bufs->extra.data;
|
|
- idx_t end_idx IF_LINT (= 0);
|
|
if (end_in_extra_buffer)
|
|
end_idx = end - extra_buf;
|
|
- size_t len = strlen (end);
|
|
+ len = strlen (end);
|
|
if (INT_ADD_OVERFLOW (len, n))
|
|
{
|
|
__set_errno (ENOMEM);
|
|
@@ -377,6 +379,7 @@ realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs)
|
|
? dir_check (rname, dest)
|
|
: errno == EINVAL))
|
|
goto error;
|
|
+ }
|
|
}
|
|
}
|
|
if (dest > rname + prefix_len + 1 && ISSLASH (dest[-1]))
|
|
diff --git a/srclib/careadlinkat.c b/srclib/careadlinkat.c
|
|
index f308b69..d4a958e 100644
|
|
--- a/srclib/careadlinkat.c
|
|
+++ b/srclib/careadlinkat.c
|
|
@@ -74,7 +74,7 @@ readlink_stk (int fd, char const *filename,
|
|
buffer = stack_buf;
|
|
buffer_size = STACK_BUF_SIZE;
|
|
}
|
|
-
|
|
+ {
|
|
char *buf = buffer;
|
|
idx_t buf_size_max = MIN (IDX_MAX, MIN (SSIZE_MAX, SIZE_MAX));
|
|
idx_t buf_size = MIN (buffer_size, buf_size_max);
|
|
@@ -83,6 +83,7 @@ readlink_stk (int fd, char const *filename,
|
|
{
|
|
/* Attempt to read the link into the current buffer. */
|
|
idx_t link_length = preadlinkat (fd, filename, buf, buf_size);
|
|
+ idx_t link_size = link_length;
|
|
if (link_length < 0)
|
|
{
|
|
if (buf != buffer)
|
|
@@ -94,8 +95,6 @@ readlink_stk (int fd, char const *filename,
|
|
return NULL;
|
|
}
|
|
|
|
- idx_t link_size = link_length;
|
|
-
|
|
if (link_size < buf_size)
|
|
{
|
|
buf[link_size++] = '\0';
|
|
@@ -135,6 +134,7 @@ readlink_stk (int fd, char const *filename,
|
|
|
|
if (alloc->die)
|
|
alloc->die (buf_size);
|
|
+ }
|
|
errno = ENOMEM;
|
|
return NULL;
|
|
}
|
|
diff --git a/srclib/malloc.c b/srclib/malloc.c
|
|
index 045ff82..ac34963 100644
|
|
--- a/srclib/malloc.c
|
|
+++ b/srclib/malloc.c
|
|
@@ -31,6 +31,7 @@
|
|
void *
|
|
rpl_malloc (size_t n)
|
|
{
|
|
+ void *result;
|
|
#if !HAVE_MALLOC_0_NONNULL
|
|
if (n == 0)
|
|
n = 1;
|
|
@@ -45,7 +46,7 @@ rpl_malloc (size_t n)
|
|
}
|
|
#endif
|
|
|
|
- void *result = malloc (n);
|
|
+ result = malloc (n);
|
|
|
|
#if !HAVE_MALLOC_POSIX
|
|
if (result == NULL)
|
|
diff --git a/srclib/malloc/scratch_buffer_set_array_size.c b/srclib/malloc/scratch_buffer_set_array_size.c
|
|
index 0582bef..65a2945 100644
|
|
--- a/srclib/malloc/scratch_buffer_set_array_size.c
|
|
+++ b/srclib/malloc/scratch_buffer_set_array_size.c
|
|
@@ -29,6 +29,7 @@ __libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer,
|
|
size_t nelem, size_t size)
|
|
{
|
|
size_t new_length = nelem * size;
|
|
+ char *new_ptr;
|
|
|
|
/* Avoid overflow check if both values are small. */
|
|
if ((nelem | size) >> (sizeof (size_t) * CHAR_BIT / 2) != 0
|
|
@@ -48,7 +49,7 @@ __libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer,
|
|
/* Discard old buffer. */
|
|
scratch_buffer_free (buffer);
|
|
|
|
- char *new_ptr = malloc (new_length);
|
|
+ new_ptr = malloc (new_length);
|
|
if (new_ptr == NULL)
|
|
{
|
|
/* Buffer must remain valid to free. */
|
|
diff --git a/srclib/malloca.c b/srclib/malloca.c
|
|
index 2219459..5a031db 100644
|
|
--- a/srclib/malloca.c
|
|
+++ b/srclib/malloca.c
|
|
@@ -68,16 +68,19 @@ mmalloca (size_t n)
|
|
/* The ckd_add avoids signed integer overflow on
|
|
theoretical platforms where UINTPTR_MAX <= INT_MAX. */
|
|
uintptr_t umemplus;
|
|
+ idx_t offset;
|
|
+ void *p;
|
|
+ small_t *sp;
|
|
ckd_add (&umemplus, umem, sizeof (small_t) + sa_alignment_max - 1);
|
|
- idx_t offset = (umemplus - umemplus % (2 * sa_alignment_max)
|
|
+ offset = (umemplus - umemplus % (2 * sa_alignment_max)
|
|
+ sa_alignment_max - umem);
|
|
- void *p = mem + offset;
|
|
+ p = mem + offset;
|
|
/* Here p >= mem + sizeof (small_t),
|
|
and p <= mem + sizeof (small_t) + 2 * sa_alignment_max - 1
|
|
hence p + n <= mem + nplus.
|
|
So, the memory range [p, p+n) lies in the allocated memory range
|
|
[mem, mem + nplus). */
|
|
- small_t *sp = p;
|
|
+ sp = p;
|
|
# if defined __CHERI_PURE_CAPABILITY__
|
|
sp[-1] = umem;
|
|
p = (char *) cheri_bounds_set ((char *) p - sizeof (small_t),
|
|
diff --git a/srclib/rawmemchr.c b/srclib/rawmemchr.c
|
|
index 013e7f8..30aa8ce 100644
|
|
--- a/srclib/rawmemchr.c
|
|
+++ b/srclib/rawmemchr.c
|
|
@@ -43,11 +43,16 @@ rawmemchr (const void *s, int c_in)
|
|
|
|
/* You can change this typedef to experiment with performance. */
|
|
typedef uintptr_t longword;
|
|
- /* Verify that the longword type lacks padding bits. */
|
|
- static_assert (UINTPTR_WIDTH == UCHAR_WIDTH * sizeof (uintptr_t));
|
|
|
|
const unsigned char *char_ptr;
|
|
unsigned char c = c_in;
|
|
+ longword const *longword_ptr;
|
|
+ longword repeated_one;
|
|
+ longword repeated_c;
|
|
+ longword repeated_hibit;
|
|
+
|
|
+ /* Verify that the longword type lacks padding bits. */
|
|
+ static_assert (UINTPTR_WIDTH == UCHAR_WIDTH * sizeof (uintptr_t));
|
|
|
|
/* Handle the first few bytes by reading one byte at a time.
|
|
Do this until CHAR_PTR is aligned on a natural longword boundary,
|
|
@@ -58,14 +63,14 @@ rawmemchr (const void *s, int c_in)
|
|
if (*char_ptr == c)
|
|
return (void *) char_ptr;
|
|
|
|
- longword const *longword_ptr = s = char_ptr;
|
|
+ longword_ptr = s = char_ptr;
|
|
|
|
/* Compute auxiliary longword values:
|
|
repeated_one is a value which has a 1 in every byte.
|
|
repeated_c has c in every byte. */
|
|
- longword repeated_one = (longword) -1 / UCHAR_MAX;
|
|
- longword repeated_c = repeated_one * c;
|
|
- longword repeated_hibit = repeated_one * (UCHAR_MAX / 2 + 1);
|
|
+ repeated_one = (longword) -1 / UCHAR_MAX;
|
|
+ repeated_c = repeated_one * c;
|
|
+ repeated_hibit = repeated_one * (UCHAR_MAX / 2 + 1);
|
|
|
|
/* Instead of the traditional loop which tests each byte, we will
|
|
test a longword at a time. The tricky part is testing if any of
|
|
diff --git a/srclib/readlink.c b/srclib/readlink.c
|
|
index f4af30e..68c45e1 100644
|
|
--- a/srclib/readlink.c
|
|
+++ b/srclib/readlink.c
|
|
@@ -55,6 +55,7 @@ rpl_readlink (char const *file, char *buf, size_t bufsize)
|
|
{
|
|
# if READLINK_TRAILING_SLASH_BUG
|
|
size_t file_len = strlen (file);
|
|
+ ssize_t r;
|
|
if (file_len && file[file_len - 1] == '/')
|
|
{
|
|
/* Even if FILE without the slash is a symlink to a directory,
|
|
@@ -69,7 +70,7 @@ rpl_readlink (char const *file, char *buf, size_t bufsize)
|
|
}
|
|
# endif /* READLINK_TRAILING_SLASH_BUG */
|
|
|
|
- ssize_t r = readlink (file, buf, bufsize);
|
|
+ r = readlink (file, buf, bufsize);
|
|
|
|
# if READLINK_TRUNCATE_BUG
|
|
if (r < 0 && errno == ERANGE)
|
|
diff --git a/srclib/realloc.c b/srclib/realloc.c
|
|
index 5804474..2946a2a 100644
|
|
--- a/srclib/realloc.c
|
|
+++ b/srclib/realloc.c
|
|
@@ -42,6 +42,7 @@ void *
|
|
rpl_realloc (void *p, size_t n)
|
|
{
|
|
size_t n1 = n;
|
|
+ void *result;
|
|
|
|
if (n == 0)
|
|
{
|
|
@@ -92,7 +93,7 @@ rpl_realloc (void *p, size_t n)
|
|
}
|
|
# endif
|
|
|
|
- void *result = realloc (p, n1);
|
|
+ result = realloc (p, n1);
|
|
|
|
# if !HAVE_MALLOC_POSIX
|
|
if (result == NULL)
|
|
--
|
|
2.48.1
|
|
|
|
|
|
From ccc18143b306cdf8161357b5b45279a8cb0f3ed8 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
|
|
Date: Thu, 19 Jun 2025 17:28:15 +0200
|
|
Subject: more gcc2 fixes
|
|
|
|
|
|
diff --git a/lib/ebcdic1132.h b/lib/ebcdic1132.h
|
|
index 7c53dbb..7a3365f 100644
|
|
--- a/lib/ebcdic1132.h
|
|
+++ b/lib/ebcdic1132.h
|
|
@@ -76,9 +76,10 @@ static int
|
|
ebcdic1132_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
|
|
{
|
|
unsigned char c = *s;
|
|
+ unsigned short wc;
|
|
if (conv->isurface & ICONV_SURFACE_EBCDIC_ZOS_UNIX)
|
|
c = swap_x15_x25 (c);
|
|
- unsigned short wc = ebcdic1132_2uni[c];
|
|
+ wc = ebcdic1132_2uni[c];
|
|
if (wc != 0xfffd) {
|
|
*pwc = (ucs4_t) wc;
|
|
return 1;
|
|
diff --git a/lib/ebcdic1137.h b/lib/ebcdic1137.h
|
|
index b4b7374..03fdcc2 100644
|
|
--- a/lib/ebcdic1137.h
|
|
+++ b/lib/ebcdic1137.h
|
|
@@ -76,9 +76,10 @@ static int
|
|
ebcdic1137_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
|
|
{
|
|
unsigned char c = *s;
|
|
+ unsigned short wc;
|
|
if (conv->isurface & ICONV_SURFACE_EBCDIC_ZOS_UNIX)
|
|
c = swap_x15_x25 (c);
|
|
- unsigned short wc = ebcdic1137_2uni[c];
|
|
+ wc = ebcdic1137_2uni[c];
|
|
if (wc != 0xfffd) {
|
|
*pwc = (ucs4_t) wc;
|
|
return 1;
|
|
diff --git a/lib/ebcdic12712.h b/lib/ebcdic12712.h
|
|
index e7a5650..0879e4b 100644
|
|
--- a/lib/ebcdic12712.h
|
|
+++ b/lib/ebcdic12712.h
|
|
@@ -76,9 +76,10 @@ static int
|
|
ebcdic12712_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
|
|
{
|
|
unsigned char c = *s;
|
|
+ unsigned short wc;
|
|
if (conv->isurface & ICONV_SURFACE_EBCDIC_ZOS_UNIX)
|
|
c = swap_x15_x25 (c);
|
|
- unsigned short wc = ebcdic12712_2uni[c];
|
|
+ wc = ebcdic12712_2uni[c];
|
|
if (wc != 0xfffd) {
|
|
*pwc = (ucs4_t) wc;
|
|
return 1;
|
|
diff --git a/lib/ebcdic16804.h b/lib/ebcdic16804.h
|
|
index 57a2031..fff9198 100644
|
|
--- a/lib/ebcdic16804.h
|
|
+++ b/lib/ebcdic16804.h
|
|
@@ -76,9 +76,10 @@ static int
|
|
ebcdic16804_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
|
|
{
|
|
unsigned char c = *s;
|
|
+ unsigned short wc;
|
|
if (conv->isurface & ICONV_SURFACE_EBCDIC_ZOS_UNIX)
|
|
c = swap_x15_x25 (c);
|
|
- unsigned short wc = ebcdic16804_2uni[c];
|
|
+ wc = ebcdic16804_2uni[c];
|
|
if (wc != 0xfffd) {
|
|
*pwc = (ucs4_t) wc;
|
|
return 1;
|
|
diff --git a/lib/ebcdic423.h b/lib/ebcdic423.h
|
|
index 7782148..0a91124 100644
|
|
--- a/lib/ebcdic423.h
|
|
+++ b/lib/ebcdic423.h
|
|
@@ -76,9 +76,10 @@ static int
|
|
ebcdic423_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
|
|
{
|
|
unsigned char c = *s;
|
|
+ unsigned short wc;
|
|
if (conv->isurface & ICONV_SURFACE_EBCDIC_ZOS_UNIX)
|
|
c = swap_x15_x25 (c);
|
|
- unsigned short wc = ebcdic423_2uni[c];
|
|
+ wc = ebcdic423_2uni[c];
|
|
if (wc != 0xfffd) {
|
|
*pwc = (ucs4_t) wc;
|
|
return 1;
|
|
diff --git a/lib/ebcdic424.h b/lib/ebcdic424.h
|
|
index afcbba9..4e23220 100644
|
|
--- a/lib/ebcdic424.h
|
|
+++ b/lib/ebcdic424.h
|
|
@@ -76,9 +76,10 @@ static int
|
|
ebcdic424_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
|
|
{
|
|
unsigned char c = *s;
|
|
+ unsigned short wc;
|
|
if (conv->isurface & ICONV_SURFACE_EBCDIC_ZOS_UNIX)
|
|
c = swap_x15_x25 (c);
|
|
- unsigned short wc = ebcdic424_2uni[c];
|
|
+ wc = ebcdic424_2uni[c];
|
|
if (wc != 0xfffd) {
|
|
*pwc = (ucs4_t) wc;
|
|
return 1;
|
|
diff --git a/lib/ebcdic425.h b/lib/ebcdic425.h
|
|
index de7440b..248931e 100644
|
|
--- a/lib/ebcdic425.h
|
|
+++ b/lib/ebcdic425.h
|
|
@@ -76,9 +76,10 @@ static int
|
|
ebcdic425_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
|
|
{
|
|
unsigned char c = *s;
|
|
+ unsigned short wc;
|
|
if (conv->isurface & ICONV_SURFACE_EBCDIC_ZOS_UNIX)
|
|
c = swap_x15_x25 (c);
|
|
- unsigned short wc = ebcdic425_2uni[c];
|
|
+ wc = ebcdic425_2uni[c];
|
|
if (wc != 0xfffd) {
|
|
*pwc = (ucs4_t) wc;
|
|
return 1;
|
|
diff --git a/lib/ebcdic4971.h b/lib/ebcdic4971.h
|
|
index cfef3bb..f9fbaeb 100644
|
|
--- a/lib/ebcdic4971.h
|
|
+++ b/lib/ebcdic4971.h
|
|
@@ -76,9 +76,10 @@ static int
|
|
ebcdic4971_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
|
|
{
|
|
unsigned char c = *s;
|
|
+ unsigned short wc;
|
|
if (conv->isurface & ICONV_SURFACE_EBCDIC_ZOS_UNIX)
|
|
c = swap_x15_x25 (c);
|
|
- unsigned short wc = ebcdic4971_2uni[c];
|
|
+ wc = ebcdic4971_2uni[c];
|
|
if (wc != 0xfffd) {
|
|
*pwc = (ucs4_t) wc;
|
|
return 1;
|
|
diff --git a/lib/ebcdic875.h b/lib/ebcdic875.h
|
|
index 759c14e..aea5b93 100644
|
|
--- a/lib/ebcdic875.h
|
|
+++ b/lib/ebcdic875.h
|
|
@@ -76,9 +76,10 @@ static int
|
|
ebcdic875_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
|
|
{
|
|
unsigned char c = *s;
|
|
+ unsigned short wc;
|
|
if (conv->isurface & ICONV_SURFACE_EBCDIC_ZOS_UNIX)
|
|
c = swap_x15_x25 (c);
|
|
- unsigned short wc = ebcdic875_2uni[c];
|
|
+ wc = ebcdic875_2uni[c];
|
|
if (wc != 0xfffd) {
|
|
*pwc = (ucs4_t) wc;
|
|
return 1;
|
|
diff --git a/lib/ebcdic905.h b/lib/ebcdic905.h
|
|
index c3cef74..0213d28 100644
|
|
--- a/lib/ebcdic905.h
|
|
+++ b/lib/ebcdic905.h
|
|
@@ -76,9 +76,10 @@ static int
|
|
ebcdic905_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
|
|
{
|
|
unsigned char c = *s;
|
|
+ unsigned short wc;
|
|
if (conv->isurface & ICONV_SURFACE_EBCDIC_ZOS_UNIX)
|
|
c = swap_x15_x25 (c);
|
|
- unsigned short wc = ebcdic905_2uni[c];
|
|
+ wc = ebcdic905_2uni[c];
|
|
if (wc != 0xfffd) {
|
|
*pwc = (ucs4_t) wc;
|
|
return 1;
|
|
diff --git a/src/iconv.c b/src/iconv.c
|
|
index d6b68fd..08048a3 100644
|
|
--- a/src/iconv.c
|
|
+++ b/src/iconv.c
|
|
@@ -1017,6 +1017,7 @@ int main (int argc, char* argv[])
|
|
iconvlist(print_one,NULL);
|
|
status = 0;
|
|
} else {
|
|
+ const char *envvar_value;
|
|
#if O_BINARY
|
|
SET_BINARY(fileno(stdout));
|
|
#endif
|
|
@@ -1052,7 +1053,7 @@ int main (int argc, char* argv[])
|
|
}
|
|
/* For EBCDIC encodings, determine how to map 0x15 (which encodes the
|
|
"newline function", see the Unicode standard, chapter 5). */
|
|
- const char *envvar_value = getenv("ICONV_EBCDIC_ZOS_UNIX");
|
|
+ envvar_value = getenv("ICONV_EBCDIC_ZOS_UNIX");
|
|
if (envvar_value != NULL && envvar_value[0] != '\0') {
|
|
unsigned int surface;
|
|
iconvctl(cd, ICONV_GET_FROM_SURFACE, &surface);
|
|
diff --git a/srclib/canonicalize-lgpl.c b/srclib/canonicalize-lgpl.c
|
|
index b8566d5..9b91d01 100644
|
|
--- a/srclib/canonicalize-lgpl.c
|
|
+++ b/srclib/canonicalize-lgpl.c
|
|
@@ -432,10 +432,11 @@ char *
|
|
__realpath (const char *name, char *resolved)
|
|
{
|
|
struct realpath_bufs bufs;
|
|
+ char *result;
|
|
scratch_buffer_init (&bufs.rname);
|
|
scratch_buffer_init (&bufs.extra);
|
|
scratch_buffer_init (&bufs.link);
|
|
- char *result = realpath_stk (name, resolved, &bufs);
|
|
+ result = realpath_stk (name, resolved, &bufs);
|
|
scratch_buffer_free (&bufs.link);
|
|
scratch_buffer_free (&bufs.extra);
|
|
scratch_buffer_free (&bufs.rname);
|
|
diff --git a/srclib/realloc.c b/srclib/realloc.c
|
|
index 2946a2a..064df02 100644
|
|
--- a/srclib/realloc.c
|
|
+++ b/srclib/realloc.c
|
|
@@ -42,6 +42,9 @@ void *
|
|
rpl_realloc (void *p, size_t n)
|
|
{
|
|
size_t n1 = n;
|
|
+# if !HAVE_MALLOC_PTRDIFF
|
|
+ ptrdiff_t signed_n;
|
|
+# endif
|
|
void *result;
|
|
|
|
if (n == 0)
|
|
@@ -85,7 +88,6 @@ rpl_realloc (void *p, size_t n)
|
|
}
|
|
|
|
# if !HAVE_MALLOC_PTRDIFF
|
|
- ptrdiff_t signed_n;
|
|
if (ckd_add (&signed_n, n, 0))
|
|
{
|
|
errno = ENOMEM;
|
|
--
|
|
2.48.1
|
|
|
|
|
|
From 8a5e8fa350a35dbb14a19293b56c9b968eb37660 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
|
|
Date: Thu, 19 Jun 2025 17:41:47 +0200
|
|
Subject: gcc2 fixes for tests
|
|
|
|
|
|
diff --git a/tests/test-bom-state.c b/tests/test-bom-state.c
|
|
index fa36f43..3d8d946 100644
|
|
--- a/tests/test-bom-state.c
|
|
+++ b/tests/test-bom-state.c
|
|
@@ -47,17 +47,18 @@ static void test_one_input (const char *fromcode,
|
|
{
|
|
char outbuf1[3];
|
|
char outbuf2[3];
|
|
+ char *inbuf = (char *) input;
|
|
+ size_t inbytesleft = input_size;
|
|
+ char *outbuf = outbuf1;
|
|
+ size_t outbytesleft = sizeof (outbuf1);
|
|
+ size_t ret;
|
|
|
|
iconv_t cd = iconv_open ("UTF-8", fromcode);
|
|
if (cd == (iconv_t)(-1))
|
|
abort ();
|
|
|
|
/* Convert the first character. */
|
|
- char *inbuf = (char *) input;
|
|
- size_t inbytesleft = input_size;
|
|
- char *outbuf = outbuf1;
|
|
- size_t outbytesleft = sizeof (outbuf1);
|
|
- size_t ret = iconv (cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
|
+ ret = iconv (cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
|
if (!(ret == (size_t)(-1) && errno == E2BIG && outbytesleft == 0))
|
|
abort ();
|
|
if (!(memcmp (outbuf1, "\xe2\x94\xa6", 3) == 0)) /* should be U+2526 */
|
|
diff --git a/tests/test-discard.c b/tests/test-discard.c
|
|
index 296f6ef..a3d6f89 100644
|
|
--- a/tests/test-discard.c
|
|
+++ b/tests/test-discard.c
|
|
@@ -59,6 +59,7 @@ static void test_default (iconv_t cd)
|
|
abort ();
|
|
}
|
|
#ifdef _LIBICONV_VERSION
|
|
+ {
|
|
int x;
|
|
if (iconvctl (cd, ICONV_GET_TRANSLITERATE, &x) != 0)
|
|
abort ();
|
|
@@ -76,6 +77,7 @@ static void test_default (iconv_t cd)
|
|
abort ();
|
|
if (x != 0)
|
|
abort ();
|
|
+ }
|
|
#endif
|
|
}
|
|
|
|
@@ -108,6 +110,7 @@ static void test_translit (iconv_t cd)
|
|
abort ();
|
|
}
|
|
#ifdef _LIBICONV_VERSION
|
|
+ {
|
|
int x;
|
|
if (iconvctl (cd, ICONV_GET_TRANSLITERATE, &x) != 0)
|
|
abort ();
|
|
@@ -125,6 +128,7 @@ static void test_translit (iconv_t cd)
|
|
abort ();
|
|
if (x != 0)
|
|
abort ();
|
|
+ }
|
|
#endif
|
|
}
|
|
|
|
@@ -167,6 +171,7 @@ static void test_ignore (iconv_t cd)
|
|
abort ();
|
|
}
|
|
#ifdef _LIBICONV_VERSION
|
|
+ {
|
|
int x;
|
|
if (iconvctl (cd, ICONV_GET_TRANSLITERATE, &x) != 0)
|
|
abort ();
|
|
@@ -184,6 +189,7 @@ static void test_ignore (iconv_t cd)
|
|
abort ();
|
|
if (x != 1)
|
|
abort ();
|
|
+ }
|
|
#endif
|
|
}
|
|
|
|
@@ -216,6 +222,7 @@ static void test_ignore_translit (iconv_t cd)
|
|
abort ();
|
|
}
|
|
#ifdef _LIBICONV_VERSION
|
|
+ {
|
|
int x;
|
|
if (iconvctl (cd, ICONV_GET_TRANSLITERATE, &x) != 0)
|
|
abort ();
|
|
@@ -233,6 +240,7 @@ static void test_ignore_translit (iconv_t cd)
|
|
abort ();
|
|
if (x != 1)
|
|
abort ();
|
|
+ }
|
|
#endif
|
|
}
|
|
|
|
@@ -265,6 +273,7 @@ static void test_nid (iconv_t cd)
|
|
abort ();
|
|
}
|
|
#ifdef _LIBICONV_VERSION
|
|
+ {
|
|
int x;
|
|
if (iconvctl (cd, ICONV_GET_TRANSLITERATE, &x) != 0)
|
|
abort ();
|
|
@@ -282,6 +291,7 @@ static void test_nid (iconv_t cd)
|
|
abort ();
|
|
if (x != 0)
|
|
abort ();
|
|
+ }
|
|
#endif
|
|
}
|
|
|
|
@@ -314,6 +324,7 @@ static void test_nid_translit (iconv_t cd)
|
|
abort ();
|
|
}
|
|
#ifdef _LIBICONV_VERSION
|
|
+ {
|
|
int x;
|
|
if (iconvctl (cd, ICONV_GET_TRANSLITERATE, &x) != 0)
|
|
abort ();
|
|
@@ -331,6 +342,7 @@ static void test_nid_translit (iconv_t cd)
|
|
abort ();
|
|
if (x != 0)
|
|
abort ();
|
|
+ }
|
|
#endif
|
|
}
|
|
|
|
@@ -363,6 +375,7 @@ static void test_invd (iconv_t cd)
|
|
abort ();
|
|
}
|
|
#ifdef _LIBICONV_VERSION
|
|
+ {
|
|
int x;
|
|
if (iconvctl (cd, ICONV_GET_TRANSLITERATE, &x) != 0)
|
|
abort ();
|
|
@@ -380,6 +393,7 @@ static void test_invd (iconv_t cd)
|
|
abort ();
|
|
if (x != 0)
|
|
abort ();
|
|
+ }
|
|
#endif
|
|
}
|
|
|
|
@@ -412,6 +426,7 @@ static void test_invd_translit (iconv_t cd)
|
|
abort ();
|
|
}
|
|
#ifdef _LIBICONV_VERSION
|
|
+ {
|
|
int x;
|
|
if (iconvctl (cd, ICONV_GET_TRANSLITERATE, &x) != 0)
|
|
abort ();
|
|
@@ -429,6 +444,7 @@ static void test_invd_translit (iconv_t cd)
|
|
abort ();
|
|
if (x != 0)
|
|
abort ();
|
|
+ }
|
|
#endif
|
|
}
|
|
|
|
--
|
|
2.48.1
|
|
|