linux PIString fix
This commit is contained in:
@@ -234,19 +234,19 @@ void PIString::appendFromChars(const char * c, int s, const char * codepage) {
|
||||
mbstate_t state;
|
||||
memset(&state, 0, sizeof(state));
|
||||
const char ** pc;
|
||||
const char * cc_;
|
||||
char * c_ = nullptr;
|
||||
if (s > 0) {
|
||||
char c_ [s+1];
|
||||
c_ = malloc(s+1);
|
||||
memcpy(c_, c, s);
|
||||
c_[s] = '\0';
|
||||
cc_ = &c_[0];
|
||||
pc = &cc_;
|
||||
pc = &c_;
|
||||
} else {
|
||||
pc = &c;
|
||||
}
|
||||
size_t len = mbsrtowcs(NULL, pc, 0, &state);
|
||||
wchar_t wstr[len+1];
|
||||
mbsrtowcs(&wstr[0], pc, len+1, &state);
|
||||
if (s > 0) free(c_);
|
||||
enlarge(len);
|
||||
for (size_t i=0; i<len; ++i) (*this)[old_sz+i] = wstr[i];
|
||||
// //qDebug() << "FromChars done" << size();
|
||||
|
||||
Reference in New Issue
Block a user