picout fix

This commit is contained in:
2022-04-13 22:46:53 +03:00
parent 2ab2614ab4
commit c7e67b309e
3 changed files with 6 additions and 5 deletions

View File

@@ -160,6 +160,7 @@ PICout::PICout(int controls): fo_(true), cc_(false), fc_(false), act_(true), cnb
}
PICout::PICout(bool active): fo_(true), cc_(false), fc_(false), act_(active), cnb_(10), co_(PICoutManipulators::DefaultControls) {
buffer_ = nullptr;
if (act_)
init();
}
@@ -522,6 +523,7 @@ PICout & PICout::newLine() {
PICout & PICout::write(const char * str, int len) {
if (!act_) return *this;
if (buffer_) {
buffer_->append(PIString(str, len));
} else {
@@ -533,6 +535,7 @@ PICout & PICout::write(const char * str, int len) {
PICout & PICout::writePIString(const PIString & s) {
if (!act_) return *this;
if (buffer_) {
buffer_->append(s);
} else {
@@ -555,7 +558,7 @@ void PICout::init() {
}
attr_ = __Private__::dattr;
#endif
buffer_ = 0;
buffer_ = nullptr;
id_ = 0;
if ((co_ & NoLock) != NoLock)
PICout::__mutex__().lock();

View File

@@ -470,7 +470,7 @@ PIString & PIString::operator +=(const wchar_t * str) {
PIString & PIString::operator +=(const PIString & str) {
*((PIDeque<PIChar>*)this) << *((PIDeque<PIChar>*)&str);
PIDeque<PIChar>::append(*(const PIDeque<PIChar>*)&str);
return *this;
}

View File

@@ -396,9 +396,7 @@ bool PIIODevice::close() {
}
int PIIODevice::write(PIByteArray data) {
if (isOpened())
return writeDevice(data.data(), data.size_s());
return -1;
return writeDevice(data.data(), data.size_s());
}