gentoo-ebuilds/app-text/paps/files/paps-0.8.0-fix_unused_results.patch
Nicolas PARLANT 5602c153d4
app-text/paps: add 0.8.0
EAPI bump

use python-r1 to install the script src-to-paps

move to official github repo
build-system changed to meson

deps :
add missing dev-libs/glib
add x11-libs/cairo (since 0.7.0)

add basic test

patches from PR merged :
fix compiler warnings
fix glib/fmt compatilibity

Closes: https://bugs.gentoo.org/936584
Closes: https://bugs.gentoo.org/944759
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/42957
Closes: https://github.com/gentoo/gentoo/pull/42957
Signed-off-by: Sam James <sam@gentoo.org>
2025-07-23 03:37:46 +01:00

84 lines
2.6 KiB
Diff

https://github.com/dov/paps/pull/58.patch
PR merged
From 0eac5cb403dd7dc4f4ebd05c9a93730fa1521e53 Mon Sep 17 00:00:00 2001
From: Akira TAGOH <akira@tagoh.org>
Date: Wed, 1 Mar 2023 15:24:27 +0900
Subject: [PATCH] Fix the build issue
Some code ignores a return value of g_string_free() and that causes:
ignoring return value of 'gchar* g_string_free_and_steal(GString*)' declared with attribute 'warn_unused_result' [-Wunused-result]
This fixes it.
---
src/paps.cc | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/paps.cc b/src/paps.cc
index cb48ddc..429b764 100644
--- a/src/paps.cc
+++ b/src/paps.cc
@@ -368,6 +368,7 @@ copy_pango_parse_enum (GType type,
{
int i;
GString *s = g_string_new (nullptr);
+ gchar *gstr;
for (i = 0, v = g_enum_get_value (klass, i); v;
i++ , v = g_enum_get_value (klass, i))
@@ -382,10 +383,10 @@ copy_pango_parse_enum (GType type,
G_ENUM_CLASS_TYPE_NAME(klass),
s->str);
- if (possible_values)
- *possible_values = s->str;
+ gstr = g_string_free (s, possible_values ? false : true);
- g_string_free (s, possible_values ? false : true);
+ if (possible_values)
+ *possible_values = gstr;
}
}
@@ -1001,7 +1002,7 @@ read_file (FILE *file,
if (ferror (file))
{
fprintf(stderr, _("%s: Error reading file.\n"), g_get_prgname ());
- g_string_free (inbuf, true);
+ (void) g_string_free (inbuf, true);
exit(1);
}
else if (bp == nullptr)
@@ -1043,8 +1044,7 @@ read_file (FILE *file,
if (inbuf->len && inbuf->str[inbuf->len-1] != '\n')
g_string_append(inbuf, "\n");
- text = inbuf->str;
- g_string_free (inbuf, false);
+ text = g_string_free (inbuf, false);
if (encoding != nullptr && cvh != nullptr)
g_iconv_close(cvh);
@@ -1671,7 +1671,11 @@ get_date()
fprintf(stderr, _("%1$s: Error while converting date string from '%2$s' to UTF-8.\n"),
g_get_prgname(), get_encoding());
/* Return the unconverted string. */
- g_string_free(inbuf, false);
+ /*
+ * inbuf isn't used here, but a few memory is
+ * allocated by default. so it should be freed anyway.
+ */
+ (void) g_string_free(inbuf, true);
g_iconv_close(cvh);
return date;
}
@@ -1679,8 +1683,7 @@ get_date()
obuffer[BUFSIZE * 6 - 1 - oblen] = 0;
g_string_append(inbuf, bp);
- date_utf8 = inbuf->str;
- g_string_free(inbuf, false);
+ date_utf8 = g_string_free(inbuf, false);
g_iconv_close(cvh);
}