pkgsrc-WIP-changes archive

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

espeak: Avoid narrowing conversion errors



Module Name:	pkgsrc-wip
Committed By:	Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By:	leot
Date:		Sun May 27 12:47:30 2018 +0200
Changeset:	c2143b3a19e9898b067fd30017c20e04ea10f0e6

Modified Files:
	espeak/distinfo
Added Files:
	espeak/patches/patch-numbers.cpp
	espeak/patches/patch-tr__languages.cpp
	espeak/patches/patch-translate.h

Log Message:
espeak: Avoid narrowing conversion errors

With at least gcc-6.4.0 the build failed due:

 | tr_languages.cpp:201:43: error: narrowing conversion of '194' from 'int' to 'char' inside { } [-Wnarrowing]
 |  const char string_ordinal[] = {0xc2,0xba,0};  // masculine ordinal character, UTF-8
 |                                            ^

Use wchar_t instead of char to avoid that.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=c2143b3a19e9898b067fd30017c20e04ea10f0e6

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

diffstat:
 espeak/distinfo                        |  3 +++
 espeak/patches/patch-numbers.cpp       | 15 +++++++++++++++
 espeak/patches/patch-tr__languages.cpp | 24 ++++++++++++++++++++++++
 espeak/patches/patch-translate.h       | 15 +++++++++++++++
 4 files changed, 57 insertions(+)

diffs:
diff --git a/espeak/distinfo b/espeak/distinfo
index 33c0b261de..7b8b80ec62 100644
--- a/espeak/distinfo
+++ b/espeak/distinfo
@@ -6,3 +6,6 @@ Size (espeak-1.48.04-source.zip) = 3019245 bytes
 SHA1 (patch-aa) = 9cd957a808e1d5b468f89e8b52e9950dd9295719
 SHA1 (patch-ab) = b95e08f1422bbf7d880e13d30572e1cdebde967a
 SHA1 (patch-ac) = 0e6283ea50d94f39d85f82ac19b654fa471937fc
+SHA1 (patch-numbers.cpp) = a611bbc7c5b8ef0abaa84949635ad2dad9a67411
+SHA1 (patch-tr__languages.cpp) = 7b3bf013fc1566f4f0a07f2d8af3e386d8954a0a
+SHA1 (patch-translate.h) = 7e5bfbf6a7fab6524b853ebedf08896f3a81d6d2
diff --git a/espeak/patches/patch-numbers.cpp b/espeak/patches/patch-numbers.cpp
new file mode 100644
index 0000000000..327804c483
--- /dev/null
+++ b/espeak/patches/patch-numbers.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Avoid narrowing conversion errors.
+
+--- numbers.cpp.orig	2014-03-04 16:47:15.000000000 +0000
++++ numbers.cpp
+@@ -1226,7 +1226,7 @@ int TranslateRoman(Translator *tr, char 
+ 		p = &ph_out[strlen(ph_roman)];
+ 	}
+ 
+-	sprintf(number_chars,"  %d %s    ",acc, tr->langopts.roman_suffix);
++	sprintf(number_chars,"  %d %ls    ",acc, tr->langopts.roman_suffix);
+ 
+ 	if(word[0] == '.')
+ 	{
diff --git a/espeak/patches/patch-tr__languages.cpp b/espeak/patches/patch-tr__languages.cpp
new file mode 100644
index 0000000000..86cb3c097a
--- /dev/null
+++ b/espeak/patches/patch-tr__languages.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Avoid narrowing conversion errors.
+
+--- tr_languages.cpp.orig	2014-03-04 16:47:15.000000000 +0000
++++ tr_languages.cpp
+@@ -198,7 +198,7 @@ static const unsigned short chars_ignore
+ 	0x200d,  1, // zero width joiner
+ 	0, 0 };
+ 
+-const char string_ordinal[] = {0xc2,0xba,0};  // masculine ordinal character, UTF-8
++const wchar_t string_ordinal[] = {0xc2,0xba,0};  // masculine ordinal character, UTF-8
+ 
+ 
+ static Translator* NewTranslator(void)
+@@ -296,7 +296,7 @@ static const char transpose_map_latin[] 
+ 	tr->langopts.replace_chars = NULL;
+ 	tr->langopts.ascii_language[0] = 0;    // Non-Latin alphabet languages, use this language to speak Latin words, default is English
+ 	tr->langopts.alt_alphabet_lang = L('e','n');
+-	tr->langopts.roman_suffix = "";
++	tr->langopts.roman_suffix = { 0 };
+ 
+ 	SetLengthMods(tr,201);
+ //	tr->langopts.length_mods = length_mods_en;
diff --git a/espeak/patches/patch-translate.h b/espeak/patches/patch-translate.h
new file mode 100644
index 0000000000..396c42bb86
--- /dev/null
+++ b/espeak/patches/patch-translate.h
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Avoid narrowing conversion errors.
+
+--- translate.h.orig	2014-03-04 16:47:15.000000000 +0000
++++ translate.h
+@@ -545,7 +545,7 @@ typedef struct {
+ 	int decimal_sep;
+ 	int max_digits;    // max number of digits which can be spoken as an integer number (rather than individual digits)
+ 	const char *ordinal_indicator;   // UTF-8 string
+-	const char *roman_suffix;    // add this (ordinal) suffix to Roman numbers (LANG=an)
++	const wchar_t *roman_suffix;    // add this (ordinal) suffix to Roman numbers (LANG=an)
+ 
+ 	// bit 0, accent name before the letter name, bit 1 "capital" after letter name
+ 	int accents;


Home | Main Index | Thread Index | Old Index