Skip to content

Commit

Permalink
Set C99 standard compliance
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Senichev <[email protected]>
  • Loading branch information
artemsen committed Aug 10, 2020
1 parent 9e016da commit d89c977
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ project(
'swayimg',
'c',
default_options: [
'c_std=c99',
'warning_level=3',
],
],
license: 'Apache-2.0',
version: '1.0',
)
)

# most of Wayland callback functions are not used
add_project_arguments(
Expand Down
2 changes: 1 addition & 1 deletion src/viewer.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ bool show_image(const struct viewer* params)
} else {
struct timeval tv;
gettimeofday(&tv, NULL);
app_id = format_string(APP_NAME "_%lx", tv.tv_usec);
app_id = format_string(APP_NAME "_%lx", tv.tv_sec << 32 | tv.tv_usec);
wnd.app_id = app_id;
}

Expand Down
5 changes: 4 additions & 1 deletion src/window.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2020 Artem Senichev <[email protected]>

// ftruncate() support
#define _POSIX_C_SOURCE 200112

#include "window.h"
#include "xdg-shell-protocol.h"
#include "config.h"
Expand Down Expand Up @@ -79,7 +82,7 @@ static int create_shmem(size_t sz, void** data)
char path[64];
struct timeval tv;
gettimeofday(&tv, NULL);
snprintf(path, sizeof(path), "/" APP_NAME "_%lx", tv.tv_usec);
snprintf(path, sizeof(path), "/" APP_NAME "_%lx", tv.tv_sec << 32 | tv.tv_usec);

int fd = shm_open(path, O_RDWR | O_CREAT | O_EXCL, 0600);
if (fd == -1) {
Expand Down

0 comments on commit d89c977

Please sign in to comment.