1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 12:10:03 +00:00

Fix warnings

unused paramaters and (un)signed comparison mostly.
This commit is contained in:
François Revol 2021-10-25 20:17:19 +02:00
parent e721119f04
commit 5b22723a3b
8 changed files with 64 additions and 55 deletions

View File

@ -65,7 +65,7 @@ bool display_output_console::initialize() { return true; }
bool display_output_console::shutdown() { return true; }
void display_output_console::draw_string(const char *s, int w) {
void display_output_console::draw_string(const char *s, int) {
if (out_to_stdout.get(*state)) {
printf("%s\n", s);
if (extra_newline.get(*state)) { fputc('\n', stdout); }

View File

@ -71,7 +71,7 @@ bool display_output_file::initialize() { return true; }
bool display_output_file::shutdown() { return true; }
void display_output_file::draw_string(const char *s, int w) {
void display_output_file::draw_string(const char *s, int) {
if (overwrite_fpointer != nullptr) { fprintf(overwrite_fpointer, "%s\n", s); }
if (append_fpointer != nullptr) { fprintf(append_fpointer, "%s\n", s); }
}

View File

@ -173,7 +173,7 @@ void display_output_http::begin_draw_text() {
void display_output_http::end_draw_text() { webpage.append(WEBPAGE_END); }
void display_output_http::draw_string(const char *s, int w) {
void display_output_http::draw_string(const char *s, int) {
std::string::size_type origlen = webpage.length();
webpage.append(s);
webpage = string_replace_all(webpage, "\n", "<br />", origlen);

View File

@ -48,10 +48,10 @@ class display_output_http : public display_output_base {
virtual bool shutdown();
// drawing primitives
virtual void set_foreground_color(long c) {}
virtual void set_foreground_color(long) {}
virtual void begin_draw_text();
virtual void end_draw_text();
virtual void draw_string(const char *s, int w);
virtual void draw_string(const char *, int);
// HTTP-specific
private:

View File

@ -90,7 +90,7 @@ void display_output_ncurses::begin_draw_text() {
void display_output_ncurses::end_draw_text() {}
void display_output_ncurses::draw_string(const char *s, int w) {
void display_output_ncurses::draw_string(const char *s, int) {
printw("%s", s);
}
@ -99,24 +99,28 @@ void display_output_ncurses::line_inner_done() { printw("\n"); }
int display_output_ncurses::getx() {
int x, y;
getyx(ncurses_window, y, x);
(void)y;
return x;
}
int display_output_ncurses::gety() {
int x, y;
getyx(ncurses_window, y, x);
(void)x;
return y;
}
void display_output_ncurses::gotox(int x) {
int y, old_x;
getyx(ncurses_window, y, old_x);
(void)old_x;
move(y, x);
}
void display_output_ncurses::gotoy(int y) {
int x, old_y;
getyx(ncurses_window, old_y, x);
(void)old_y;
move(y, x);
}

View File

@ -78,52 +78,54 @@ class display_output_base {
virtual bool graphical() { return is_graphical; };
virtual bool draw_line_inner_required() { return is_graphical; }
virtual bool main_loop_wait(double t) { return false; }
virtual bool main_loop_wait(double /*t*/) { return false; }
virtual void sigterm_cleanup() {}
virtual void cleanup() {}
// drawing primitives
virtual void set_foreground_color(long c) {}
virtual void set_foreground_color(long /*c*/) {}
virtual int calc_text_width(const char *s) { return strlen(s); }
virtual void begin_draw_text() {}
virtual void end_draw_text() {}
virtual void draw_string(const char *s, int w) {}
virtual void draw_string(const char * /*s*/, int /*w*/) {}
virtual void line_inner_done() {}
// GUI interface
virtual void draw_string_at(int x, int y, const char *s, int w) {}
virtual void draw_string_at(int /*x*/, int /*y*/, const char * /*s*/,
int /*w*/) {}
// X11 lookalikes
virtual void set_line_style(int w, bool solid) {}
virtual void set_dashes(char *s) {}
virtual void draw_line(int x1, int y1, int x2, int y2) {}
virtual void draw_rect(int x, int y, int w, int h) {}
virtual void fill_rect(int x, int y, int w, int h) {}
virtual void draw_arc(int x, int y, int w, int h, int a1, int a2) {}
virtual void move_win(int x, int y) {}
virtual void set_line_style(int /*w*/, bool /*solid*/) {}
virtual void set_dashes(char * /*s*/) {}
virtual void draw_line(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/) {}
virtual void draw_rect(int /*x*/, int /*y*/, int /*w*/, int /*h*/) {}
virtual void fill_rect(int /*x*/, int /*y*/, int /*w*/, int /*h*/) {}
virtual void draw_arc(int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*a1*/,
int /*a2*/) {}
virtual void move_win(int /*x*/, int /*y*/) {}
virtual int dpi_scale(int value) { return value; }
virtual void begin_draw_stuff() {}
virtual void end_draw_stuff() {}
virtual void clear_text(int exposures) {}
virtual void clear_text(int /*exposures*/) {}
// font stuff
virtual int font_height(int) { return 0; }
virtual int font_ascent(int) { return 0; }
virtual int font_descent(int) { return 0; }
virtual int font_height(unsigned int) { return 0; }
virtual int font_ascent(unsigned int) { return 0; }
virtual int font_descent(unsigned int) { return 0; }
virtual void setup_fonts(void) {}
virtual void set_font(int) {}
virtual void free_fonts(bool utf8) {}
virtual void load_fonts(bool utf8) {}
virtual void set_font(unsigned int) {}
virtual void free_fonts(bool /*utf8*/) {}
virtual void load_fonts(bool /*utf8*/) {}
// tty interface
virtual int getx() { return 0; }
virtual int gety() { return 0; }
virtual void gotox(int x) {}
virtual void gotoy(int y) {}
virtual void gotoxy(int x, int y) {}
virtual void gotox(int /*x*/) {}
virtual void gotoy(int /*y*/) {}
virtual void gotoxy(int /*x*/, int /*y*/) {}
virtual void flush() {}

View File

@ -661,7 +661,9 @@ void display_output_x11::draw_arc(int x, int y, int w, int h, int a1, int a2) {
}
void display_output_x11::move_win(int x, int y) {
XMoveWindow(display, window.window, window.x, window.y);
window.x = x;
window.y = y;
XMoveWindow(display, window.window, x, y);
}
int display_output_x11::dpi_scale(int value) {
@ -708,7 +710,7 @@ void display_output_x11::clear_text(int exposures) {
#ifdef BUILD_XFT
int display_output_x11::font_height(int f) {
int display_output_x11::font_height(unsigned int f) {
assert(f < x_fonts.size());
if (use_xft.get(*state)) {
return x_fonts[f].xftfont->ascent + x_fonts[f].xftfont->descent;
@ -718,7 +720,7 @@ int display_output_x11::font_height(int f) {
}
}
int display_output_x11::font_ascent(int f) {
int display_output_x11::font_ascent(unsigned int f) {
assert(f < x_fonts.size());
if (use_xft.get(*state)) {
return x_fonts[f].xftfont->ascent;
@ -727,7 +729,7 @@ int display_output_x11::font_ascent(int f) {
}
}
int display_output_x11::font_descent(int f) {
int display_output_x11::font_descent(unsigned int f) {
assert(f < x_fonts.size());
if (use_xft.get(*state)) {
return x_fonts[f].xftfont->descent;
@ -738,18 +740,18 @@ int display_output_x11::font_descent(int f) {
#else
int display_output_x11::font_height(int f) {
int display_output_x11::font_height(unsigned int f) {
assert(f < x_fonts.size());
return x_fonts[f].font->max_bounds.ascent +
x_fonts[f].font->max_bounds.descent;
}
int display_output_x11::font_ascent(int f) {
int display_output_x11::font_ascent(unsigned int f) {
assert(f < x_fonts.size());
return x_fonts[f].font->max_bounds.ascent;
}
int display_output_x11::font_descent(int f) {
int display_output_x11::font_descent(unsigned int f) {
assert(f < x_fonts.size());
return x_fonts[f].font->max_bounds.descent;
}
@ -769,7 +771,8 @@ void display_output_x11::setup_fonts(void) {
#endif /* BUILD_XFT */
}
void display_output_x11::set_font(int f) {
void display_output_x11::set_font(unsigned int f) {
assert(f < x_fonts.size());
#ifdef BUILD_XFT
if (use_xft.get(*state)) { return; }
#endif /* BUILD_XFT */
@ -809,7 +812,7 @@ void display_output_x11::free_fonts(bool utf8) {
}
void display_output_x11::load_fonts(bool utf8) {
x_fonts.resize(fonts.size());
for (int i = 0; i < fonts.size(); i++) {
for (unsigned int i = 0; i < fonts.size(); i++) {
auto &font = fonts[i];
auto &xfont = x_fonts[i];
#ifdef BUILD_XFT

View File

@ -47,38 +47,38 @@ class display_output_x11 : public display_output_base {
virtual bool initialize();
virtual bool shutdown();
virtual bool main_loop_wait(double t);
virtual bool main_loop_wait(double);
virtual void sigterm_cleanup();
virtual void cleanup();
// drawing primitives
virtual void set_foreground_color(long c);
virtual void set_foreground_color(long);
virtual int calc_text_width(const char *s);
virtual int calc_text_width(const char *);
// GUI interface
virtual void draw_string_at(int x, int y, const char *s, int w);
virtual void draw_string_at(int, int, const char *, int);
// X11 lookalikes
virtual void set_line_style(int w, bool solid);
virtual void set_dashes(char *s);
virtual void draw_line(int x1, int y1, int x2, int y2);
virtual void draw_rect(int x, int y, int w, int h);
virtual void fill_rect(int x, int y, int w, int h);
virtual void draw_arc(int x, int y, int w, int h, int a1, int a2);
virtual void move_win(int x, int y);
virtual int dpi_scale(int value);
virtual void set_line_style(int, bool);
virtual void set_dashes(char *);
virtual void draw_line(int, int, int, int);
virtual void draw_rect(int, int, int, int);
virtual void fill_rect(int, int, int, int);
virtual void draw_arc(int, int, int, int, int, int);
virtual void move_win(int, int);
virtual int dpi_scale(int);
virtual void end_draw_stuff();
virtual void clear_text(int exposures);
virtual void clear_text(int);
virtual int font_height(int);
virtual int font_ascent(int);
virtual int font_descent(int);
virtual int font_height(unsigned int);
virtual int font_ascent(unsigned int);
virtual int font_descent(unsigned int);
virtual void setup_fonts(void);
virtual void set_font(int);
virtual void free_fonts(bool utf8);
virtual void load_fonts(bool utf8);
virtual void set_font(unsigned int);
virtual void free_fonts(bool);
virtual void load_fonts(bool);
// X11-specific
};