1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-29 12:50:28 +00:00

Adds in a few further consts.

This commit is contained in:
Thomas Harte 2020-05-09 23:49:37 -04:00
parent 6dc7a4471d
commit 81d70ee325
5 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,7 @@ Analyser::Static::TargetList Analyser::Static::Macintosh::GetTargets(const Media
Analyser::Static::TargetList targets; Analyser::Static::TargetList targets;
using Target = Analyser::Static::Macintosh::Target; using Target = Analyser::Static::Macintosh::Target;
auto *target = new Target; auto *const target = new Target;
target->media = media; target->media = media;
targets.push_back(std::unique_ptr<Analyser::Static::Target>(target)); targets.push_back(std::unique_ptr<Analyser::Static::Target>(target));

View File

@ -34,7 +34,7 @@ Analyser::Static::TargetList Analyser::Static::ZX8081::GetTargets(const Media &m
std::vector<Storage::Data::ZX8081::File> files = GetFiles(media.tapes.front()); std::vector<Storage::Data::ZX8081::File> files = GetFiles(media.tapes.front());
media.tapes.front()->reset(); media.tapes.front()->reset();
if(!files.empty()) { if(!files.empty()) {
Target *target = new Target; Target *const target = new Target;
destination.push_back(std::unique_ptr<::Analyser::Static::Target>(target)); destination.push_back(std::unique_ptr<::Analyser::Static::Target>(target));
target->machine = Machine::ZX8081; target->machine = Machine::ZX8081;

View File

@ -20,7 +20,7 @@ Keyboard::Keyboard(const std::set<Key> &observed_keys, const std::set<Key> &esse
observed_keys_(observed_keys), essential_modifiers_(essential_modifiers), is_exclusive_(false) {} observed_keys_(observed_keys), essential_modifiers_(essential_modifiers), is_exclusive_(false) {}
bool Keyboard::set_key_pressed(Key key, char value, bool is_pressed) { bool Keyboard::set_key_pressed(Key key, char value, bool is_pressed) {
std::size_t key_offset = size_t(key); const size_t key_offset = size_t(key);
if(key_offset >= key_states_.size()) { if(key_offset >= key_states_.size()) {
key_states_.resize(key_offset+1, false); key_states_.resize(key_offset+1, false);
} }
@ -44,7 +44,7 @@ void Keyboard::set_delegate(Delegate *delegate) {
} }
bool Keyboard::get_key_state(Key key) { bool Keyboard::get_key_state(Key key) {
std::size_t key_offset = size_t(key); const size_t key_offset = size_t(key);
if(key_offset >= key_states_.size()) return false; if(key_offset >= key_states_.size()) return false;
return key_states_[key_offset]; return key_states_[key_offset];
} }

View File

@ -110,7 +110,7 @@ class QuadratureMouse: public Mouse {
} }
private: private:
int number_of_buttons_ = 0; const int number_of_buttons_ = 0;
std::atomic<int> button_flags_; std::atomic<int> button_flags_;
std::atomic<int> axes_[2]; std::atomic<int> axes_[2];

View File

@ -15,7 +15,7 @@ MachineTypes::MappedKeyboardMachine::MappedKeyboardMachine(const std::set<Inputs
} }
bool MappedKeyboardMachine::keyboard_did_change_key(Inputs::Keyboard *keyboard, Inputs::Keyboard::Key key, bool is_pressed) { bool MappedKeyboardMachine::keyboard_did_change_key(Inputs::Keyboard *keyboard, Inputs::Keyboard::Key key, bool is_pressed) {
uint16_t mapped_key = get_keyboard_mapper()->mapped_key_for_key(key); const uint16_t mapped_key = get_keyboard_mapper()->mapped_key_for_key(key);
if(mapped_key == KeyNotMapped) return false; if(mapped_key == KeyNotMapped) return false;
set_key_state(mapped_key, is_pressed); set_key_state(mapped_key, is_pressed);
return true; return true;