croptool

Image cropping tool
git clone git://lumidify.org/croptool.git
Log | Files | Refs | README | LICENSE

commit 4246933e6434c7710e7954d5f616dc774006db64
parent 77e45c6152c2ca844dcca02e27f9f26f44c4c980
Author: lumidify <nobody@lumidify.org>
Date:   Sun,  3 Jan 2021 13:42:53 +0100

Fix various issues found with an approximately 500 meter long string of compiler options

Diffstat:
Mcroptool.c | 18+++++++++---------
Mcroptool_crop.c | 2+-
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/croptool.c b/croptool.c @@ -33,9 +33,9 @@ * (in order to change the size of the box) */ static int COLLISION_PADDING = 10; /* The color of the selection box */ -static char *SELECTION_COLOR1 = "#000000"; +static const char *SELECTION_COLOR1 = "#000000"; /* The second selection color - when tab is pressed */ -static char *SELECTION_COLOR2 = "#FFFFFF"; +static const char *SELECTION_COLOR2 = "#FFFFFF"; /* The width of the selection line */ static int LINE_WIDTH = 2; /* When set to 1, the display is redrawn on window resize */ @@ -53,7 +53,7 @@ static short SELECTION_REDRAW = 1; %b: Bottom side of cropped area. %f: Filename of image. */ -static char *CMD_FORMAT = "croptool_crop %wx%h+%l+%t '%f'"; +static const char *CMD_FORMAT = "croptool_crop %wx%h+%l+%t '%f'"; extern char *optarg; extern int optind; @@ -124,7 +124,7 @@ static void setup(int argc, char *argv[]); static void cleanup(void); static void sort_coordinates(int *x0, int *y0, int *x1, int *y1); static void swap(int *a, int *b); -static void redraw(); +static void redraw(void); static void print_cmd(const char *filename, int x, int y, int w, int h); static void print_selection(struct Selection *sel, const char *filename); static int collide_point(int x, int y, int x_point, int y_point); @@ -142,7 +142,7 @@ static void set_selection( static void queue_rectangle_redraw(int x0, int y0, int x1, int y1); static void drag_motion(XEvent event); static void resize_window(int w, int h); -static void button_release(XEvent event); +static void button_release(void); static void button_press(XEvent event); static void key_press(XEvent event); static void queue_update(int x, int y, int w, int h); @@ -235,7 +235,7 @@ mainloop(void) { break; case ButtonRelease: if (event.xbutton.button == Button1) - button_release(event); + button_release(); break; case MotionNotify: drag_motion(event); @@ -244,7 +244,7 @@ mainloop(void) { key_press(event); break; case ClientMessage: - if (event.xclient.data.l[0] == state.wm_delete_msg) + if ((Atom)event.xclient.data.l[0] == state.wm_delete_msg) running = 0; default: break; @@ -354,7 +354,7 @@ cleanup(void) { static void print_cmd(const char *filename, int x, int y, int w, int h) { short percent = 0; - char *c; + const char *c; int length = 0; int start_index = 0; for (c = CMD_FORMAT; *c != '\0'; c++) { @@ -606,7 +606,7 @@ button_press(XEvent event) { } static void -button_release(XEvent event) { +button_release(void) { state.moving = 0; state.resizing = 0; state.lock_x = 0; diff --git a/croptool_crop.c b/croptool_crop.c @@ -49,7 +49,7 @@ main(int argc, char *argv[]) { } orig_w = imlib_image_get_width(); orig_h = imlib_image_get_height(); - if (w <= 0 || h <= 0 || x < 0 | y < 0 || x + w > orig_w || y + h > orig_h) { + if (w <= 0 || h <= 0 || x < 0 || y < 0 || x + w > orig_w || y + h > orig_h) { fprintf(stderr, "Invalid cropping rectangle specified.\n"); exit(1); }