Skip to content

Commit

Permalink
Upgrade: paps version to 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jykanase committed Dec 18, 2024
1 parent 05db65d commit 585b846
Show file tree
Hide file tree
Showing 11 changed files with 328 additions and 209 deletions.
12 changes: 12 additions & 0 deletions SPECS-EXTENDED/paps/paps-0.6.8-glib282.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
--- paps-0.6.8.orig/src/paps.c 2024-09-13 21:07:13.225683344 +0900
+++ paps-0.6.8/src/paps.c 2024-09-13 21:10:24.177041518 +0900
@@ -784,7 +784,7 @@ split_text_into_paragraphs (PangoContext
while (p != NULL && *p)
{
wc = g_utf8_get_char (p);
- next = g_utf8_next_char (p);
+ next = (char *) g_utf8_next_char (p);
if (wc == (gunichar)-1)
{
fprintf (stderr, "%s: Invalid character in input\n", g_get_prgname ());
44 changes: 44 additions & 0 deletions SPECS-EXTENDED/paps/paps-c99.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Use AC_USE_SYSTEM_EXTENSIONS and include <config.h>, so that <wchar.h>
makes a declaration of wcwidth available. Include <glib/gprintf.h>
for a declaration of g_vasprintf. This avoids implicit function
declarations and build failures with future compilers.

No need to upstream this because it only impacts the bundled 0.6.8
sources, the later 0.8.0 version has already been fixed upstream. The
g_vasprintf call was introduced in the paps-0.6.6-lcnumeric.patch
downstream patch.

diff -ur paps-0.8.0.orig/paps-0.6.8/configure.in paps-0.8.0/paps-0.6.8/configure.in
--- paps-0.8.0.orig/paps-0.6.8/configure.in 2023-04-13 11:56:29.571277839 +0200
+++ paps-0.8.0/paps-0.6.8/configure.in 2023-04-13 12:00:03.228135149 +0200
@@ -6,6 +6,7 @@
AC_LANG_C
AC_PROG_CC
AM_PROG_LIBTOOL
+AC_USE_SYSTEM_EXTENSIONS

dnl ======================================================
dnl check for CUPS
diff -ur paps-0.8.0.orig/paps-0.6.8/src/paps.c paps-0.8.0/paps-0.6.8/src/paps.c
--- paps-0.8.0.orig/paps-0.6.8/src/paps.c 2023-04-13 11:56:29.583277719 +0200
+++ paps-0.8.0/paps-0.6.8/src/paps.c 2023-04-13 12:02:28.958673663 +0200
@@ -20,7 +20,7 @@
*
*/

-
+#include <config.h>
#include <pango/pango.h>
#include <pango/pangoft2.h>
#include "libpaps.h"
diff -ur paps-0.8.0.orig/paps-0.6.8/src/libpaps.c paps-0.8.0/paps-0.6.8/src/libpaps.c
--- paps-0.8.0.orig/paps-0.6.8/src/libpaps.c 2023-04-13 11:56:29.581277739 +0200
+++ paps-0.8.0/paps-0.6.8/src/libpaps.c 2023-04-13 12:07:17.504779917 +0200
@@ -23,6 +23,7 @@

#include "libpaps.h"

+#include <glib/gprintf.h>
#include <pango/pango.h>
#include <pango/pangoft2.h>
#include <ft2build.h>
85 changes: 85 additions & 0 deletions SPECS-EXTENDED/paps/paps-fix-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
From e2180b2e1493abc2a8d1165e10bf264d50fac0ae Mon Sep 17 00:00:00 2001
From: Akira TAGOH <[email protected]>
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);
}

--
2.39.2

2 changes: 1 addition & 1 deletion SPECS-EXTENDED/paps/paps-fix-cpi.patch
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ index 334d547..72dbaad 100644
+
+ para->length = i;
+ next = g_utf8_offset_to_pointer(para->text, para->length);
+ wc = g_utf8_prev_char(next);
+ wc = g_utf8_get_char(g_utf8_prev_char(next));
+ } else {
+ pango_layout_set_text(para->layout, para->text, para->length);
+ }
Expand Down
18 changes: 18 additions & 0 deletions SPECS-EXTENDED/paps/paps-fix-src-to-paps.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff -pruN paps-0.8.0.orig/scripts/src-to-paps paps-0.8.0/scripts/src-to-paps
--- paps-0.8.0.orig/scripts/src-to-paps 2023-02-09 16:27:38.000000000 +0900
+++ paps-0.8.0/scripts/src-to-paps 2023-03-01 15:00:27.801416563 +0900
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3

######################################################################
# Use GNU source-hightlight to turn source code into pango markup
@@ -49,7 +49,7 @@ def arg_if_not_none(param_name, val):
# Defaults

# TBD - Make this a configuration variable
-pango_outlang_path = '/usr/local/share/paps/pango_markup.outlang'
+pango_outlang_path = '/usr/share/paps/pango_markup.outlang'

parser = argparse.ArgumentParser(description='Process a file')
parser.add_argument('-o', '--output',
34 changes: 34 additions & 0 deletions SPECS-EXTENDED/paps/paps-glib282.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
g_utf8_next_char no longer includes a cast to char* as of 2.81.0:

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4016

diff -up a/src/paps.cc b/src/paps.cc
--- a/src/paps.cc 2024-09-12 19:21:02.858439427 -0400
+++ b/src/paps.cc 2024-09-12 21:15:46.905955152 -0400
@@ -1115,7 +1115,7 @@ split_text_into_paragraphs (PangoContext
while (p != nullptr && *p)
{
wc = g_utf8_get_char (p);
- next = g_utf8_next_char (p);
+ next = (char *) g_utf8_next_char (p);
if (wc == (gunichar)-1)
{
fprintf (stderr, _("%s: Invalid character in input\n"), g_get_prgname ());
@@ -1130,7 +1130,7 @@ split_text_into_paragraphs (PangoContext
para->length = p - last_para;
/* handle dos line breaks */
if (wc == '\r' && *next == '\n')
- next = g_utf8_next_char(next);
+ next = (char *) g_utf8_next_char(next);
para->layout = pango_layout_new (pango_context);

if (page_layout->cpi > 0.0L)
@@ -1201,7 +1201,7 @@ split_text_into_paragraphs (PangoContext
g_free (newtext);

para->length = i;
- next = g_utf8_offset_to_pointer (para->text, para->length);
+ next = (char *) g_utf8_offset_to_pointer (para->text, para->length);
wc = g_utf8_get_char (g_utf8_prev_char (next));
}
else
3 changes: 2 additions & 1 deletion SPECS-EXTENDED/paps/paps.signatures.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"Signatures": {
"29-paps.conf": "fcd8f22887f08923bfdcdaab199c90ee1f74db96601ca474095436beb0ab6cc0",
"paps-0.6.8.tar.gz": "db214c4ea7ecde2f7986b869f6249864d3ff364e6f210c15aa2824bcbd850a20",
"paps-0.8.0.tar.gz": "bb5a826db364117a5ae79c833c4a000197f3b5b3eff10e31fb1513a583f96ff2",
"paps.convs": "ef90a7ffdf2a2491920f432575bccac2a8729ab393040b3c9de602e795d43f6b"
}
}
}
Loading

0 comments on commit 585b846

Please sign in to comment.