1From 2065015da40cf79dd8ec9e3f186538e17c3b592f Mon Sep 17 00:00:00 2001 2From: Robert Joslyn <robert.joslyn@redrectangle.org> 3Date: Wed, 30 Nov 2022 13:07:29 -0800 4Subject: [PATCH 2/3] Fix assumed signed char 5 6The code assumes that char is signed, but whether char is signed or 7unsigned is implementation defined. On some architectures like PowerPC, 8GCC treats char as unsigned resulting in compile errors: 9 10 smtp-address-validator.cpp:213:1: error: narrowing conversion of '-32' from 'int' to 'char' [-Wnarrowing] 11 12Fix this by specifying signed char. 13 14Upstream-Status: Backport [https://github.com/pboettch/json-schema-validator/commit/491ac44026e08f31790f5cacffa62e168bb35e32] 15 16Signed-off-by: Parian Golchin <Parian.Golchin@iris-sensing.com> 17--- 18 src/smtp-address-validator.cpp | 16 ++++++++-------- 19 1 file changed, 8 insertions(+), 8 deletions(-) 20 21diff --git a/src/smtp-address-validator.cpp b/src/smtp-address-validator.cpp 22index a63ead0..3903b51 100644 23--- a/src/smtp-address-validator.cpp 24+++ b/src/smtp-address-validator.cpp 25@@ -63,7 +63,7 @@ static const short _address_key_offsets[] = { 26 1363, 1365, 1367, 1368, 1370, 1388, 0 27 }; 28 29-static const char _address_trans_keys[] = { 30+static const signed char _address_trans_keys[] = { 31 -32, -19, -16, -12, 34, 45, 61, 63, 32 -62, -33, -31, -17, -15, -13, 33, 39, 33 42, 43, 47, 57, 65, 90, 94, 126, 34@@ -711,7 +711,7 @@ bool is_address(const char* p, const char* pe) 35 { 36 int _klen; 37 unsigned int _trans = 0; 38- const char * _keys; 39+ const signed char * _keys; 40 const signed char * _acts; 41 unsigned int _nacts; 42 _resume: {} 43@@ -728,9 +728,9 @@ bool is_address(const char* p, const char* pe) 44 45 _klen = (int)_address_single_lengths[cs]; 46 if ( _klen > 0 ) { 47- const char *_lower = _keys; 48- const char *_upper = _keys + _klen - 1; 49- const char *_mid; 50+ const signed char *_lower = _keys; 51+ const signed char *_upper = _keys + _klen - 1; 52+ const signed char *_mid; 53 while ( 1 ) { 54 if ( _upper < _lower ) { 55 _keys += _klen; 56@@ -752,9 +752,9 @@ bool is_address(const char* p, const char* pe) 57 58 _klen = (int)_address_range_lengths[cs]; 59 if ( _klen > 0 ) { 60- const char *_lower = _keys; 61- const char *_upper = _keys + (_klen<<1) - 2; 62- const char *_mid; 63+ const signed char *_lower = _keys; 64+ const signed char *_upper = _keys + (_klen<<1) - 2; 65+ const signed char *_mid; 66 while ( 1 ) { 67 if ( _upper < _lower ) { 68 _trans += (unsigned int)_klen; 69-- 702.25.1 71 72