mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-01 21:26:33 +00:00
minor fix
This commit is contained in:
@@ -234,7 +234,7 @@ void us_device_close(us_device_s *dev) {
|
||||
for (uint index = 0; index < run->n_bufs; ++index) {
|
||||
us_hw_buffer_s *hw = &run->hw_bufs[index];
|
||||
|
||||
US_CLOSE_FD(hw->dma_fd, close);
|
||||
US_CLOSE_FD(hw->dma_fd);
|
||||
|
||||
if (dev->io_method == V4L2_MEMORY_MMAP) {
|
||||
if (hw->raw.allocated > 0 && hw->raw.data != NULL) {
|
||||
@@ -254,7 +254,7 @@ void us_device_close(us_device_s *dev) {
|
||||
run->n_bufs = 0;
|
||||
}
|
||||
|
||||
US_CLOSE_FD(run->fd, close);
|
||||
US_CLOSE_FD(run->fd);
|
||||
run->persistent_timeout_reported = false;
|
||||
}
|
||||
|
||||
@@ -920,7 +920,7 @@ static int _device_open_export_to_dma(us_device_s *dev) {
|
||||
|
||||
error:
|
||||
for (uint index = 0; index < run->n_bufs; ++index) {
|
||||
US_CLOSE_FD(run->hw_bufs[index].dma_fd, close);
|
||||
US_CLOSE_FD(run->hw_bufs[index].dma_fd);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ int us_memsink_server_put(us_memsink_s *sink, const us_frame_s *frame, bool *key
|
||||
return 0;
|
||||
}
|
||||
|
||||
int us_memsink_client_get(us_memsink_s *sink, us_frame_s *frame, bool *key_requested, bool key_required) { // cppcheck-suppress unusedFunction
|
||||
int us_memsink_client_get(us_memsink_s *sink, us_frame_s *frame, bool *key_requested, bool key_required) {
|
||||
assert(!sink->server); // Client only
|
||||
|
||||
if (us_flock_timedwait_monotonic(sink->fd, sink->timeout) < 0) {
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#define US_CALLOC(x_dest, x_nmemb) assert(((x_dest) = calloc((x_nmemb), sizeof(*(x_dest)))) != NULL)
|
||||
#define US_REALLOC(x_dest, x_nmemb) assert(((x_dest) = realloc((x_dest), (x_nmemb) * sizeof(*(x_dest)))) != NULL)
|
||||
#define US_DELETE(x_dest, x_free) { if (x_dest) { x_free(x_dest); x_dest = NULL; } }
|
||||
#define US_CLOSE_FD(x_dest, x_close) { if (x_dest >= 0) { x_close(x_dest); x_dest = -1; } }
|
||||
#define US_CLOSE_FD(x_dest) { if (x_dest >= 0) { close(x_dest); x_dest = -1; } }
|
||||
#define US_MEMSET_ZERO(x_obj) memset(&(x_obj), 0, sizeof(x_obj))
|
||||
|
||||
#define US_SNPRINTF(x_dest, x_size, x_fmt, ...) assert(snprintf((x_dest), (x_size), (x_fmt), ##__VA_ARGS__) > 0)
|
||||
|
||||
@@ -100,7 +100,7 @@ void us_server_destroy(us_server_s *server) {
|
||||
}
|
||||
|
||||
evhttp_free(run->http);
|
||||
US_CLOSE_FD(run->ext_fd, close);
|
||||
US_CLOSE_FD(run->ext_fd);
|
||||
event_base_free(run->base);
|
||||
|
||||
# if LIBEVENT_VERSION_NUMBER >= 0x02010100
|
||||
@@ -392,7 +392,7 @@ not_found:
|
||||
goto cleanup;
|
||||
|
||||
cleanup:
|
||||
US_CLOSE_FD(fd, close); // cppcheck-suppress unreadVariable
|
||||
US_CLOSE_FD(fd); // cppcheck-suppress unreadVariable
|
||||
US_DELETE(static_path, free);
|
||||
US_DELETE(buf, evbuffer_free);
|
||||
US_DELETE(decoded_path, free);
|
||||
|
||||
@@ -254,8 +254,8 @@ static void _drm_cleanup(us_drm_s *drm) {
|
||||
run->n_bufs = 0;
|
||||
}
|
||||
|
||||
US_CLOSE_FD(run->status_fd, close);
|
||||
US_CLOSE_FD(run->fd, close);
|
||||
US_CLOSE_FD(run->status_fd);
|
||||
US_CLOSE_FD(run->fd);
|
||||
|
||||
run->crtc_id = 0;
|
||||
run->next_n_buf = 0;
|
||||
@@ -391,7 +391,7 @@ static int _drm_check_status(us_drm_s *drm) {
|
||||
return (status_ch == 'd' ? -2 : 0);
|
||||
|
||||
error:
|
||||
US_CLOSE_FD(run->status_fd, close);
|
||||
US_CLOSE_FD(run->status_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ static void *_follower_thread(void *v_unix_follow) {
|
||||
|
||||
const bool online = !connect(fd, (struct sockaddr *)&addr, sizeof(addr));
|
||||
atomic_store(&_g_ustreamer_online, online);
|
||||
US_CLOSE_FD(fd, close); // cppcheck-suppress unreadVariable
|
||||
US_CLOSE_FD(fd); // cppcheck-suppress unreadVariable
|
||||
|
||||
usleep(200 * 1000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user