static const iconv_t invalid_cd = (iconv_t)(-1);
-struct IconvProcessor::Impl
+class IconvProcessor::Impl
{
+ // noncopyable because iconv_close() is called in destructor
+ Impl(Impl const &);
+ Impl & operator=(Impl const &);
+public:
Impl(string const & to, string const & from)
: cd(invalid_cd), tocode_(to), fromcode_(from)
{}
~Impl()
{
if (cd != invalid_cd && iconv_close(cd) == -1)
- LYXERR0("Error returned from iconv_close(" << errno << ")");
+ LYXERR0("Error returned from iconv_close(" << errno << ')');
}
iconv_t cd;
}
-void IconvProcessor::operator=(IconvProcessor const & other)
+IconvProcessor & IconvProcessor::operator=(IconvProcessor const & other)
{
- if (&other != this)
+ if (&other != this) {
+ delete pimpl_;
pimpl_ = new Impl(other.pimpl_->tocode_, other.pimpl_->fromcode_);
+ }
+ return *this;
}