Skip to content

Commit 174a33c

Browse files
committed
squashing almost all of them now!
1 parent c3c8571 commit 174a33c

8 files changed

Lines changed: 33 additions & 31 deletions

File tree

plugins/BinaryInfo/symbols.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ void collect_symbols(const void *p, Size size, std::vector<typename M::symbol> &
241241
auto symbol_tab = reinterpret_cast<elf_sym *>(base + linked->sh_offset);
242242
auto string_tab = reinterpret_cast<const char *>(base + sections_begin[linked->sh_link].sh_offset);
243243

244-
const elf_addr symbol_address = static_cast<elf_addr>(base_address + (n * M::plt_entry_size));
244+
const auto symbol_address = static_cast<elf_addr>(base_address + (n * M::plt_entry_size));
245245

246246
const char *sym_name = &section_strings[section->sh_name];
247247
if (strlen(sym_name) > (sizeof(".rela.") - 1) && memcmp(sym_name, ".rela.", (sizeof(".rela.") - 1)) == 0) {

plugins/CheckVersion/CheckVersion.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ void CheckVersion::setProxy(const QUrl &url) {
100100

101101
if (!proxy_str.isEmpty()) {
102102
const QUrl proxy_url = QUrl::fromUserInput(proxy_str);
103+
const int port = proxy_url.port(80);
104+
const auto qport = static_cast<quint16>(qBound(0, port, 65535));
103105

104-
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, proxy_url.host(), proxy_url.port(80), proxy_url.userName(), proxy_url.password());
106+
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, proxy_url.host(), qport, proxy_url.userName(), proxy_url.password());
105107
}
106108

107109
#else

plugins/ODbgRegisterView/DialogEditSimdRegister.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ void DialogEditSimdRegister::setupEntries(const QString &label, std::array<Numbe
3535

3636
contentsGrid->addWidget(new QLabel(label, this), row, ENTRIES_FIRST_COL - 1);
3737
for (std::size_t entryIndex = 0; entryIndex < NumEntries; ++entryIndex) {
38-
auto &entry = entries[entryIndex];
39-
const int bytesPerEntry = static_cast<int>(NumBytes / NumEntries);
40-
const int entryColumn = ENTRIES_FIRST_COL + bytesPerEntry * static_cast<int>(NumEntries - 1 - entryIndex);
41-
entry = new NumberEdit(entryColumn, bytesPerEntry, this);
38+
auto &entry = entries[entryIndex];
39+
const auto bytesPerEntry = static_cast<int>(NumBytes / NumEntries);
40+
const int entryColumn = ENTRIES_FIRST_COL + bytesPerEntry * static_cast<int>(NumEntries - 1 - entryIndex);
41+
entry = new NumberEdit(entryColumn, bytesPerEntry, this);
4242
entry->setNaturalWidthInChars(naturalWidthInChars);
4343
connect(entry, &NumberEdit::textEdited, this, slot);
4444
entry->installEventFilter(this);
@@ -442,7 +442,7 @@ template <class Integer>
442442
void DialogEditSimdRegister::onIntegerEdited(QObject *sender, const std::array<NumberEdit *, NumBytes / sizeof(Integer)> &elements) {
443443
const auto changedElementEdit = qobject_cast<NumberEdit *>(sender);
444444
std::size_t elementIndex = std::find(elements.begin(), elements.end(), changedElementEdit) - elements.begin();
445-
Integer value = static_cast<Integer>(readInteger(elements[elementIndex]));
445+
auto value = static_cast<Integer>(readInteger(elements[elementIndex]));
446446
std::memcpy(&value_[elementIndex * sizeof(value)], &value, sizeof(value));
447447
updateAllEntriesExcept(elements[elementIndex]);
448448
}

src/BinaryString.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void BinaryString::on_txtHex_textEdited(const QString &text) {
172172

173173
for (const QString &s : list1) {
174174

175-
const uint8_t ch = s.toUInt(nullptr, 16);
175+
const auto ch = static_cast<uint8_t>(s.toUInt(nullptr, 16));
176176

177177
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
178178
utf16Char = (utf16Char >> 8) | (ch << 8);

src/Debugger.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ void Debugger::showEvent(QShowEvent *) {
12031203
stackView_->setShowComments(settings.value("window.stack.show_comments.enabled", true).toBool());
12041204

12051205
int row_width = 1;
1206-
int word_width = edb::v1::pointer_size();
1206+
auto word_width = static_cast<int>(edb::v1::pointer_size());
12071207

12081208
stackView_->setRowWidth(row_width);
12091209
stackView_->setWordWidth(word_width);
@@ -3132,7 +3132,7 @@ void Debugger::setupDataViews() {
31323132
}
31333133

31343134
// Update stack word width
3135-
stackView_->setWordWidth(edb::v1::pointer_size());
3135+
stackView_->setWordWidth(static_cast<int>(edb::v1::pointer_size()));
31363136
}
31373137

31383138
//------------------------------------------------------------------------------

src/FloatX.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ const char *fixup_g_Yfmt(char *buffer, int digits10) {
203203

204204
// If point wasn't found, assume it's at the end of the number
205205
if (pointPos < 0) {
206-
pointPos = len;
206+
pointPos = static_cast<int>(len);
207207
}
208208

209209
const int signChars = buffer[0] == '-';
@@ -219,7 +219,7 @@ const char *fixup_g_Yfmt(char *buffer, int digits10) {
219219
// The original string may contain a point, may not contain any. In the
220220
// former case we must move everything including the null terminator. In
221221
// the latter case only the chunk up to the original point needs moving.
222-
const int lenWithNull = len + 1;
222+
const auto lenWithNull = static_cast<int>(len + 1);
223223

224224
char next = buf[1];
225225
for (int i = 0; i < lenWithNull - signChars; ++i) {
@@ -244,8 +244,8 @@ const char *fixup_g_Yfmt(char *buffer, int digits10) {
244244
// Append the exponent
245245
buf[len] = 'e';
246246
buf[len + 1] = '+';
247-
buf[len + 2] = exp / 10 + '0';
248-
buf[len + 3] = exp % 10 + '0';
247+
buf[len + 2] = static_cast<char>(exp / 10 + '0');
248+
buf[len + 3] = static_cast<char>(exp % 10 + '0');
249249
buf[len + 4] = 0;
250250
}
251251

src/Register.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ QString Register::toHexString() const {
4040
return tr("(Error: bad register length %1 bits)").arg(bitSize_);
4141
}
4242

43-
return value_.toHexString().right(bitSize_ / 4); // TODO: trimming should be moved to valueXX::toHexString()
43+
return value_.toHexString().right(static_cast<int>(bitSize_ / 4)); // TODO: trimming should be moved to valueXX::toHexString()
4444
}
4545

4646
/**

src/RegisterViewModelBase.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ QVariant Model::data(const QModelIndex &index, int role) const {
255255

256256
case FixedLengthRole:
257257
if (index.column() == NAME_COLUMN) {
258-
return item->name().size();
258+
return static_cast<int>(item->name().size());
259259
} else if (index.column() == VALUE_COLUMN) {
260260
return item->valueMaxLength();
261261
} else {
@@ -556,7 +556,7 @@ Category::Category(Category &&other) noexcept
556556
}
557557

558558
int Category::childCount() const {
559-
return registers.size();
559+
return static_cast<int>(registers.size());
560560
}
561561

562562
RegisterViewItem *Category::child(int row) {
@@ -596,7 +596,7 @@ bool Category::visible() const {
596596

597597
void Category::addRegister(std::unique_ptr<AbstractRegisterItem> reg) {
598598
registers.emplace_back(std::move(reg));
599-
registers.back()->init(this, registers.size() - 1);
599+
registers.back()->init(this, static_cast<int>(registers.size() - 1));
600600
}
601601

602602
AbstractRegisterItem *Category::getRegister(std::size_t i) const {
@@ -785,7 +785,7 @@ UnderlyingType BitFieldItem<UnderlyingType>::prevValue() const {
785785

786786
template <class UnderlyingType>
787787
int BitFieldItem<UnderlyingType>::valueMaxLength() const {
788-
return std::ceil(length_ / 4.); // number of nibbles
788+
return static_cast<int>((length_ + 3u) / 4u); // number of nibbles
789789
}
790790

791791
template <class UnderlyingType>
@@ -801,7 +801,7 @@ QVariant BitFieldItem<UnderlyingType>::data(int column) const {
801801
return name();
802802
case Model::VALUE_COLUMN:
803803
Q_ASSERT(str.size() > 0);
804-
return str.right(std::ceil(length_ / 4.));
804+
return str.right(static_cast<int>((length_ + 3u) / 4u));
805805
case Model::COMMENT_COLUMN:
806806
if (explanations.empty()) {
807807
return {};
@@ -835,13 +835,13 @@ FlagsRegister<StoredType>::FlagsRegister(const QString &name, const std::vector<
835835

836836
for (auto &field : bitFields) {
837837
fields.emplace_back(field);
838-
fields.back().init(this, fields.size() - 1);
838+
fields.back().init(this, static_cast<int>(fields.size() - 1));
839839
}
840840
}
841841

842842
template <class StoredType>
843843
int FlagsRegister<StoredType>::childCount() const {
844-
return fields.size();
844+
return static_cast<int>(fields.size());
845845
}
846846

847847
template <class StoredType>
@@ -982,13 +982,13 @@ SIMDSizedElement<StoredType, SizingType>::SIMDSizedElement(const QString &name,
982982
for (const auto format : validFormats) {
983983
if (format != NumberDisplayMode::Float || sizeof(SizingType) >= sizeof(float)) {
984984
// The order must be as expected by other functions
985-
Q_ASSERT(format != NumberDisplayMode::Float || formats.size() == Model::SIMD_FLOAT_ROW);
986-
Q_ASSERT(format != NumberDisplayMode::Hex || formats.size() == Model::SIMD_HEX_ROW);
987-
Q_ASSERT(format != NumberDisplayMode::Signed || formats.size() == Model::SIMD_SIGNED_ROW);
988-
Q_ASSERT(format != NumberDisplayMode::Unsigned || formats.size() == Model::SIMD_UNSIGNED_ROW);
985+
Q_ASSERT(format != NumberDisplayMode::Float || formats.size() == static_cast<size_t>(Model::SIMD_FLOAT_ROW));
986+
Q_ASSERT(format != NumberDisplayMode::Hex || formats.size() == static_cast<size_t>(Model::SIMD_HEX_ROW));
987+
Q_ASSERT(format != NumberDisplayMode::Signed || formats.size() == static_cast<size_t>(Model::SIMD_SIGNED_ROW));
988+
Q_ASSERT(format != NumberDisplayMode::Unsigned || formats.size() == static_cast<size_t>(Model::SIMD_UNSIGNED_ROW));
989989

990990
formats.emplace_back(format);
991-
formats.back().init(this, formats.size() - 1);
991+
formats.back().init(this, static_cast<int>(formats.size() - 1));
992992
}
993993
}
994994
}
@@ -1000,7 +1000,7 @@ RegisterViewItem *SIMDSizedElement<StoredType, SizingType>::child(int row) {
10001000

10011001
template <class StoredType, class SizingType>
10021002
int SIMDSizedElement<StoredType, SizingType>::childCount() const {
1003-
return formats.size();
1003+
return static_cast<int>(formats.size());
10041004
}
10051005

10061006
template <class StoredType, class SizingType>
@@ -1113,7 +1113,7 @@ RegisterViewItem *SIMDSizedElementsContainer<StoredType>::child(int row) {
11131113

11141114
template <class StoredType>
11151115
int SIMDSizedElementsContainer<StoredType>::childCount() const {
1116-
return elements.size();
1116+
return static_cast<int>(elements.size());
11171117
}
11181118

11191119
template <class StoredType>
@@ -1179,7 +1179,7 @@ SIMDRegister<StoredType>::SIMDRegister(const QString &name, const std::vector<Nu
11791179

11801180
template <class StoredType>
11811181
int SIMDRegister<StoredType>::childCount() const {
1182-
return sizedElementContainers.size();
1182+
return static_cast<int>(sizedElementContainers.size());
11831183
}
11841184

11851185
template <class StoredType>
@@ -1242,7 +1242,7 @@ void FPURegister<FloatType>::saveValue() {
12421242

12431243
template <class FloatType>
12441244
int FPURegister<FloatType>::childCount() const {
1245-
return formats.size();
1245+
return static_cast<int>(formats.size());
12461246
}
12471247

12481248
template <class FloatType>

0 commit comments

Comments
 (0)