diff --git a/app/src/control_msg.c b/app/src/control_msg.c index 363483eb7a..fda1602577 100644 --- a/app/src/control_msg.c +++ b/app/src/control_msg.c @@ -1,7 +1,7 @@ #include "control_msg.h" +#include #include -#include #include "config.h" #include "util/buffer_util.h" @@ -27,7 +27,7 @@ write_string(const char *utf8, size_t max_len, unsigned char *buf) { static uint16_t to_fixed_point_16(float f) { - SDL_assert(f >= 0.0f && f <= 1.0f); + assert(f >= 0.0f && f <= 1.0f); uint32_t u = f * 0x1p16f; // 2^16 if (u >= 0xffff) { u = 0xffff; diff --git a/app/src/controller.c b/app/src/controller.c index ec706c958a..d59a7411a6 100644 --- a/app/src/controller.c +++ b/app/src/controller.c @@ -1,6 +1,6 @@ #include "controller.h" -#include +#include #include "config.h" #include "util/lock.h" @@ -85,7 +85,8 @@ run_controller(void *data) { } struct control_msg msg; bool non_empty = cbuf_take(&controller->queue, &msg); - SDL_assert(non_empty); + assert(non_empty); + (void) non_empty; mutex_unlock(controller->mutex); bool ok = process_msg(controller, &msg); diff --git a/app/src/decoder.c b/app/src/decoder.c index 5217648484..5ac6cd4486 100644 --- a/app/src/decoder.c +++ b/app/src/decoder.c @@ -2,7 +2,6 @@ #include #include -#include #include #include #include diff --git a/app/src/device_msg.c b/app/src/device_msg.c index aba56bb303..db17612903 100644 --- a/app/src/device_msg.c +++ b/app/src/device_msg.c @@ -1,7 +1,6 @@ #include "device_msg.h" #include -#include #include "config.h" #include "util/buffer_util.h" diff --git a/app/src/file_handler.c b/app/src/file_handler.c index c0b03bcf75..ba689404f7 100644 --- a/app/src/file_handler.c +++ b/app/src/file_handler.c @@ -1,7 +1,7 @@ #include "file_handler.h" +#include #include -#include #include "config.h" #include "command.h" @@ -120,7 +120,8 @@ run_file_handler(void *data) { } struct file_handler_request req; bool non_empty = cbuf_take(&file_handler->queue, &req); - SDL_assert(non_empty); + assert(non_empty); + (void) non_empty; process_t process; if (req.action == ACTION_INSTALL_APK) { diff --git a/app/src/fps_counter.c b/app/src/fps_counter.c index 0c3f13d4bf..58c62d5511 100644 --- a/app/src/fps_counter.c +++ b/app/src/fps_counter.c @@ -1,6 +1,6 @@ #include "fps_counter.h" -#include +#include #include #include "config.h" @@ -77,7 +77,7 @@ run_fps_counter(void *data) { uint32_t now = SDL_GetTicks(); check_interval_expired(counter, now); - SDL_assert(counter->next_timestamp > now); + assert(counter->next_timestamp > now); uint32_t remaining = counter->next_timestamp - now; // ignore the reason (timeout or signaled), we just loop anyway diff --git a/app/src/input_manager.c b/app/src/input_manager.c index e0aa60540f..013fb640ca 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -1,6 +1,6 @@ #include "input_manager.h" -#include +#include #include "config.h" #include "event_converter.h" @@ -217,7 +217,7 @@ input_manager_process_text_input(struct input_manager *im, if (!im->prefer_text) { char c = event->text[0]; if (isalpha(c) || c == ' ') { - SDL_assert(event->text[1] == '\0'); + assert(event->text[1] == '\0'); // letters and space are handled as raw key event return; } diff --git a/app/src/receiver.c b/app/src/receiver.c index 33bbf8b502..0474ff55a8 100644 --- a/app/src/receiver.c +++ b/app/src/receiver.c @@ -1,6 +1,6 @@ #include "receiver.h" -#include +#include #include #include "config.h" @@ -49,7 +49,7 @@ process_msgs(const unsigned char *buf, size_t len) { device_msg_destroy(&msg); head += r; - SDL_assert(head <= len); + assert(head <= len); if (head == len) { return head; } @@ -64,7 +64,7 @@ run_receiver(void *data) { size_t head = 0; for (;;) { - SDL_assert(head < DEVICE_MSG_SERIALIZED_MAX_SIZE); + assert(head < DEVICE_MSG_SERIALIZED_MAX_SIZE); ssize_t r = net_recv(receiver->control_socket, buf, DEVICE_MSG_SERIALIZED_MAX_SIZE - head); if (r <= 0) { diff --git a/app/src/recorder.c b/app/src/recorder.c index b5314dafce..465b24e8b0 100644 --- a/app/src/recorder.c +++ b/app/src/recorder.c @@ -1,7 +1,7 @@ #include "recorder.h" +#include #include -#include #include "config.h" #include "compat.h" @@ -116,7 +116,7 @@ recorder_get_format_name(enum recorder_format format) { bool recorder_open(struct recorder *recorder, const AVCodec *input_codec) { const char *format_name = recorder_get_format_name(recorder->format); - SDL_assert(format_name); + assert(format_name); const AVOutputFormat *format = find_muxer(format_name); if (!format) { LOGE("Could not find muxer"); @@ -357,7 +357,7 @@ recorder_join(struct recorder *recorder) { bool recorder_push(struct recorder *recorder, const AVPacket *packet) { mutex_lock(recorder->mutex); - SDL_assert(!recorder->stopped); + assert(!recorder->stopped); if (recorder->failed) { // reject any new packet (this will stop the stream) diff --git a/app/src/screen.c b/app/src/screen.c index 5c1fdab3d8..beb1075499 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -1,5 +1,6 @@ #include "screen.h" +#include #include #include @@ -110,7 +111,7 @@ get_optimal_size(struct size current_size, struct size frame_size) { } // w and h must fit into 16 bits - SDL_assert_release(w < 0x10000 && h < 0x10000); + assert(w < 0x10000 && h < 0x10000); return (struct size) {w, h}; } @@ -392,8 +393,8 @@ screen_handle_window_event(struct screen *screen, break; case SDL_WINDOWEVENT_MAXIMIZED: // The backup size must be non-nul. - SDL_assert(screen->windowed_window_size_backup.width); - SDL_assert(screen->windowed_window_size_backup.height); + assert(screen->windowed_window_size_backup.width); + assert(screen->windowed_window_size_backup.height); // Revert the last size, it was updated while screen was maximized. screen->windowed_window_size = screen->windowed_window_size_backup; #ifdef DEBUG diff --git a/app/src/server.c b/app/src/server.c index d911435644..90eb4c692e 100644 --- a/app/src/server.c +++ b/app/src/server.c @@ -1,10 +1,10 @@ #include "server.h" +#include #include #include #include #include -#include #include #include "config.h" @@ -199,7 +199,7 @@ connect_to_server(uint16_t port, uint32_t attempts, uint32_t delay) { static void close_socket(socket_t *socket) { - SDL_assert(*socket != INVALID_SOCKET); + assert(*socket != INVALID_SOCKET); net_shutdown(*socket, SHUT_RDWR); if (!net_close(*socket)) { LOGW("Could not close socket"); @@ -323,7 +323,7 @@ server_stop(struct server *server) { close_socket(&server->control_socket); } - SDL_assert(server->process != PROCESS_NONE); + assert(server->process != PROCESS_NONE); if (!cmd_terminate(server->process)) { LOGW("Could not terminate server"); diff --git a/app/src/stream.c b/app/src/stream.c index 35a541e419..64b2bf3924 100644 --- a/app/src/stream.c +++ b/app/src/stream.c @@ -1,8 +1,8 @@ #include "stream.h" +#include #include #include -#include #include #include #include @@ -44,8 +44,8 @@ stream_recv_packet(struct stream *stream, AVPacket *packet) { uint64_t pts = buffer_read64be(header); uint32_t len = buffer_read32be(&header[8]); - SDL_assert(pts == NO_PTS || (pts & 0x8000000000000000) == 0); - SDL_assert(len); + assert(pts == NO_PTS || (pts & 0x8000000000000000) == 0); + assert(len); if (av_new_packet(packet, len)) { LOGE("Could not allocate packet"); @@ -108,8 +108,9 @@ stream_parse(struct stream *stream, AVPacket *packet) { AV_NOPTS_VALUE, AV_NOPTS_VALUE, -1); // PARSER_FLAG_COMPLETE_FRAMES is set - SDL_assert(r == in_len); - SDL_assert(out_len == in_len); + assert(r == in_len); + (void) r; + assert(out_len == in_len); if (stream->parser->key_frame == 1) { packet->flags |= AV_PKT_FLAG_KEY; diff --git a/app/src/tiny_xpm.c b/app/src/tiny_xpm.c index 29e0b54fc1..feb3d1cb49 100644 --- a/app/src/tiny_xpm.c +++ b/app/src/tiny_xpm.c @@ -1,5 +1,6 @@ #include "tiny_xpm.h" +#include #include #include #include @@ -51,24 +52,26 @@ read_xpm(char *xpm[]) { int chars = strtol(endptr + 1, &endptr, 10); // sanity checks - SDL_assert(0 <= width && width < 256); - SDL_assert(0 <= height && height < 256); - SDL_assert(0 <= colors && colors < 256); - SDL_assert(chars == 1); // this implementation does not support more + assert(0 <= width && width < 256); + assert(0 <= height && height < 256); + assert(0 <= colors && colors < 256); + assert(chars == 1); // this implementation does not support more + + (void) chars; // init index struct index index[colors]; for (int i = 0; i < colors; ++i) { const char *line = xpm[1+i]; index[i].c = line[0]; - SDL_assert(line[1] == '\t'); - SDL_assert(line[2] == 'c'); - SDL_assert(line[3] == ' '); + assert(line[1] == '\t'); + assert(line[2] == 'c'); + assert(line[3] == ' '); if (line[4] == '#') { index[i].color = 0xff000000 | strtol(&line[5], &endptr, 0x10); - SDL_assert(*endptr == '\0'); + assert(*endptr == '\0'); } else { - SDL_assert(!strcmp("None", &line[4])); + assert(!strcmp("None", &line[4])); index[i].color = 0; } } @@ -85,7 +88,8 @@ read_xpm(char *xpm[]) { char c = line[x]; uint32_t color; bool color_found = find_color(index, colors, c, &color); - SDL_assert(color_found); + assert(color_found); + (void) color_found; pixels[y * width + x] = color; } } diff --git a/app/src/util/queue.h b/app/src/util/queue.h index 6cf7aba69c..12bc9e8940 100644 --- a/app/src/util/queue.h +++ b/app/src/util/queue.h @@ -2,9 +2,9 @@ #ifndef QUEUE_H #define QUEUE_H +#include #include #include -#include #include "config.h" @@ -67,7 +67,7 @@ // type so that we can "return" it) #define queue_take(PQ, NEXTFIELD, PITEM) \ (void) ({ \ - SDL_assert(!queue_is_empty(PQ)); \ + assert(!queue_is_empty(PQ)); \ *(PITEM) = (PQ)->first; \ (PQ)->first = (PQ)->first->NEXTFIELD; \ }) diff --git a/app/src/video_buffer.c b/app/src/video_buffer.c index 9de3ad7f7d..629680d9b5 100644 --- a/app/src/video_buffer.c +++ b/app/src/video_buffer.c @@ -1,6 +1,6 @@ #include "video_buffer.h" -#include +#include #include #include #include @@ -91,7 +91,7 @@ video_buffer_offer_decoded_frame(struct video_buffer *vb, const AVFrame * video_buffer_consume_rendered_frame(struct video_buffer *vb) { - SDL_assert(!vb->rendering_frame_consumed); + assert(!vb->rendering_frame_consumed); vb->rendering_frame_consumed = true; fps_counter_add_rendered_frame(vb->fps_counter); if (vb->render_expired_frames) {