kea/kea-narrowing.patch
2014-08-20 12:05:46 +02:00

66 lines
5.0 KiB
Diff

From df9dd617ad22c15bf80f6e651a977388b86674a6 Mon Sep 17 00:00:00 2001
From: Jiri Popelka <jpopelka@redhat.com>
Date: Mon, 18 Aug 2014 14:05:02 +0200
Subject: [PATCH] lib/util/encode/binary_from_base*.h: fix narrowing conversion
build log (arch=armv7):
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib -I../../../src/lib -I../../../src/lib/util -I../../../src/lib/util -I../../../src/lib/exceptions -I../../../src/lib/exceptions -DOS_LINUX -I../../../ext/asio -I../../../ext/coroutine -DASIO_DISABLE_THREADS=1 -Wall -Wextra -Wnon-virtual-dtor -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Werror -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -c -o base_n.lo ./encode/base_n.cc
In file included from encode/base_n.cc:16:0:
../../../src/lib/util/encode/binary_from_base32hex.h: In instantiation of 'CharType boost::archive::iterators::detail::to_5_bit<CharType>::operator()(CharType) const [with CharType = char]':
/usr/include/boost/iterator/transform_iterator.hpp:121:31: required from 'typename boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type::reference boost::transform_iterator<UnaryFunction, Iterator, Reference, Value>::dereference() const [with UnaryFunc = boost::archive::iterators::detail::to_5_bit<char>; Iterator = isc::util::encode::{anonymous}::DecodeNormalizer; Reference = boost::use_default; Value = boost::use_default; typename boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type::reference = char]'
encode/base_n.cc:376:9: required from 'static void isc::util::encode::{anonymous}::BaseNTransformer<BitsPerChunk, BaseZeroCode, Encoder, Decoder>::decode(const char*, const string&, std::vector<unsigned char>&) [with int BitsPerChunk = 5; char BaseZeroCode = '0'; Encoder = boost::archive::iterators::base32hex_from_binary<boost::archive::iterators::transform_width<isc::util::encode::{anonymous}::EncodeNormalizer, 5, 8> >; Decoder = boost::archive::iterators::transform_width<boost::archive::iterators::binary_from_base32hex<isc::util::encode::{anonymous}::DecodeNormalizer>, 8, 5>; std::string = std::basic_string<char>]'
encode/base_n.cc:463:27: required from here
../../../src/lib/util/encode/binary_from_base32hex.h:50:9: error: narrowing conversion of '-1' from 'int' to 'const char' inside { } is ill-formed in C++11 [-Werror=narrowing]
encode/base_n.cc:473:24: required from here
../../../src/lib/util/encode/binary_from_base16.h:47:9: error: narrowing conversion of '-1' from 'int' to 'const char' inside { } is ill-formed in C++11 [-Werror=narrowing]
name.cc:74:1: error: narrowing conversion of '-1' from 'int' to 'const char' inside { } is ill-formed in C++11 [-Werror=narrowing]
---
src/lib/dns/name.cc | 2 +-
src/lib/util/encode/binary_from_base16.h | 2 +-
src/lib/util/encode/binary_from_base32hex.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/lib/dns/name.cc b/src/lib/dns/name.cc
index ff00374..7d34a09 100644
--- a/src/lib/dns/name.cc
+++ b/src/lib/dns/name.cc
@@ -54,7 +54,7 @@ namespace {
/// improve the performance of message rendering (which internally uses the
/// array heavily) about 27%. Since we want to achieve very good performance
/// for message rendering in some cases, we'll keep using it.
-const char digitvalue[256] = {
+const signed char digitvalue[256] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 16
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 32
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 48
diff --git a/src/lib/util/encode/binary_from_base16.h b/src/lib/util/encode/binary_from_base16.h
index e9fdd27..307842a 100644
--- a/src/lib/util/encode/binary_from_base16.h
+++ b/src/lib/util/encode/binary_from_base16.h
@@ -36,7 +36,7 @@ template<class CharType>
struct to_4_bit {
typedef CharType result_type;
CharType operator()(CharType t) const{
- const char lookup_table[] = {
+ const signed char lookup_table[] = {
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 00-0f
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 10-1f
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 20-2f
diff --git a/src/lib/util/encode/binary_from_base32hex.h b/src/lib/util/encode/binary_from_base32hex.h
index 43b7d64..457fa3c 100644
--- a/src/lib/util/encode/binary_from_base32hex.h
+++ b/src/lib/util/encode/binary_from_base32hex.h
@@ -38,7 +38,7 @@ template<class CharType>
struct to_5_bit {
typedef CharType result_type;
CharType operator()(CharType t) const{
- const char lookup_table[] = {
+ const signed char lookup_table[] = {
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 00-0f
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 10-1f
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 20-2f
--
1.9.3