diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c2413d..c7b201d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,7 @@ if( NOT IMLIB_BUILD_WITH_X ) message( FATAL_ERROR "Imlib is not built with X support" ) endif( NOT IMLIB_BUILD_WITH_X ) -add_definitions( -D_GNU_SOURCE ) +add_definitions( -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE ) include_directories( ${PROJECT_BINARY_DIR} src diff --git a/src/separator/separator.c b/src/separator/separator.c index 26693f3..472752c 100644 --- a/src/separator/separator.c +++ b/src/separator/separator.c @@ -188,6 +188,7 @@ void draw_separator_line(void *obj, cairo_t *c) void draw_separator_dots(void *obj, cairo_t *c) { + const double PI = 3.14159265359; Separator *separator = (Separator *)obj; if (separator->thickness <= 0) return; @@ -214,14 +215,14 @@ void draw_separator_dots(void *obj, cairo_t *c) offset + separator->thickness / 2.0, separator->thickness / 2.0, 0, - 2 * M_PI); + 2 * PI); } else { cairo_arc(c, offset + separator->thickness / 2.0, separator->area.height / 2.0, separator->thickness / 2.0, 0, - 2 * M_PI); + 2 * PI); } cairo_stroke_preserve(c); cairo_fill(c); diff --git a/src/server.c b/src/server.c index fe41496..a3c888a 100644 --- a/src/server.c +++ b/src/server.c @@ -256,7 +256,7 @@ void get_root_pixmap() gcv.ts_x_origin = 0; gcv.ts_y_origin = 0; gcv.fill_style = FillTiled; - uint mask = GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle | GCTile; + unsigned mask = GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle | GCTile; gcv.tile = server.root_pmap; XChangeGC(server.display, server.gc, mask, &gcv); diff --git a/src/taskbar/task.c b/src/taskbar/task.c index e325261..00449ad 100644 --- a/src/taskbar/task.c +++ b/src/taskbar/task.c @@ -301,8 +301,8 @@ void task_update_icon(Task *task) // get width, height and depth for the pixmap Window root; int icon_x, icon_y; - uint border_width, bpp; - uint w, h; + unsigned border_width, bpp; + unsigned w, h; XGetGeometry(server.display, hints->icon_pixmap, &root, &icon_x, &icon_y, &w, &h, &border_width, &bpp); imlib_context_set_drawable(hints->icon_pixmap); diff --git a/src/util/common.c b/src/util/common.c index 2e7bbc6..83a2593 100644 --- a/src/util/common.c +++ b/src/util/common.c @@ -449,9 +449,9 @@ Imlib_Image load_image(const char *path, int cached) } if (!image && g_str_has_suffix(path, ".svg")) { char tmp_filename[128]; - sprintf(tmp_filename, "/tmp/tint2-%d-XXXXXX.png", (int)getpid()); - int fd = mkstemps(tmp_filename, 4); - if (fd) { + sprintf(tmp_filename, "/tmp/tint2-%d.png", (int)getpid()); + int fd = open(tmp_filename, O_CREAT | O_EXCL, 0600); + if (fd >= 0) { // We fork here because librsvg allocates memory like crazy pid_t pid = fork(); if (pid == 0) { @@ -469,6 +469,7 @@ Imlib_Image load_image(const char *path, int cached) exit(0); } else { // Parent + close(fd); waitpid(pid, 0, 0); image = imlib_load_image_immediately_without_cache(tmp_filename); unlink(tmp_filename); @@ -639,7 +640,8 @@ GSList *load_locations_from_env(GSList *locations, const char *var, ...) if (value) { value = strdup(value); char *p = value; - for (char *token = strsep(&value, ":"); token; token = strsep(&value, ":")) { + char *t; + for (char *token = strtok_r(value, ":", &t); token; token = strtok_r(NULL, ":", &t)) { va_list ap; va_start(ap, var); for (const char *suffix = va_arg(ap, const char *); suffix; suffix = va_arg(ap, const char *)) {