Skip to content

Commit

Permalink
replace C-style casts with C++ static_casts
Browse files Browse the repository at this point in the history
  • Loading branch information
schlimmchen committed Nov 12, 2024
1 parent 386e6b8 commit d5d66ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cpplint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install cpplint==1.6.1
pip install cpplint
- name: Linting
run: |
cpplint --repository=. --recursive \
Expand Down
2 changes: 1 addition & 1 deletion src/HttpGetter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ HttpRequestResult HttpGetter::performGetRequest()
// depth at https://github.com/espressif/esp-idf/issues/2507#issuecomment-761836300
// in conclusion: we cannot rely on _upHttpClient->begin(*wifiClient, url) to resolve
// IP adresses. have to do it manually.
IPAddress ipaddr((uint32_t)0);
IPAddress ipaddr(static_cast<uint32_t>(0));

if (!ipaddr.fromString(_host)) {
// host is not an IP address, so try to resolve the name to an address.
Expand Down
7 changes: 5 additions & 2 deletions src/JbdBmsSerialMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ bool SerialResponse::isValid() const {
Status const actualStatus = getStatus();
if (actualStatus != Status::Ok) {
MessageOutput.printf("JbdBms::SerialMessage: invalid status 0x%02x, expected 0x%02x\r\n",
(uint32_t) actualStatus, (uint32_t) Status::Ok);
static_cast<uint32_t>(actualStatus),
static_cast<uint32_t>(Status::Ok));
return false;
}

Expand All @@ -259,7 +260,9 @@ bool SerialCommand::isValid() const {
Status const actualStatus = getStatus();
if (actualStatus != Status::Read || actualStatus != Status::Write) {
MessageOutput.printf("JbdBms::SerialMessage: invalid status 0x%02x, expected 0x%02x or 0x%02x\r\n",
(uint32_t) actualStatus, (uint32_t) Status::Read, (uint32_t) Status::Write);
static_cast<uint32_t>(actualStatus),
static_cast<uint32_t>(Status::Read),
static_cast<uint32_t>(Status::Write));
return false;
}

Expand Down

0 comments on commit d5d66ec

Please sign in to comment.