$NetBSD: patch-af,v 1.8 2011/10/14 01:12:06 jmmv Exp $ A 'char' cannot be expected to be signed. PowerPC, for example, defines the 'char' type as unsigned. Fix this piece of code to not deal with signed characters. --- ./boost/archive/iterators/binary_from_base64.hpp.orig 2011-10-13 23:56:25.000000000 +0000 +++ ./boost/archive/iterators/binary_from_base64.hpp @@ -39,28 +39,28 @@ template struct to_6_bit { typedef CharType result_type; CharType operator()(CharType t) const{ - const char lookup_table[] = { - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, - 52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1, - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, - 15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, - -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, - 41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1 + unsigned char lookup_table[] = { + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63, + 52,53,54,55,56,57,58,59,60,61,255,255,255,255,255,255, + 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, + 15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255, + 255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, + 41,42,43,44,45,46,47,48,49,50,51,255,255,255,255,255 }; // metrowerks trips this assertion - how come? #if ! defined(__MWERKS__) BOOST_STATIC_ASSERT(128 == sizeof(lookup_table)); #endif - signed char value = -1; + unsigned char value = 255; if((unsigned)t <= 127) value = lookup_table[(unsigned)t]; - if(-1 == value) + if(255 == value) boost::serialization::throw_exception( dataflow_exception(dataflow_exception::invalid_base64_character) ); - return value; + return static_cast< CharType >(value); } };