You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
1.1 KiB

From 77cae5ff9b8dff22bfebac905f1579562609dd35 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Mon, 4 May 2020 12:44:34 -0700
Subject: [PATCH] remove iconv casting
iconv_t is sometimes a pointer and other times an int. Remove casting
to make it work with the latter.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
src/util/string_converter.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/util/string_converter.cc b/src/util/string_converter.cc
index 272787ad..e1724b39 100644
--- a/src/util/string_converter.cc
+++ b/src/util/string_converter.cc
@@ -41,15 +41,15 @@ StringConverter::StringConverter(const std::string& from, const std::string& to)
dirty = false;
cd = iconv_open(to.c_str(), from.c_str());
- if (cd == reinterpret_cast<iconv_t>(-1)) {
- cd = static_cast<iconv_t>(nullptr);
+ if (!cd) {
+ cd = {};
throw_std_runtime_error(std::string("iconv: ") + strerror(errno));
}
}
StringConverter::~StringConverter()
{
- if (cd != static_cast<iconv_t>(nullptr))
+ if (cd)
iconv_close(cd);
}