fix all real warnings

This commit is contained in:
PoliEcho 2025-03-11 11:36:23 +01:00
parent 17e850e6d7
commit 04f0ef76ee
3 changed files with 12 additions and 15 deletions

View File

@ -5,9 +5,7 @@
#include <cstdlib>
#include <cstring>
#include <curses.h>
#include <locale>
#include <menu.h>
#include <string>
#include "marks.h"

View File

@ -8,8 +8,6 @@
#include <cstring>
#include <curses.h>
#include <format>
#include <iostream>
#include <locale>
#include <menu.h>
#include <nlohmann/json.hpp>
#include <panel.h>
@ -47,6 +45,7 @@ void marks_page() {
size_t size_my_panels = resp_from_api["Subjects"].size();
my_panels = new (std::nothrow) PANEL *[size_my_panels];
// trows compiler warning for some reason but cannot be removed
PANEL *top;
int ch;
@ -137,7 +136,7 @@ void init_wins(WINDOW **wins, int n, json marks_json) {
x = DEFAULT_X_OFFSET;
uint8_t curent_color = 0;
int MaxHight = 0;
unsigned int MaxHight = 0;
// this loop through subjects
for (i = 0; i < n; ++i) {
@ -154,7 +153,7 @@ void init_wins(WINDOW **wins, int n, json marks_json) {
wsub_name.c_str(), wsub_avg_s.c_str());
size_t max_text_length = wcslen(label);
for (int j = 0; j < marks_json["Subjects"][i]["Marks"].size(); j++) {
for (unsigned int j = 0; j < static_cast<unsigned int>(marks_json["Subjects"][i]["Marks"].size()); j++) {
std::string caption =
rm_tr_le_whitespace(marks_json["Subjects"][i]["Marks"][j]["Caption"]);
std::string theme =
@ -179,8 +178,7 @@ void init_wins(WINDOW **wins, int n, json marks_json) {
MaxHight = 0;
}
if (marks_json["Subjects"][i]["Marks"].size() * 2 + DEFAULT_PADDING >
MaxHight) {
if (static_cast<unsigned int>(marks_json["Subjects"][i]["Marks"].size()) * 2 + DEFAULT_PADDING > MaxHight) {
MaxHight =
marks_json["Subjects"][i]["Marks"].size() * 2 + DEFAULT_PADDING;
}
@ -198,6 +196,8 @@ void init_wins(WINDOW **wins, int n, json marks_json) {
/* Show the window with a border and a label */
void win_show(WINDOW *win, wchar_t *label, int label_color, int width,
int height, json marks_json, int SubjectIndex) {
// is the compiler smoking weed or something, why is it thinking starty is not used ??
int startx, starty;
wresize(win, height, width);

View File

@ -7,7 +7,6 @@
#include <cstdint>
#include <curses.h>
#include <cwchar>
#include <fstream>
#include <iostream>
#include <ncurses.h>
#include <nlohmann/json.hpp>
@ -76,10 +75,9 @@ json *find_atom_by_indexes(json &resp_from_api, uint8_t day_index,
void timetable_page() {
// DONT FORGET TO UNCOMMENT
// json resp_from_api =
// bakaapi::get_data_from_endpoint("api/3/timetable/actual");
std::ifstream f("test-data/timetable.json");
json resp_from_api = json::parse(f);
json resp_from_api = bakaapi::get_data_from_endpoint("api/3/timetable/actual");
/*std::ifstream f("test-data/timetable.json");
json resp_from_api = json::parse(f);*/
// this may be unnecessary but i dont have enaugh data to test it
// it sorts the hours by start time
@ -295,6 +293,7 @@ void timetable_page() {
int ch;
while ((ch = getch()) != KEY_F(1)) {
if (is_info_box_open) {
move_panel(infobox_panel, LINES -1, COLS-1);
werase(infobox_window);
wrefresh(infobox_window);
hide_panel(infobox_panel);
@ -380,7 +379,7 @@ void timetable_page() {
atom->at("GroupsIds")[i].get<std::string>()) {
groups.append(string_to_wstring(
resp_from_api["Groups"][j]["Name"].get<std::string>()));
if (i + 1 < atom->at("GroupsIds").size()) {
if (static_cast<size_t>(i + 1) < atom->at("GroupsIds").size()) {
groups.append(L", ");
}
}
@ -543,4 +542,4 @@ void refresh_cells(uint8_t num_of_columns, uint8_t num_of_days,
}
}
}
}
}