Skip to content

Commit 7b2e8f3

Browse files
committed
Address some remaining c-style casts
1 parent 875cd50 commit 7b2e8f3

8 files changed

Lines changed: 14 additions & 14 deletions

File tree

form/root_storage/root_rfield_read_container.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ namespace form::detail::experimental {
7979
createView(type);
8080
}
8181

82-
if (id >= (int)m_reader->GetNEntries())
82+
if (id >= static_cast<int>(m_reader->GetNEntries())) {
8383
return false;
84+
}
8485

8586
//Using RNTupleView<> to read instead of reusing REntry gives us full schema evolution support: the ROOT feature that lets us read files with an old class version into a new class version's memory.
8687
auto buffer = m_view->GetField().CreateObject<void>(); //PHLEX gets ownership of this memory

form/storage/storage_reader.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ namespace {
147147
if (components.empty()) {
148148
return false;
149149
}
150-
for (auto const& [key, value] : components) {
151-
(void)key;
150+
for (auto const& [_, value] : components) {
152151
if (value != 0) {
153152
return false;
154153
}
@@ -356,8 +355,7 @@ std::vector<std::string> StorageReader::listIndices(
356355

357356
std::vector<std::string> result;
358357
result.reserve(ordered.size());
359-
for (auto const& [entry, index_string] : ordered) {
360-
(void)entry;
358+
for (auto const& [_, index_string] : ordered) {
361359
result.push_back(index_string);
362360
}
363361
return result;

phlex/model/index_generator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ namespace phlex {
7979
return *this;
8080
}
8181

82-
void operator++(int) { (void)++(*this); }
82+
void operator++(int) { ++(*this); }
8383

8484
value_type const& operator*() const noexcept { return coroutine_.promise().current_; }
8585
value_type const* operator->() const noexcept

plugins/python/src/configwrap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static PyObject* pcm_subscript(py_config_map* pycmap, PyObject* pykey)
9898
pyvalue = PyTuple_New(*cvalue_size);
9999
// We can use std::views::enumerate once the AppleClang C++ STL supports it.
100100
for (Py_ssize_t i = 0; i < *cvalue_size; ++i) {
101-
PyObject* item = PyLong_FromLong((long)cvalue[i]);
101+
PyObject* item = PyLong_FromLong(static_cast<long>(cvalue[i]));
102102
PyTuple_SetItem(pyvalue, i, item);
103103
}
104104
} else if (k.first == boost::json::kind::int64) {

plugins/python/src/dyncall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void phlex::experimental::dyncall(void* fn, dcarg& result, dcargs_t& args, int v
110110
// because libffi is, and that yields a plethora of warnings from clang-tidy,
111111
// none of which warrant actual changes.
112112
// NOLINTBEGIN
113-
std::size_t nargs = (std::size_t)args.size();
113+
std::size_t nargs = args.size();
114114

115115
auto t = std::make_unique<ffi_type*[]>(nargs);
116116
auto p = std::make_unique<void*[]>(nargs);

plugins/python/src/modulewrap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ namespace {
177177
PyGILRAII gil;
178178

179179
dcarg result{nullptr};
180-
dyncall((void*)m_ccallback, result, argsv, 1);
180+
dyncall(m_ccallback, result, argsv, 1);
181181

182182
std::string error_msg;
183183
if (!result.get<PyObject*>()) {
@@ -227,7 +227,7 @@ namespace {
227227
argsv.reserve(sizeof...(Is));
228228
(argsv.push_back(args), ...);
229229

230-
dyncall((void*)m_ccallback, result, argsv);
230+
dyncall(m_ccallback, result, argsv);
231231
// TODO: error reporting?
232232

233233
if constexpr (!std::is_void_v<RT>) {

plugins/python/src/pymodule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static bool initialize()
210210
// Python interpreter will not happen atm.
211211
static std::atomic<bool> gil_released{false};
212212
if (!gil_released.exchange(true)) {
213-
(void)PyEval_SaveThread(); // state not saved, as no place to restore
213+
PyEval_SaveThread(); // state not saved, as no place to restore
214214
}
215215

216216
return true;

test/form/form_source_extra_types.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include "form/form_source_type_registry.hpp"
22
#include "phlex/module.hpp"
33

4+
#include <utility>
5+
46
using namespace phlex;
57

68
namespace {
@@ -23,9 +25,8 @@ namespace {
2325
}
2426
}
2527

26-
PHLEX_REGISTER_ALGORITHMS(m, config)
28+
PHLEX_REGISTER_ALGORITHMS(m)
2729
{
28-
(void)m;
29-
(void)config;
30+
std::ignore = m;
3031
register_extra_form_types_once();
3132
}

0 commit comments

Comments
 (0)