pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/textproc/p5-Encode-Detect textproc/p5-Encode-Detect: f...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/011fd109e0e7
branches:  trunk
changeset: 414083:011fd109e0e7
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Mar 24 05:49:40 2020 +0000

description:
textproc/p5-Encode-Detect: fix 'array subscript has type char' errors

In file included from src/JpCntx.cpp:39:0:
src/JpCntx.h: In member function 'void JapaneseContextAnalysis::HandleOneChar(const char*, PRUint32)':
src/JpCntx.h:72:55: error: array subscript has type 'char' [-Werror=char-subscripts]
       mRelSample[jp2CharContext[mLastCharOrder][order]]++;
                                                       ^
src/JpCntx.cpp: In member function 'void JapaneseContextAnalysis::HandleData(const char*, PRUint32)':
src/JpCntx.cpp:164:57: error: array subscript has type 'char' [-Werror=char-subscripts]
         mRelSample[jp2CharContext[mLastCharOrder][order]]++;
                                                         ^

The mentioned char arrays only contain small nonnegative numbers,
therefore their exact data type doesn't matter. It is now unsigned char.

diffstat:

 textproc/p5-Encode-Detect/Makefile |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r 8b2f2b3c56ce -r 011fd109e0e7 textproc/p5-Encode-Detect/Makefile
--- a/textproc/p5-Encode-Detect/Makefile        Tue Mar 24 04:40:34 2020 +0000
+++ b/textproc/p5-Encode-Detect/Makefile        Tue Mar 24 05:49:40 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.20 2019/08/11 13:23:28 wiz Exp $
+# $NetBSD: Makefile,v 1.21 2020/03/24 05:49:40 rillig Exp $
 #
 
 DISTNAME=              Encode-Detect-1.01
@@ -19,5 +19,14 @@
 PERL5_PACKLIST=                auto/Encode/Detect/.packlist
 PERL5_MODULE_TYPE=     Module::Build
 
+SUBST_CLASSES+=                char
+SUBST_STAGE.char=      pre-configure
+SUBST_MESSAGE.char=    Fixing 'char array subscript' errors.
+SUBST_FILES.char=      src/JpCntx.* src/nsSBCharSetProber.h src/Lang*Model.cpp
+SUBST_SED.char=                -e 's,^extern \(char jp2CharContext\),extern unsigned \1,'
+SUBST_SED.char+=       -e 's,^char jp2CharContext,unsigned &,'
+SUBST_SED.char+=       -e 's,^  char \*precedenceMatrix,  unsigned &,'
+SUBST_SED.char+=       -e 's,^char [[:alnum:]]*LangModel,unsigned &,'
+
 .include "../../lang/perl5/module.mk"
 .include "../../mk/bsd.pkg.mk"



Home | Main Index | Thread Index | Old Index