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

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