linux test

This commit is contained in:
2022-04-25 21:55:10 +03:00
parent 41fb7cc40d
commit 858269a46b

View File

@@ -231,18 +231,23 @@ void PIString::appendFromChars(const char * c, int s, const char * codepage) {
# else # else
mbstate_t state; mbstate_t state;
memset(&state, 0, sizeof(state)); memset(&state, 0, sizeof(state));
wchar_t wc; size_t len = mbsrtowcs(NULL, c, 0, &state);
//qDebug() << "FromChars ..."; wchar_t wstr[len+1];
while (sz = mbrtowc(&wc, c, s, &state) > 0) { mbsrtowcs(&wstr[0], c, len+1, &state);
//qDebug() << "0" << s; resize(len);
// sz = mbrtowc(&wc, c, s, &state); for (int i=0 i<len; ++i) (*this)[i] = wstr[i];
//qDebug() << "1" << sz; // wchar_t wc;
// if (sz < 1) break; // //qDebug() << "FromChars ...";
push_back(PIChar(wc)); // while (sz = mbrtowc(&wc, c, s, &state) > 0) {
c += sz; s -= sz; // //qDebug() << "0" << s;
//qDebug() << "2" << c; //// sz = mbrtowc(&wc, c, s, &state);
} // //qDebug() << "1" << sz;
//qDebug() << "FromChars done" << size(); //// if (sz < 1) break;
// push_back(PIChar(wc));
// c += sz; s -= sz;
// //qDebug() << "2" << c;
// }
// //qDebug() << "FromChars done" << size();
# endif # endif
#endif #endif
} }