SocketInstance::~SocketInstance ()
{
- Transaction trans;
+ try {
+ Transaction trans;
- SCIM_DEBUG_IMENGINE(1) << "Destroy IMEngine Instance " << m_peer_id << ".\n";
+ SCIM_DEBUG_IMENGINE(1) << "Destroy IMEngine Instance " << m_peer_id << ".\n";
- m_signal_reconnect_connection.disconnect ();
+ m_signal_reconnect_connection.disconnect ();
- if (m_peer_id >= 0) {
- global->init_transaction (trans);
+ if (m_peer_id >= 0) {
+ global->init_transaction (trans);
- trans.put_command (SCIM_TRANS_CMD_DELETE_INSTANCE);
- trans.put_data (m_peer_id);
+ trans.put_command (SCIM_TRANS_CMD_DELETE_INSTANCE);
+ trans.put_data (m_peer_id);
- commit_transaction (trans);
+ commit_transaction (trans);
+ }
+ } catch (Exception & e) {
+ std::cerr << e.what();
}
}
{
if (!dest)
return 0;
-
int count;
- if (wc < 0x80) { // most offen case
- if (dest_size < 1)
- return RET_TOOSMALL;
- dest[0] = wc;
- return 1;
- }
- else if (wc < 0x800)
+ unsigned int _wc = wc;
+ if (_wc < 0x80)
+ count = 1;
+ else if (_wc < 0x800)
count = 2;
- else if (wc < 0x10000)
+ else if (_wc < 0x10000)
count = 3;
- else if (wc < 0x200000)
+ else if (_wc < 0x200000)
count = 4;
- else if (wc < 0x4000000)
+ else if (_wc < 0x4000000)
count = 5;
- else //if (wc <= 0x7fffffff)
+ else if (_wc <= 0x7fffffff)
count = 6;
+ else
+ return RET_ILSEQ;
if (dest_size < count)
return RET_TOOSMALL;