Get rid of GNU_SOURCE (issue #625)

This commit is contained in:
o9000 2017-03-05 11:37:46 +01:00
parent 468bc16b0f
commit 4a5f0a7d83
5 changed files with 13 additions and 10 deletions

View file

@ -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

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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 *)) {