Skip to content

Commit 059ad1b

Browse files
committed
Fix a few warnings.
1 parent 92b35a6 commit 059ad1b

12 files changed

+45
-51
lines changed

src/BitEditor.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1616
*/
1717

18-
#define __STDC_FORMAT_MACROS
19-
2018
#include "platform.hpp"
2119

2220
#include <inttypes.h>
@@ -297,7 +295,7 @@ void REHex::BitEditor::update()
297295
uint64_t old_val = value + 1;
298296
try {
299297
int num_value_base = get_num_base();
300-
old_val = num_value->GetValue<uint64_t>(0, std::numeric_limits<uint64_t>::max(), 0, num_value_base);
298+
old_val = num_value->GetNumValue<uint64_t>(0, std::numeric_limits<uint64_t>::max(), 0, num_value_base);
301299
}
302300
catch(const REHex::NumericTextCtrl::InputError&) {}
303301

@@ -516,7 +514,7 @@ void REHex::BitEditor::OnValueChange(wxCommandEvent &event)
516514

517515
uint64_t new_value;
518516
try {
519-
new_value = num_value->GetValue<uint64_t>(0, max_value, 0, num_value_base);
517+
new_value = num_value->GetNumValue<uint64_t>(0, max_value, 0, num_value_base);
520518
}
521519
catch(const REHex::NumericTextCtrl::InputError &e)
522520
{

src/BitmapTool.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ enum {
7575
ID_BACKGROUND,
7676
};
7777

78-
/* The minimum interval between updates when rendering the preview bitmap.
79-
* This only comes into play if the system is heavily loaded - normally we will
80-
* render chunks at a time in idle events and reset the timer.
81-
*/
82-
static const int UPDATE_TIMER_MS = 250;
83-
8478
BEGIN_EVENT_TABLE(REHex::BitmapTool, wxPanel)
8579
EVT_CHOICE(ID_COLOUR_DEPTH, REHex::BitmapTool::OnDepth)
8680
EVT_CHOICE(ID_COLOUR_FORMAT, REHex::BitmapTool::OnFormat)
@@ -358,7 +352,7 @@ void REHex::BitmapTool::reset_row_length_spinner()
358352
void REHex::BitmapTool::update()
359353
{
360354
try {
361-
image_offset = offset_textctrl->GetValue<BitOffset>(BitOffset::ZERO);
355+
image_offset = offset_textctrl->GetNumValue<BitOffset>(BitOffset::ZERO);
362356
}
363357
catch(const NumericTextCtrl::InputError&)
364358
{

src/ByteRangeSet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#include "ByteRangeSet.hpp"
2727

28-
static const long long INT61_MIN = -0x1000000000000000LL;
28+
// static const long long INT61_MIN = -0x1000000000000000LL;
2929
static const long long INT61_MAX = 0xFFFFFFFFFFFFFFFLL;
3030

3131
template<> off_t REHex::RangeSet<off_t>::MAX()

src/FillRangeDialog.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Reverse Engineer's Hex Editor
2-
* Copyright (C) 2020-2024 Daniel Collins <solemnwarning@solemnwarning.net>
2+
* Copyright (C) 2020-2025 Daniel Collins <solemnwarning@solemnwarning.net>
33
*
44
* This program is free software; you can redistribute it and/or modify it
55
* under the terms of the GNU General Public License version 2 as published by
@@ -194,10 +194,10 @@ void REHex::FillRangeDialog::OnOK(wxCommandEvent &event)
194194
try {
195195
if(insert_mode_selected)
196196
{
197-
selection_off = range_from->GetValue<off_t>(0, doc_length);
197+
selection_off = range_from->GetNumValue<off_t>(0, doc_length);
198198
}
199199
else{
200-
selection_off = range_from->GetValue<off_t>(0, (doc_length - 1));
200+
selection_off = range_from->GetNumValue<off_t>(0, (doc_length - 1));
201201
}
202202
}
203203
catch(const NumericTextCtrl::InputError &e)
@@ -214,11 +214,11 @@ void REHex::FillRangeDialog::OnOK(wxCommandEvent &event)
214214
try {
215215
if(insert_mode_selected)
216216
{
217-
off_t selection_to = range_to->GetValue<off_t>(selection_off);
217+
off_t selection_to = range_to->GetNumValue<off_t>(selection_off);
218218
selection_length = (selection_to - selection_off) + 1;
219219
}
220220
else{
221-
off_t selection_to = range_to->GetValue<off_t>(selection_off, (doc_length - 1));
221+
off_t selection_to = range_to->GetNumValue<off_t>(selection_off, (doc_length - 1));
222222
selection_length = (selection_to - selection_off) + 1;
223223
}
224224
}
@@ -235,10 +235,10 @@ void REHex::FillRangeDialog::OnOK(wxCommandEvent &event)
235235
try {
236236
if(insert_mode_selected)
237237
{
238-
selection_length = range_len->GetValue<off_t>(0);
238+
selection_length = range_len->GetNumValue<off_t>(0);
239239
}
240240
else{
241-
selection_length = range_len->GetValue<off_t>(0, (doc_length - selection_off));
241+
selection_length = range_len->GetNumValue<off_t>(0, (doc_length - selection_off));
242242
}
243243
}
244244
catch(const NumericTextCtrl::InputError &e)

src/NumericEntryDialog.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Reverse Engineer's Hex Editor
2-
* Copyright (C) 2018-2024 Daniel Collins <solemnwarning@solemnwarning.net>
2+
* Copyright (C) 2018-2025 Daniel Collins <solemnwarning@solemnwarning.net>
33
*
44
* This program is free software; you can redistribute it and/or modify it
55
* under the terms of the GNU General Public License version 2 as published by
@@ -195,16 +195,16 @@ namespace REHex {
195195
{
196196
case BaseHint::AUTO_FORCE:
197197
case BaseHint::AUTO:
198-
return textbox->GetValue(min_value, max_value, rel_base, 0);
198+
return textbox->GetNumValue(min_value, max_value, rel_base, 0);
199199

200200
case BaseHint::DEC:
201-
return textbox->GetValue(min_value, max_value, rel_base, 10);
201+
return textbox->GetNumValue(min_value, max_value, rel_base, 10);
202202

203203
case BaseHint::HEX:
204-
return textbox->GetValue(min_value, max_value, rel_base, 16);
204+
return textbox->GetNumValue(min_value, max_value, rel_base, 16);
205205

206206
case BaseHint::OCT:
207-
return textbox->GetValue(min_value, max_value, rel_base, 8);
207+
return textbox->GetNumValue(min_value, max_value, rel_base, 8);
208208
}
209209

210210
/* Unreachable. */

src/NumericTextCtrl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,15 @@ namespace REHex {
344344

345345
template<typename T>
346346
typename std::enable_if<std::numeric_limits<T>::is_integer, T>::type
347-
GetValue(T min = std::numeric_limits<T>::min(), T max = std::numeric_limits<T>::max(), T rel_base = 0, int base = 0)
347+
GetNumValue(T min = std::numeric_limits<T>::min(), T max = std::numeric_limits<T>::max(), T rel_base = 0, int base = 0)
348348
{
349349
std::string sval = wxTextCtrl::GetValue().ToStdString();
350350
return ParseValue<T>(sval, min, max, rel_base, base);
351351
}
352352

353353
template<typename T>
354354
typename std::enable_if<std::is_same<T, BitOffset>::value, T>::type
355-
GetValue(T min = BitOffset::MIN, T max = BitOffset::MAX, T rel_base = BitOffset::ZERO, int base = 0, bool *bit_explicit = NULL)
355+
GetNumValue(T min = BitOffset::MIN, T max = BitOffset::MAX, T rel_base = BitOffset::ZERO, int base = 0, bool *bit_explicit = NULL)
356356
{
357357
std::string sval = wxTextCtrl::GetValue().ToStdString();
358358
return ParseValue<T>(sval, min, max, rel_base, base, bit_explicit);

src/RangeDialog.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Reverse Engineer's Hex Editor
2-
* Copyright (C) 2019-2024 Daniel Collins <solemnwarning@solemnwarning.net>
2+
* Copyright (C) 2019-2025 Daniel Collins <solemnwarning@solemnwarning.net>
33
*
44
* This program is free software; you can redistribute it and/or modify it
55
* under the terms of the GNU General Public License version 2 as published by
@@ -219,7 +219,7 @@ void REHex::RangeDialog::OnOK(wxCommandEvent &event)
219219
BitOffset virt_offset;
220220
bool virt_offset_bit;
221221
try {
222-
virt_offset = range_from->GetValue<BitOffset>(BitOffset::MIN, BitOffset::MAX, BitOffset::ZERO, 0, &virt_offset_bit);
222+
virt_offset = range_from->GetNumValue<BitOffset>(BitOffset::MIN, BitOffset::MAX, BitOffset::ZERO, 0, &virt_offset_bit);
223223
}
224224
catch(const NumericTextCtrl::InputError &e)
225225
{
@@ -243,7 +243,7 @@ void REHex::RangeDialog::OnOK(wxCommandEvent &event)
243243
BitOffset virt_end_incl;
244244
bool virt_end_bit;
245245
try {
246-
virt_end_incl = range_to->GetValue<BitOffset>(BitOffset::MIN, BitOffset::MAX, BitOffset::ZERO, 0, &virt_end_bit);
246+
virt_end_incl = range_to->GetNumValue<BitOffset>(BitOffset::MIN, BitOffset::MAX, BitOffset::ZERO, 0, &virt_end_bit);
247247
}
248248
catch(const NumericTextCtrl::InputError &e)
249249
{
@@ -266,7 +266,7 @@ void REHex::RangeDialog::OnOK(wxCommandEvent &event)
266266
{
267267
BitOffset length;
268268
try {
269-
length = range_len->GetValue<BitOffset>(BitOffset(0, 1));
269+
length = range_len->GetNumValue<BitOffset>(BitOffset(0, 1));
270270
}
271271
catch(const NumericTextCtrl::InputError &e)
272272
{

src/VirtualMappingDialog.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Reverse Engineer's Hex Editor
2-
* Copyright (C) 2021 Daniel Collins <solemnwarning@solemnwarning.net>
2+
* Copyright (C) 2021-2025 Daniel Collins <solemnwarning@solemnwarning.net>
33
*
44
* This program is free software; you can redistribute it and/or modify it
55
* under the terms of the GNU General Public License version 2 as published by
@@ -184,20 +184,20 @@ off_t REHex::VirtualMappingDialog::get_real_base()
184184
off_t min = 0;
185185
off_t max = std::max<off_t>(0, (document->buffer_length() - 1));;
186186

187-
return real_base_input->GetValue<off_t>(min, max);
187+
return real_base_input->GetNumValue<off_t>(min, max);
188188
}
189189

190190
off_t REHex::VirtualMappingDialog::get_virt_base()
191191
{
192-
return virt_base_input->GetValue<off_t>(0);
192+
return virt_base_input->GetNumValue<off_t>(0);
193193
}
194194

195195
off_t REHex::VirtualMappingDialog::get_segment_length(off_t real_base)
196196
{
197197
off_t min = 1;
198198
off_t max = document->buffer_length() - real_base;
199199

200-
return segment_length_input->GetValue<off_t>(min, max);
200+
return segment_length_input->GetNumValue<off_t>(min, max);
201201
}
202202

203203
void REHex::VirtualMappingDialog::update_warning()

src/decodepanel.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1616
*/
1717

18-
#define __STDC_FORMAT_MACROS
19-
2018
#include "platform.hpp"
2119
#include <assert.h>
2220
#include <inttypes.h>

src/document.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,11 @@ int REHex::Document::allocate_highlight_colour(const wxString &label, const wxCo
11511151
}
11521152

11531153
_tracked_change("change highlight colours",
1154-
[this, primary_colour, secondary_colour, label, next_highlight_idx]()
1154+
[this, primary_colour, secondary_colour, label
1155+
#ifndef NDEBUG
1156+
, next_highlight_idx
1157+
#endif
1158+
]()
11551159
{
11561160
auto new_colour_it = highlight_colour_map.add();
11571161
assert(new_colour_it != highlight_colour_map.end());

0 commit comments

Comments
 (0)