Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some Wpedantic warnings #4220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/control_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ sc_control_msg_serialize(const struct sc_control_msg *msg, unsigned char *buf) {

void
sc_control_msg_log(const struct sc_control_msg *msg) {
#define LOG_CMSG(fmt, ...) LOGV("input: " fmt, ## __VA_ARGS__)
#define LOG_CMSG(...) LOGV("input: " __VA_ARGS__)
switch (msg->type) {
case SC_CONTROL_MSG_TYPE_INJECT_KEYCODE:
LOG_CMSG("key %-4s code=%d repeat=%" PRIu32 " meta=%06lx",
Expand Down
4 changes: 2 additions & 2 deletions app/src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ execute_server(struct sc_server *server,
cmd[count++] = SCRCPY_VERSION;

unsigned dyn_idx = count; // from there, the strings are allocated
#define ADD_PARAM(fmt, ...) { \
#define ADD_PARAM(...) { \
char *p; \
if (asprintf(&p, fmt, ## __VA_ARGS__) == -1) { \
if (asprintf(&p, ## __VA_ARGS__) == -1) { \
goto end; \
} \
cmd[count++] = p; \
Expand Down
17 changes: 9 additions & 8 deletions app/src/util/vecdeque.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
* Initialize an empty VecDeque
*/
#define sc_vecdeque_init(pv) \
({ \
do { \
(pv)->cap = 0; \
(pv)->origin = 0; \
(pv)->size = 0; \
(pv)->data = NULL; \
})
} while (0)

/**
* Destroy a VecDeque
Expand All @@ -70,10 +70,10 @@
* Remove all items.
*/
#define sc_vecdeque_clear(pv) \
(void) ({ \
do { \
sc_vecdeque_destroy(pv); \
sc_vecdeque_init(pv); \
})
} while (0)

/**
* Returns the content size
Expand Down Expand Up @@ -190,10 +190,11 @@ sc_vecdeque_reallocdata_(void *ptr, size_t newcap, size_t item_size,

size_t right_len = MIN(size, oldcap - oldorigin);
assert(right_len);
memcpy(newptr, ptr + (oldorigin * item_size), right_len * item_size);
memcpy(newptr, (char *) ptr + (oldorigin * item_size),
right_len * item_size);

if (size > right_len) {
memcpy(newptr + (right_len * item_size), ptr,
memcpy((char *) newptr + (right_len * item_size), ptr,
(size - right_len) * item_size);
}

Expand Down Expand Up @@ -328,11 +329,11 @@ sc_vecdeque_growsize_(size_t value)
* This function may not fail.
*/
#define sc_vecdeque_push_noresize(pv, item) \
(void) ({ \
do { \
assert(!sc_vecdeque_is_full(pv)); \
++(pv)->size; \
(pv)->data[((pv)->origin + (pv)->size - 1) % (pv)->cap] = item; \
})
} while (0)

/**
* Push an item
Expand Down