Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UConverter *QIcuCodec::getConverter(QTextCodec::ConverterState *state) const
- {
- UConverter *conv = 0;
- if (state) {
- if (!state->d) {
- // first time
- state->flags |= QTextCodec::FreeFunction;
- QTextCodecUnalignedPointer::encode(state->state_data, qIcuCodecStateFree);
- UErrorCode error = U_ZERO_ERROR;
- state->d = ucnv_open(m_name, &error);
- ucnv_setSubstChars(static_cast<UConverter *>(state->d),
- state->flags & QTextCodec::ConvertInvalidToNull ? "\0" : "?", 1, &error);
- if (U_FAILURE(error))
- qDebug() << "getConverter(state) ucnv_open failed" << m_name << u_errorName(error);
- }
- conv = static_cast<UConverter *>(state->d);
- }
- if (!conv) {
- // stateless conversion
- UErrorCode error = U_ZERO_ERROR;
- conv = ucnv_open(m_name, &error);
- ucnv_setSubstChars(conv, "?", 1, &error);
- if (U_FAILURE(error))
- qDebug() << "getConverter(no state) ucnv_open failed" << m_name << u_errorName(error);
- }
- return conv;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement