Compare commits

..

No commits in common. "4f5219bbbe5ec60396d44ffa48b63d1854a51aef" and "c74f0903668db0120e3d393456111dcff2a2f926" have entirely different histories.

12 changed files with 11 additions and 24 deletions

View File

@ -37,7 +37,7 @@ endif()
# https://t.me/NightShadowsHangout/670691 # https://t.me/NightShadowsHangout/670691
# https://t.me/NightShadowsHangout/688372 # https://t.me/NightShadowsHangout/688372
list(APPEND FLAGS -Werror -Wall -Wextra -Wshadow -Wpedantic -Wno-gnu-anonymous-struct -fPIC -Wconversion -Wno-unused-parameter -Wimplicit-fallthrough -Wno-missing-field-initializers) list(APPEND FLAGS -Werror -Wall -Wextra -Wshadow -Wpedantic -Wno-gnu-anonymous-struct -fPIC -Wconversion -Wno-unused-parameter -Wimplicit-fallthrough)
# i have no idea why this hack wasn't needed before but it's needed if sanitizers are used # i have no idea why this hack wasn't needed before but it's needed if sanitizers are used
add_link_options(${FLAGS}) add_link_options(${FLAGS})

4
file.h
View File

@ -15,7 +15,7 @@ public:
File(const File&) = delete; File(const File&) = delete;
File& operator=(const File&) = delete; File& operator=(const File&) = delete;
inline File(File&& other) { inline constexpr File(File&& other) {
try_close(this->_file); try_close(this->_file);
this->_file = other._file; this->_file = other._file;
other._file = nullptr; other._file = nullptr;
@ -47,7 +47,7 @@ public:
throw_system_error("fwrite()"); throw_system_error("fwrite()");
} }
} }
inline void write(const std::string& str) { inline constexpr void write(const std::string& str) {
this->write(str.data(), str.size()); this->write(str.data(), str.size());
} }
inline constexpr FILE* get() const noexcept { inline constexpr FILE* get() const noexcept {

View File

@ -105,7 +105,7 @@ static inline std::optional<File> save_file_picker() {
try { try {
File file(path, "w"); File file(path, "w");
NFD_FreePath(path); NFD_FreePath(path);
return file; return std::move(file);
} catch (const std::exception& e) { } catch (const std::exception& e) {
NFD_FreePath(path); NFD_FreePath(path);
log(std::string("Failed to open file from file picker: ") + e.what()); log(std::string("Failed to open file from file picker: ") + e.what());

View File

@ -139,7 +139,7 @@ static inline std::optional<File> open_file_picker() {
try { try {
File file(path, "r"); File file(path, "r");
NFD_FreePath(path); NFD_FreePath(path);
return file; return std::move(file);
} catch (const std::exception& e) { } catch (const std::exception& e) {
NFD_FreePath(path); NFD_FreePath(path);
log(std::string("Failed to open file from file picker: ") + e.what()); log(std::string("Failed to open file from file picker: ") + e.what());

View File

@ -1,9 +1,6 @@
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#include <imgui/imgui.h> #include <imgui/imgui.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#include <imgui/imgui_internal.h> #include <imgui/imgui_internal.h>
#pragma GCC diagnostic pop
#include "group_panel.h" #include "group_panel.h"
// The following code is slightly modified public domain code from https://github.com/thedmd // The following code is slightly modified public domain code from https://github.com/thedmd

View File

@ -6,10 +6,10 @@
std::vector<LogEntry> log_entries; std::vector<LogEntry> log_entries;
LogEntry::LogEntry(time_t time_, std::string message_) : message(std::move(message_)) { LogEntry::LogEntry(time_t time, std::string message_) : message(std::move(message_)) {
size_t pos; size_t pos;
localtime_r(&time_, &this->time); localtime_r(&time, &this->time);
while ((pos = this->message.find('\n')) != std::string::npos) { while ((pos = this->message.find('\n')) != std::string::npos) {
this->message.replace(pos, 1, 1, ' '); this->message.replace(pos, 1, 1, ' ');
} }

2
log.h
View File

@ -9,7 +9,7 @@ struct LogEntry {
std::string message; std::string message;
LogEntry() = default; LogEntry() = default;
LogEntry(time_t time_, std::string message_); LogEntry(time_t time, std::string message_);
}; };
extern std::vector<LogEntry> log_entries; extern std::vector<LogEntry> log_entries;

View File

@ -36,7 +36,6 @@ const char* to_string(Priority priority) {
case Priority::Fatal: return "Fatal"; case Priority::Fatal: return "Fatal";
case Priority::Unknown: return "Unknown"; case Priority::Unknown: return "Unknown";
} }
return "Unknown??";
} }
const char* to_string(Buffer buffer) { const char* to_string(Buffer buffer) {
@ -48,7 +47,6 @@ const char* to_string(Buffer buffer) {
case Buffer::Crash: return "Crash"; case Buffer::Crash: return "Crash";
case Buffer::Unknown: return "Unknown"; case Buffer::Unknown: return "Unknown";
} }
return "Unknown??";
} }
const char* to_string_lower(Buffer buffer) { const char* to_string_lower(Buffer buffer) {
@ -60,7 +58,6 @@ const char* to_string_lower(Buffer buffer) {
case Buffer::Crash: return "crash"; case Buffer::Crash: return "crash";
case Buffer::Unknown: return "unknown"; case Buffer::Unknown: return "unknown";
} }
return "Unknown??";
} }
std::string to_string(const LogcatEntry& logcat_entry) { std::string to_string(const LogcatEntry& logcat_entry) {
@ -130,7 +127,7 @@ std::optional<LogcatEntry> try_parse_logcat_entry(char* buf, size_t length, Buff
localtime_r(&time, &logcat_entry.time); localtime_r(&time, &logcat_entry.time);
} }
return logcat_entry; return std::move(logcat_entry);
} }
std::optional<Buffer> try_parse_buffer(char* buf, size_t length) { std::optional<Buffer> try_parse_buffer(char* buf, size_t length) {
@ -237,7 +234,6 @@ static inline char to_char(Priority priority) {
case Priority::Fatal: return 'F'; case Priority::Fatal: return 'F';
case Priority::Unknown: return 'U'; case Priority::Unknown: return 'U';
} }
return 'U';
} }
static inline std::string rightpad(const std::string& str, size_t characters) { static inline std::string rightpad(const std::string& str, size_t characters) {

View File

@ -2,10 +2,7 @@
#include <sstream> #include <sstream>
#include <system_error> #include <system_error>
#include <imgui/imgui.h> #include <imgui/imgui.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#include <imgui/imgui_internal.h> #include <imgui/imgui_internal.h>
#pragma GCC diagnostic pop
#include "misc.h" #include "misc.h"

2
thirdparty/imgui vendored

@ -1 +1 @@
Subproject commit cb5542bce5eb20465a64063c686d9f293ba125e9 Subproject commit f65bcf481ab34cd07d3909aab1479f409fa79f2f

View File

@ -1,4 +1,4 @@
#include <imgui/imgui.h> #include <imgui/imgui.cpp>
#include "../myimconfig.h" #include "../myimconfig.h"
#include "../log.h" #include "../log.h"

View File

@ -1,8 +1,5 @@
#include <imgui/imgui.h> #include <imgui/imgui.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#include <imgui/imgui_internal.h> #include <imgui/imgui_internal.h>
#pragma GCC diagnostic pop
#include <ctime> #include <ctime>
#include <string> #include <string>
#include <vector> #include <vector>