commit fb83614cfebb6a69cb63684c25f114e3ea928659
parent 9153e832625df4283ce289aa02775e8f246343e5
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sat, 26 Feb 2022 18:10:32 -0500
cleanup a few C-style casts
Diffstat:
10 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/about.cpp b/src/about.cpp
@@ -244,7 +244,7 @@ void About::setAction(const std::string &label)
void About::selectLink(const int ctrl)
{
const auto &links = m_links[ctrl];
- const int count = (int)links.size();
+ const int count = static_cast<int>(links.size());
m_tabs->setFocus();
diff --git a/src/api_package.cpp b/src/api_package.cpp
@@ -87,7 +87,7 @@ type: see <a href="#ReaPack_GetEntryInfo">ReaPack_GetEntryInfo</a>.)",
if(sectionsOut)
*sectionsOut = file.sections;
if(typeOut)
- *typeOut = (int)file.type;
+ *typeOut = static_cast<int>(file.type);
return entry->files.size() > i + 1;
});
@@ -127,7 +127,7 @@ type: 1=script, 2=extension, 3=effect, 4=data, 5=theme, 6=langpack, 7=webinterfa
if(descOut)
snprintf(descOut, descOut_sz, "%s", regEntry.description.c_str());
if(typeOut)
- *typeOut = (int)regEntry.type;
+ *typeOut = static_cast<int>(regEntry.type);
if(verOut)
snprintf(verOut, verOut_sz, "%s", regEntry.version.toString().c_str());
if(authorOut)
@@ -135,7 +135,7 @@ type: 1=script, 2=extension, 3=effect, 4=data, 5=theme, 6=langpack, 7=webinterfa
if(pinnedOut)
*pinnedOut = regEntry.pinned;
if(fileCountOut)
- *fileCountOut = (int)entry->files.size();
+ *fileCountOut = static_cast<int>(entry->files.size());
return true;
});
diff --git a/src/archive.cpp b/src/archive.cpp
@@ -205,7 +205,7 @@ int ArchiveReader::extractFile(const Path &path, std::ostream &stream) noexcept
std::string buffer(BUFFER_SIZE, 0);
const auto readChunk = [&] {
- return unzReadCurrentFile(m_zip, &buffer[0], (int)buffer.size());
+ return unzReadCurrentFile(m_zip, &buffer[0], static_cast<int>(buffer.size()));
};
while(const int len = readChunk()) {
@@ -287,7 +287,7 @@ int ArchiveWriter::addFile(const Path &path, std::istream &stream) noexcept
const auto readChunk = [&] {
stream.read(&buffer[0], buffer.size());
- return (int)stream.gcount();
+ return static_cast<int>(stream.gcount());
};
while(const int len = readChunk()) {
diff --git a/src/browser.cpp b/src/browser.cpp
@@ -641,7 +641,7 @@ void Browser::aboutRemote(const int index, const bool focus)
void Browser::installLatestAll()
{
InstallOpts &installOpts = g_reapack->config()->install;
- const bool isEverything = (size_t)m_list->selectionSize() == m_entries.size();
+ const bool isEverything = static_cast<size_t>(m_list->selectionSize()) == m_entries.size();
if(isEverything && !installOpts.autoInstall) {
const int btn = Win32::messageBox(handle(), "Do you want ReaPack to install"
diff --git a/src/browser_entry.cpp b/src/browser_entry.cpp
@@ -195,7 +195,7 @@ void Browser::Entry::fillMenu(Menu &menu) const
menu.disable(versionMenuIndex);
else {
const auto &versions = package->versions();
- int verIndex = (int)versions.size();
+ int verIndex = static_cast<int>(versions.size());
for(const Version *ver : versions | boost::adaptors::reversed) {
const UINT actionIndex = versionMenu.addAction(
ver->name().toString().c_str(), --verIndex | (ACTION_VERSION << 8));
diff --git a/src/config.cpp b/src/config.cpp
@@ -150,8 +150,8 @@ void Config::read()
network.proxy = getString(NETWORK_GRP, PROXY_KEY, network.proxy);
network.verifyPeer = getBool(NETWORK_GRP, VERIFYPEER_KEY, network.verifyPeer);
- network.staleThreshold = (time_t)getUInt(NETWORK_GRP,
- STALETHRSH_KEY, (unsigned int)network.staleThreshold);
+ network.staleThreshold = static_cast<time_t>(getUInt(NETWORK_GRP,
+ STALETHRSH_KEY, static_cast<unsigned int>(network.staleThreshold)));
filter.expandSynonyms = getBool(BROWSER_GRP, SYNONYMS_KEY, filter.expandSynonyms);
diff --git a/src/database.cpp b/src/database.cpp
@@ -82,7 +82,7 @@ auto Database::version() const -> Version
void Database::setVersion(const Version &version)
{
- int32_t value = version.minor | (int32_t)version.major << 16;
+ int32_t value = version.minor | static_cast<int32_t>(version.major) << 16;
char sql[255];
sprintf(sql, "PRAGMA user_version = %" PRId32, value);
diff --git a/src/iconlist.cpp b/src/iconlist.cpp
@@ -28,7 +28,8 @@ DEFINE_ICON(UncheckedIcon, 142, "unchecke");
IconList::IconList(const std::initializer_list<const Win32::char_type *> &icons)
{
- m_list = ImageList_Create(16, 16, 1, (int)icons.size(), (int)icons.size());
+ m_list = ImageList_Create(16, 16, 1,
+ static_cast<int>(icons.size()), static_cast<int>(icons.size()));
for(const auto *icon : icons)
loadIcon(icon);
diff --git a/src/manager.cpp b/src/manager.cpp
@@ -187,7 +187,7 @@ void Manager::onCommand(const int id, int)
// IDOK -> continue to next case (IDCANCEL)
}
else {
- setChange(-(int)m_uninstall.size());
+ setChange(-static_cast<int>(m_uninstall.size()));
m_uninstall.clear();
refresh();
break;
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
@@ -111,7 +111,7 @@ void TabBar::switchPage()
const int index = currentIndex();
onTabChange(index);
- if(index < 0 || (size_t)index >= m_pages.size()) {
+ if(index < 0 || static_cast<size_t>(index) >= m_pages.size()) {
m_lastPage = -1;
return;
}