diff options
author | tobik <tobik@FreeBSD.org> | 2018-06-18 03:06:51 +0800 |
---|---|---|
committer | tobik <tobik@FreeBSD.org> | 2018-06-18 03:06:51 +0800 |
commit | 1e66c35d09c31c2d398275948a993efac830eea8 (patch) | |
tree | a3fd35f7671e8ed449cac526ad6f24874beb45a4 /databases | |
parent | be0b0e2c276ce7a007e72fe44ed5a0e6143f8e09 (diff) | |
download | freebsd-ports-gnome-1e66c35d09c31c2d398275948a993efac830eea8.tar.gz freebsd-ports-gnome-1e66c35d09c31c2d398275948a993efac830eea8.tar.zst freebsd-ports-gnome-1e66c35d09c31c2d398275948a993efac830eea8.zip |
databases/dbtool: Unbreak with Clang 6
engine.cc:539:46: error: non-constant-expression cannot be narrowed from type
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >::size_type' (aka 'unsigned long') to 'int' in
initializer list [-Wc++11-narrowing]
datum key = {(char *)config.key.c_str(), config.key.length()};
^~~~~~~~~~~~~~~~~~~
engine.cc:539:46: note: insert an explicit cast to silence this issue
datum key = {(char *)config.key.c_str(), config.key.length()};
^~~~~~~~~~~~~~~~~~~
static_cast<int>( )
http://beefy12.nyi.freebsd.org/data/head-amd64-default/p472224_s334983/logs/dbtool-1.9.1.log
Diffstat (limited to 'databases')
-rw-r--r-- | databases/dbtool/Makefile | 5 | ||||
-rw-r--r-- | databases/dbtool/files/patch-engine.cc | 64 |
2 files changed, 65 insertions, 4 deletions
diff --git a/databases/dbtool/Makefile b/databases/dbtool/Makefile index 056129cadc97..612e5d19e23d 100644 --- a/databases/dbtool/Makefile +++ b/databases/dbtool/Makefile @@ -14,14 +14,11 @@ LICENSE_FILE= ${WRKSRC}/COPYING LIB_DEPENDS= libpcre.so:devel/pcre -USES= gmake shebangfix +USES= gmake localbase shebangfix SHEBANG_FILES= samples/account-db/accdb bash_OLD_CMD= /bin/sh GNU_CONFIGURE= yes -CPPFLAGS+= -I${LOCALBASE}/include -LDFLAGS+= -L${LOCALBASE}/lib - PORTEXAMPLES= * PLIST_FILES= bin/dbtool man/man1/dbtool.1.gz diff --git a/databases/dbtool/files/patch-engine.cc b/databases/dbtool/files/patch-engine.cc new file mode 100644 index 000000000000..067bcef2656b --- /dev/null +++ b/databases/dbtool/files/patch-engine.cc @@ -0,0 +1,64 @@ +engine.cc:539:46: error: non-constant-expression cannot be narrowed from type + 'std::__1::basic_string<char, std::__1::char_traits<char>, + std::__1::allocator<char> >::size_type' (aka 'unsigned long') to 'int' in + initializer list [-Wc++11-narrowing] + datum key = {(char *)config.key.c_str(), config.key.length()}; + ^~~~~~~~~~~~~~~~~~~ +engine.cc:539:46: note: insert an explicit cast to silence this issue + datum key = {(char *)config.key.c_str(), config.key.length()}; + ^~~~~~~~~~~~~~~~~~~ + static_cast<int>( ) + +--- engine.cc.orig 2018-06-17 15:07:26 UTC ++++ engine.cc +@@ -324,8 +324,8 @@ void Engine::from_input() { + Dbt d_key((char *)key.c_str(), key.length()); + Dbt d_value((char *)value.c_str(), value.length()); + #else +- datum d_key = {(char *)key.c_str(), key.length()}; +- datum d_value = {(char *)value.c_str(), value.length()}; ++ datum d_key = {(char *)key.c_str(), static_cast<int>(key.length())}; ++ datum d_value = {(char *)value.c_str(), static_cast<int>(value.length())}; + #endif + if(config.force == 1) { + #ifdef HAVE_BERKELEY +@@ -405,8 +405,8 @@ void Engine::insert() { + Dbt value(v, strlen(v)); + #else + int ret; +- datum key = {(char *)config.key.c_str(), config.key.length()}; +- datum value = {(char *)__value.c_str(), __value.length()}; ++ datum key = {(char *)config.key.c_str(), static_cast<int>(config.key.length())}; ++ datum value = {(char *)__value.c_str(), static_cast<int>(__value.length())}; + #endif + + if(config.force == 1) { +@@ -465,8 +465,8 @@ void Engine::update() { + Dbt value(v, strlen(v)); + #else + int ret; +- datum key = {(char *)config.key.c_str(), config.key.length()}; +- datum value = {(char *)__value.c_str(), __value.length()}; ++ datum key = {(char *)config.key.c_str(), static_cast<int>(config.key.length())}; ++ datum value = {(char *)__value.c_str(), static_cast<int>(__value.length())}; + #endif + + if(config.force == 1) { +@@ -536,7 +536,7 @@ void Engine::remove() { + } + db->close(0); + #else +- datum key = {(char *)config.key.c_str(), config.key.length()}; ++ datum key = {(char *)config.key.c_str(), static_cast<int>(config.key.length())}; + ret = gdbm_delete(db, key); + gdbm_close(db); + #endif +@@ -579,7 +579,7 @@ void Engine::select() { + db->close(0); + #else + datum content; +- datum key = {(char *)config.key.c_str(), config.key.length()}; ++ datum key = {(char *)config.key.c_str(), static_cast<int>(config.key.length())}; + content = gdbm_fetch(db, key); + string V(content.dptr, content.dsize); + if(config.with == 1) |