fix readability-*:

* readability-const-return-type
* readability-container-data-pointer
* readability-container-size-empty
* readability-delete-null-pointer
* readability-else-after-return
* readability-inconsistent-declaration-parameter-name
* readability-redundant-member-init
* readability-redundant-smartptr-get
* readability-redundant-string-cstr
* readability-use-anyofallof
* readability-static-definition-in-anonymous-namespace
* readability-static-accessed-through-instance
* readability-simplify-boolean-expr
This commit is contained in:
wmayer
2023-11-15 10:50:27 +01:00
parent e4975f0153
commit f539138dd9
42 changed files with 330 additions and 458 deletions

View File

@@ -602,7 +602,7 @@ PyStreambuf::int_type PyStreambuf::underflow()
return traits_type::eof();
}
std::memcpy(start, &(c[0]), c.size());
std::memcpy(start, c.data(), c.size());
}
catch (Py::Exception& e) {
e.clear();
@@ -666,31 +666,29 @@ bool PyStreambuf::writeStr(const char* str, std::streamsize num)
meth.apply(arg);
return true;
}
else if (type == BytesIO) {
if (type == BytesIO) {
arg.setItem(0, Py::Bytes(str, num));
meth.apply(arg);
return true;
}
else {
// try out what works
try {
arg.setItem(0, Py::String(str, num));
// try out what works
try {
arg.setItem(0, Py::String(str, num));
meth.apply(arg);
type = StringIO;
return true;
}
catch (Py::Exception& e) {
if (PyErr_ExceptionMatches(PyExc_TypeError)) {
e.clear();
arg.setItem(0, Py::Bytes(str, num));
meth.apply(arg);
type = StringIO;
type = BytesIO;
return true;
}
catch (Py::Exception& e) {
if (PyErr_ExceptionMatches(PyExc_TypeError)) {
e.clear();
arg.setItem(0, Py::Bytes(str, num));
meth.apply(arg);
type = BytesIO;
return true;
}
else {
throw; // re-throw
}
}
throw; // re-throw
}
}
catch (Py::Exception& e) {