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
mbstate_t state;
memset(&state, 0, sizeof(state));
wchar_t wc;
//qDebug() << "FromChars ...";
while (sz = mbrtowc(&wc, c, s, &state) > 0) {
//qDebug() << "0" << s;
// sz = mbrtowc(&wc, c, s, &state);
//qDebug() << "1" << sz;
// if (sz < 1) break;
push_back(PIChar(wc));
c += sz; s -= sz;
//qDebug() << "2" << c;
}
//qDebug() << "FromChars done" << size();
size_t len = mbsrtowcs(NULL, c, 0, &state);
wchar_t wstr[len+1];
mbsrtowcs(&wstr[0], c, len+1, &state);
resize(len);
for (int i=0 i<len; ++i) (*this)[i] = wstr[i];
// wchar_t wc;
// //qDebug() << "FromChars ...";
// while (sz = mbrtowc(&wc, c, s, &state) > 0) {
// //qDebug() << "0" << s;
//// sz = mbrtowc(&wc, c, s, &state);
// //qDebug() << "1" << sz;
//// if (sz < 1) break;
// push_back(PIChar(wc));
// c += sz; s -= sz;
// //qDebug() << "2" << c;
// }
// //qDebug() << "FromChars done" << size();
# endif
#endif
}