Skip to content

Commit

Permalink
warning cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
p3p committed Jun 18, 2024
1 parent c8d17c2 commit e6263f6
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 23 deletions.
12 changes: 6 additions & 6 deletions src/MarlinSimulator/RawSocketSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RawSocketSerial {
}
SDLNet_TCP_Close(server.socket);

for (auto i = 0; i < ServerInfo::max_connections; ++i) {
for (uint32_t i = 0; i < ServerInfo::max_connections; ++i) {
if (server.sockets[i] == nullptr) continue;
close_socket(i);
}
Expand Down Expand Up @@ -122,8 +122,8 @@ class RawSocketSerial {
}

int32_t send(int index) {
std::size_t length = tx_buffer.read(transmit_buffer, ServerInfo::max_packet_size);
int num_sent = SDLNet_TCP_Send(server.sockets[index], transmit_buffer, length);
std::size_t length = tx_buffer.read(transmit_buffer, ServerInfo::max_packet_size);
std::size_t num_sent = SDLNet_TCP_Send(server.sockets[index], transmit_buffer, length);
if (num_sent < length) {
fprintf(stderr, "RawSocketSerial::send: SDLNet_TCP_Send: %s\n", SDLNet_GetError());
close_socket(index);
Expand All @@ -136,7 +136,7 @@ class RawSocketSerial {
int num_rdy = SDLNet_CheckSockets(server.socket_set, 0);

if (num_rdy <= 0) {
for (auto i = 0; i < server.max_connections; ++i) {
for (uint32_t i = 0; i < server.max_connections; ++i) {
if (server.sockets[i] != nullptr) send(i);
}
std::this_thread::sleep_for(std::chrono::nanoseconds(1));
Expand All @@ -150,7 +150,7 @@ class RawSocketSerial {
continue;
}

int chk_count = 0;
uint32_t chk_count = 0;
for (; chk_count < ServerInfo::max_connections; ++chk_count) {
if (server.sockets[(server.next_index + chk_count) % ServerInfo::max_connections] == nullptr) break;
}
Expand All @@ -160,7 +160,7 @@ class RawSocketSerial {
num_rdy--;
}

for (int ind = 0; (ind < ServerInfo::max_connections) && num_rdy; ++ind) {
for (uint32_t ind = 0; (ind < ServerInfo::max_connections) && num_rdy; ++ind) {
if (server.sockets[ind] == nullptr) continue;
if (!SDLNet_SocketReady(server.sockets[ind])) continue;
receive(ind--);
Expand Down
1 change: 0 additions & 1 deletion src/MarlinSimulator/hardware/HD44780Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class HD44780Device: public VirtualPrinter::Component {
if (active_address_space == DDRAM) {
uint32_t max_address_counter = (display_lines == 1) ? 0x4F : 0x67;
if (address_counter > max_address_counter) address_counter -= max_address_counter + 1;
else if (address_counter < 0) address_counter = max_address_counter;
else if (display_lines == 2 && address_counter > 0x27 && address_counter < 0x40) address_counter = 0x40 + (address_counter - 0x28);
} else address_counter &= 0x3F;
};
Expand Down
2 changes: 1 addition & 1 deletion src/MarlinSimulator/hardware/SPISlavePeripheral.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class SPISlavePeripheral : public VirtualPrinter::Component {
protected:
void interrupt(GpioEvent& ev);
void interrupt(SpiEvent& ev);
SpiBus &spi_bus;
pin_type cs_pin;

private:
Expand All @@ -50,5 +51,4 @@ class SPISlavePeripheral : public VirtualPrinter::Component {
uint8_t *requestedData = nullptr;
size_t requestedDataSize = 0;
size_t requestedDataIndex = 0;
SpiBus &spi_bus;
};
1 change: 0 additions & 1 deletion src/MarlinSimulator/hardware/pwm_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ void PWMReader::ui_widget() {

void PWMReader::interrupt(GpioEvent& ev) {
if (ev.pin_id == pwm_pin) {
double time_delta = Kernel::TimeControl::ticksToNanos(ev.timestamp - pwm_last_update) / (double)Kernel::TimeControl::ONE_BILLION;
pwm_last_update = ev.timestamp;
if (ev.event == ev.RISE) {
if (pwm_hightick) {
Expand Down
10 changes: 5 additions & 5 deletions src/MarlinSimulator/marlin_arduino_impl/WString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,35 +290,35 @@ unsigned char String::concat(char c)

unsigned char String::concat(unsigned char num)
{
char buf[1 + 3 * sizeof(unsigned char)];
char buf[1 + 3 * sizeof(unsigned char)] {};
//itoa(num, buf, 10);
return concat(buf, strlen(buf));
}

unsigned char String::concat(int num)
{
char buf[2 + 3 * sizeof(int)];
char buf[2 + 3 * sizeof(int)] {};
//itoa(num, buf, 10);
return concat(buf, strlen(buf));
}

unsigned char String::concat(unsigned int num)
{
char buf[1 + 3 * sizeof(unsigned int)];
char buf[1 + 3 * sizeof(unsigned int)] {};
//utoa(num, buf, 10);
return concat(buf, strlen(buf));
}

unsigned char String::concat(long num)
{
char buf[2 + 3 * sizeof(long)];
char buf[2 + 3 * sizeof(long)] {};
//ltoa(num, buf, 10);
return concat(buf, strlen(buf));
}

unsigned char String::concat(unsigned long num)
{
char buf[1 + 3 * sizeof(unsigned long)];
char buf[1 + 3 * sizeof(unsigned long)] {};
//ultoa(num, buf, 10);
return concat(buf, strlen(buf));
}
Expand Down
4 changes: 2 additions & 2 deletions src/MarlinSimulator/resources/resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace resource {
m_data[size] = 0;
} else {
m_data.clear();
m_buffer = nullptr;
m_buffer = {};
}
}

Expand Down Expand Up @@ -62,7 +62,7 @@ namespace resource {

std::string_view ResourceManager::get_as_sv(std::filesystem::path path) {
auto value = get(path);
return value != nullptr ? value->m_buffer : nullptr;
return value != nullptr ? value->m_buffer : std::string_view {};
}

}
2 changes: 1 addition & 1 deletion src/MarlinSimulator/user_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class UiWindow {

class UiPopup : public UiWindow {
public:
template<class... Args> UiPopup(std::string name, bool is_modal, Args... args) : m_is_modal{is_modal}, UiWindow(name, args...) {
template<class... Args> UiPopup(std::string name, bool is_modal, Args... args) : UiWindow(name, args...), m_is_modal{is_modal} {
listed_on_main_menu = false;
}

Expand Down
12 changes: 6 additions & 6 deletions vendor/vcd-writer-b4fe347/src/vcd_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ struct VarSearch

// -----------------------------
VCDWriter::VCDWriter(const std::string &filename, HeadPtr &header, unsigned init_timestamp) :
_filename(filename),
_timestamp(init_timestamp),
_header((header) ? std::move(header) : makeVCDHeader()),
_registering(true),
_filename(filename),
_scope_sep("."),
_scope_def_type(ScopeType::module),
_closed(false),
_dumping(true),
_registering(true),
_next_var_id(0),
_scope_sep("."),
_scope_def_type(ScopeType::module),
_search(std::make_shared<VarSearch>(_scope_def_type))
{
if (!_header)
Expand Down Expand Up @@ -411,7 +411,7 @@ void VCDWriter::_scope_declaration(const std::string &scope, size_t sub_beg, siz
// -----------------------------
void VCDWriter::_write_header()
{
for (int i = 0; i < VCDHeader::kws; ++i)
for (unsigned int i = 0; i < VCDHeader::kws; ++i)
{
auto kwname = VCDHeader::kw_names[i];
auto kwvalue = _header->kw_values[i];
Expand Down Expand Up @@ -506,7 +506,7 @@ void VCDWriter::_finalize_registration()

// -----------------------------
VCDVariable::VCDVariable(const std::string &name, VariableType type, unsigned size, ScopePtr scope, unsigned next_var_id) :
_name(name), _type(type), _size(size), _scope(scope)
_type(type), _name(name), _size(size), _scope(scope)
{
std::stringstream ss;
ss << std::hex << next_var_id;
Expand Down

0 comments on commit e6263f6

Please sign in to comment.