forked from quickshell/quickshell
lint: remove reinterpret_cast lint
Unhelpful.
This commit is contained in:
parent
be5e5fc4a5
commit
3fc1c914c7
15 changed files with 41 additions and 72 deletions
|
@ -159,10 +159,7 @@ void GreetdConnection::onSocketError(QLocalSocket::LocalSocketError error) {
|
|||
void GreetdConnection::onSocketReady() {
|
||||
qint32 length = 0;
|
||||
|
||||
this->socket.read(
|
||||
reinterpret_cast<char*>(&length), // NOLINT
|
||||
sizeof(qint32)
|
||||
);
|
||||
this->socket.read(reinterpret_cast<char*>(&length), sizeof(qint32));
|
||||
|
||||
auto text = this->socket.read(length);
|
||||
auto json = QJsonDocument::fromJson(text).object();
|
||||
|
@ -248,10 +245,7 @@ void GreetdConnection::sendRequest(const QJsonObject& json) {
|
|||
<< QJsonDocument(debugJson).toJson(QJsonDocument::Compact);
|
||||
}
|
||||
|
||||
this->socket.write(
|
||||
reinterpret_cast<char*>(&length), // NOLINT
|
||||
sizeof(qint32)
|
||||
);
|
||||
this->socket.write(reinterpret_cast<char*>(&length), sizeof(qint32));
|
||||
|
||||
this->socket.write(text);
|
||||
this->socket.flush();
|
||||
|
|
|
@ -15,7 +15,7 @@ QImage DBusNotificationImage::createImage() const {
|
|||
auto format = this->hasAlpha ? QImage::Format_RGBA8888 : QImage::Format_RGB888;
|
||||
|
||||
return QImage(
|
||||
reinterpret_cast<const uchar*>(this->data.data()), // NOLINT
|
||||
reinterpret_cast<const uchar*>(this->data.data()),
|
||||
this->width,
|
||||
this->height,
|
||||
format
|
||||
|
|
|
@ -79,20 +79,14 @@ void PamConversation::onMessage() {
|
|||
|
||||
auto type = PamIpcEvent::Exit;
|
||||
|
||||
auto ok = this->pipes.readBytes(
|
||||
reinterpret_cast<char*>(&type), // NOLINT
|
||||
sizeof(PamIpcEvent)
|
||||
);
|
||||
auto ok = this->pipes.readBytes(reinterpret_cast<char*>(&type), sizeof(PamIpcEvent));
|
||||
|
||||
if (!ok) goto fail;
|
||||
|
||||
if (type == PamIpcEvent::Exit) {
|
||||
auto code = PamIpcExitCode::OtherError;
|
||||
|
||||
ok = this->pipes.readBytes(
|
||||
reinterpret_cast<char*>(&code), // NOLINT
|
||||
sizeof(PamIpcExitCode)
|
||||
);
|
||||
ok = this->pipes.readBytes(reinterpret_cast<char*>(&code), sizeof(PamIpcExitCode));
|
||||
|
||||
if (!ok) goto fail;
|
||||
|
||||
|
@ -112,10 +106,7 @@ void PamConversation::onMessage() {
|
|||
} else if (type == PamIpcEvent::Request) {
|
||||
PamIpcRequestFlags flags {};
|
||||
|
||||
ok = this->pipes.readBytes(
|
||||
reinterpret_cast<char*>(&flags), // NOLINT
|
||||
sizeof(PamIpcRequestFlags)
|
||||
);
|
||||
ok = this->pipes.readBytes(reinterpret_cast<char*>(&flags), sizeof(PamIpcRequestFlags));
|
||||
|
||||
if (!ok) goto fail;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ std::string PamIpcPipes::readString(bool* ok) const {
|
|||
if (ok != nullptr) *ok = false;
|
||||
|
||||
uint32_t length = 0;
|
||||
if (!this->readBytes(reinterpret_cast<char*>(&length), sizeof(length))) { // NOLINT
|
||||
if (!this->readBytes(reinterpret_cast<char*>(&length), sizeof(length))) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ std::string PamIpcPipes::readString(bool* ok) const {
|
|||
|
||||
bool PamIpcPipes::writeString(const std::string& string) const {
|
||||
uint32_t length = string.length();
|
||||
if (!this->writeBytes(reinterpret_cast<char*>(&length), sizeof(length))) { // NOLINT
|
||||
if (!this->writeBytes(reinterpret_cast<char*>(&length), sizeof(length))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,17 +126,11 @@ PamIpcExitCode PamSubprocess::exec(const char* configDir, const char* config, co
|
|||
void PamSubprocess::sendCode(PamIpcExitCode code) {
|
||||
{
|
||||
auto eventType = PamIpcEvent::Exit;
|
||||
auto ok = this->pipes.writeBytes(
|
||||
reinterpret_cast<char*>(&eventType), // NOLINT
|
||||
sizeof(PamIpcEvent)
|
||||
);
|
||||
auto ok = this->pipes.writeBytes(reinterpret_cast<char*>(&eventType), sizeof(PamIpcEvent));
|
||||
|
||||
if (!ok) goto fail;
|
||||
|
||||
ok = this->pipes.writeBytes(
|
||||
reinterpret_cast<char*>(&code), // NOLINT
|
||||
sizeof(PamIpcExitCode)
|
||||
);
|
||||
ok = this->pipes.writeBytes(reinterpret_cast<char*>(&code), sizeof(PamIpcExitCode));
|
||||
|
||||
if (!ok) goto fail;
|
||||
|
||||
|
@ -175,17 +169,12 @@ int PamSubprocess::conversation(
|
|||
<< std::endl;
|
||||
|
||||
auto eventType = PamIpcEvent::Request;
|
||||
auto ok = delegate->pipes.writeBytes(
|
||||
reinterpret_cast<char*>(&eventType), // NOLINT
|
||||
sizeof(PamIpcEvent)
|
||||
);
|
||||
auto ok = delegate->pipes.writeBytes(reinterpret_cast<char*>(&eventType), sizeof(PamIpcEvent));
|
||||
|
||||
if (!ok) goto fail;
|
||||
|
||||
ok = delegate->pipes.writeBytes(
|
||||
reinterpret_cast<const char*>(&req), // NOLINT
|
||||
sizeof(PamIpcRequestFlags)
|
||||
);
|
||||
ok =
|
||||
delegate->pipes.writeBytes(reinterpret_cast<const char*>(&req), sizeof(PamIpcRequestFlags));
|
||||
|
||||
if (!ok) goto fail;
|
||||
if (!delegate->pipes.writeString(msgString)) goto fail;
|
||||
|
|
|
@ -42,9 +42,7 @@ template <typename T>
|
|||
class PwObject {
|
||||
public:
|
||||
explicit PwObject(T* object = nullptr): object(object) {}
|
||||
~PwObject() {
|
||||
pw_proxy_destroy(reinterpret_cast<pw_proxy*>(this->object)); // NOLINT
|
||||
}
|
||||
~PwObject() { pw_proxy_destroy(reinterpret_cast<pw_proxy*>(this->object)); }
|
||||
|
||||
Q_DISABLE_COPY_MOVE(PwObject);
|
||||
|
||||
|
|
|
@ -459,19 +459,19 @@ PwVolumeProps PwVolumeProps::parseSpaPod(const spa_pod* param) {
|
|||
const auto* channelsProp = spa_pod_find_prop(param, nullptr, SPA_PROP_channelMap);
|
||||
const auto* muteProp = spa_pod_find_prop(param, nullptr, SPA_PROP_mute);
|
||||
|
||||
const auto* volumes = reinterpret_cast<const spa_pod_array*>(&volumesProp->value); // NOLINT
|
||||
const auto* channels = reinterpret_cast<const spa_pod_array*>(&channelsProp->value); // NOLINT
|
||||
const auto* volumes = reinterpret_cast<const spa_pod_array*>(&volumesProp->value);
|
||||
const auto* channels = reinterpret_cast<const spa_pod_array*>(&channelsProp->value);
|
||||
|
||||
spa_pod* iter = nullptr;
|
||||
SPA_POD_ARRAY_FOREACH(volumes, iter) {
|
||||
// Cubing behavior found in MPD source, and appears to corrospond to everyone else's measurements correctly.
|
||||
auto linear = *reinterpret_cast<float*>(iter); // NOLINT
|
||||
auto linear = *reinterpret_cast<float*>(iter);
|
||||
auto visual = std::cbrt(linear);
|
||||
props.volumes.push_back(visual);
|
||||
}
|
||||
|
||||
SPA_POD_ARRAY_FOREACH(channels, iter) {
|
||||
props.channels.push_back(*reinterpret_cast<PwAudioChannel::Enum*>(iter)); // NOLINT
|
||||
props.channels.push_back(*reinterpret_cast<PwAudioChannel::Enum*>(iter));
|
||||
}
|
||||
|
||||
spa_pod_get_bool(&muteProp->value, &props.mute);
|
||||
|
|
|
@ -67,9 +67,7 @@ QDebug operator<<(QDebug debug, const PwBindableObject* object);
|
|||
template <typename T, StringLiteral INTERFACE, quint32 VERSION>
|
||||
class PwBindable: public PwBindableObject {
|
||||
public:
|
||||
T* proxy() {
|
||||
return reinterpret_cast<T*>(this->object); // NOLINT
|
||||
}
|
||||
T* proxy() { return reinterpret_cast<T*>(this->object); }
|
||||
|
||||
protected:
|
||||
void bind() override {
|
||||
|
|
|
@ -23,23 +23,23 @@ QImage DBusSniIconPixmap::createImage() const {
|
|||
// fix byte order if on a little endian machine
|
||||
if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
|
||||
auto* newbuf = new quint32[this->data.size()];
|
||||
const auto* oldbuf = reinterpret_cast<const quint32*>(this->data.constData()); // NOLINT
|
||||
const auto* oldbuf = reinterpret_cast<const quint32*>(this->data.constData());
|
||||
|
||||
for (uint i = 0; i < this->data.size() / sizeof(quint32); ++i) {
|
||||
newbuf[i] = qFromBigEndian(oldbuf[i]); // NOLINT
|
||||
}
|
||||
|
||||
return QImage(
|
||||
reinterpret_cast<const uchar*>(newbuf), // NOLINT
|
||||
reinterpret_cast<const uchar*>(newbuf),
|
||||
this->width,
|
||||
this->height,
|
||||
QImage::Format_ARGB32,
|
||||
[](void* ptr) { delete[] reinterpret_cast<quint32*>(ptr); }, // NOLINT
|
||||
[](void* ptr) { delete[] reinterpret_cast<quint32*>(ptr); },
|
||||
newbuf
|
||||
);
|
||||
} else {
|
||||
return QImage(
|
||||
reinterpret_cast<const uchar*>(this->data.constData()), // NOLINT
|
||||
reinterpret_cast<const uchar*>(this->data.constData()),
|
||||
this->width,
|
||||
this->height,
|
||||
QImage::Format_ARGB32
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue