Display and control your Android device
Include config.h everywhere
Romain Vimont1f8ba1ca79f4
diff --git a/app/src/buffer_util.h b/app/src/buffer_util.hindex a79014b1..681421f3 100644--- a/app/src/buffer_util.h+++ b/app/src/buffer_util.h@@ -4,6 +4,8 @@#include <stdbool.h>#include <stdint.h>+#include "config.h"+static inline voidbuffer_write16be(uint8_t *buf, uint16_t value) {buf[0] = value >> 8;diff --git a/app/src/cbuf.h b/app/src/cbuf.hindex 35b39b7b..c18e4680 100644--- a/app/src/cbuf.h+++ b/app/src/cbuf.h@@ -5,6 +5,8 @@#include <stdbool.h>#include <unistd.h>+#include "config.h"+// To define a circular buffer type of 20 ints:// struct cbuf_int CBUF(int, 20);//diff --git a/app/src/command.c b/app/src/command.cindex 4cb2e408..d914e6ab 100644--- a/app/src/command.c+++ b/app/src/command.c@@ -5,6 +5,7 @@#include <stdlib.h>#include <string.h>+#include "config.h"#include "common.h"#include "log.h"#include "str_util.h"diff --git a/app/src/command.h b/app/src/command.hindex db6358da..d119c9bb 100644--- a/app/src/command.h+++ b/app/src/command.h@@ -33,6 +33,8 @@#endif+#include "config.h"+# define NO_EXIT_CODE -1enum process_result {diff --git a/app/src/common.h b/app/src/common.hindex 8963f058..e5cbe953 100644--- a/app/src/common.h+++ b/app/src/common.h@@ -3,6 +3,8 @@#include <stdint.h>+#include "config.h"+#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))#define MIN(X,Y) (X) < (Y) ? (X) : (Y)#define MAX(X,Y) (X) > (Y) ? (X) : (Y)diff --git a/app/src/control_msg.c b/app/src/control_msg.cindex 9c3d9849..fff93592 100644--- a/app/src/control_msg.c+++ b/app/src/control_msg.c@@ -2,6 +2,7 @@#include <string.h>+#include "config.h"#include "buffer_util.h"#include "log.h"#include "str_util.h"diff --git a/app/src/control_msg.h b/app/src/control_msg.hindex e7fdfc4c..308d54a3 100644--- a/app/src/control_msg.h+++ b/app/src/control_msg.h@@ -5,6 +5,7 @@#include <stddef.h>#include <stdint.h>+#include "config.h"#include "android/input.h"#include "android/keycodes.h"#include "common.h"diff --git a/app/src/controller.h b/app/src/controller.hindex ae13e39f..1b0d005b 100644--- a/app/src/controller.h+++ b/app/src/controller.h@@ -5,6 +5,7 @@#include <SDL2/SDL_mutex.h>#include <SDL2/SDL_thread.h>+#include "config.h"#include "cbuf.h"#include "control_msg.h"#include "net.h"diff --git a/app/src/decoder.c b/app/src/decoder.cindex 8fa218f4..cad19913 100644--- a/app/src/decoder.c+++ b/app/src/decoder.c@@ -8,8 +8,8 @@#include <SDL2/SDL_thread.h>#include <unistd.h>-#include "compat.h"#include "config.h"+#include "compat.h"#include "buffer_util.h"#include "events.h"#include "lock_util.h"diff --git a/app/src/decoder.h b/app/src/decoder.hindex 76fee80e..f243812c 100644--- a/app/src/decoder.h+++ b/app/src/decoder.h@@ -4,6 +4,8 @@#include <stdbool.h>#include <libavformat/avformat.h>+#include "config.h"+struct video_buffer;struct decoder {diff --git a/app/src/device.c b/app/src/device.cindex 8027ccbb..4f50ab48 100644--- a/app/src/device.c+++ b/app/src/device.c@@ -1,4 +1,6 @@#include "device.h"++#include "config.h"#include "log.h"booldiff --git a/app/src/device.h b/app/src/device.hindex 828443d7..34a5f17f 100644--- a/app/src/device.h+++ b/app/src/device.h@@ -3,6 +3,7 @@#include <stdbool.h>+#include "config.h"#include "common.h"#include "net.h"diff --git a/app/src/device_msg.c b/app/src/device_msg.cindex a90d78dd..2fc90ae4 100644--- a/app/src/device_msg.c+++ b/app/src/device_msg.c@@ -3,6 +3,7 @@#include <string.h>#include <SDL2/SDL_assert.h>+#include "config.h"#include "buffer_util.h"#include "log.h"diff --git a/app/src/device_msg.h b/app/src/device_msg.hindex fd4a7eb1..04723597 100644--- a/app/src/device_msg.h+++ b/app/src/device_msg.h@@ -5,6 +5,8 @@#include <stdint.h>#include <unistd.h>+#include "config.h"+#define DEVICE_MSG_TEXT_MAX_LENGTH 4093#define DEVICE_MSG_SERIALIZED_MAX_SIZE (3 + DEVICE_MSG_TEXT_MAX_LENGTH)diff --git a/app/src/event_converter.c b/app/src/event_converter.cindex dea61eee..da4b2e30 100644--- a/app/src/event_converter.c+++ b/app/src/event_converter.c@@ -1,5 +1,7 @@#include "event_converter.h"+#include "config.h"+#define MAP(FROM, TO) case FROM: *to = TO; return true#define FAIL default: return falsediff --git a/app/src/event_converter.h b/app/src/event_converter.hindex 2d7aa1ae..e0b24c15 100644--- a/app/src/event_converter.h+++ b/app/src/event_converter.h@@ -4,6 +4,7 @@#include <stdbool.h>#include <SDL2/SDL_events.h>+#include "config.h"#include "control_msg.h"struct complete_mouse_motion_event {diff --git a/app/src/file_handler.h b/app/src/file_handler.hindex 3418c532..4c158296 100644--- a/app/src/file_handler.h+++ b/app/src/file_handler.h@@ -5,6 +5,7 @@#include <SDL2/SDL_mutex.h>#include <SDL2/SDL_thread.h>+#include "config.h"#include "cbuf.h"#include "command.h"diff --git a/app/src/fps_counter.c b/app/src/fps_counter.cindex daece470..2a9478f6 100644--- a/app/src/fps_counter.c+++ b/app/src/fps_counter.c@@ -3,6 +3,7 @@#include <SDL2/SDL_assert.h>#include <SDL2/SDL_timer.h>+#include "config.h"#include "lock_util.h"#include "log.h"diff --git a/app/src/fps_counter.h b/app/src/fps_counter.hindex 6b560a35..1c56bb01 100644--- a/app/src/fps_counter.h+++ b/app/src/fps_counter.h@@ -7,6 +7,8 @@#include <SDL2/SDL_mutex.h>#include <SDL2/SDL_thread.h>+#include "config.h"+struct fps_counter {SDL_Thread *thread;SDL_mutex *mutex;diff --git a/app/src/input_manager.c b/app/src/input_manager.cindex e6b3738b..cf2a7519 100644--- a/app/src/input_manager.c+++ b/app/src/input_manager.c@@ -1,6 +1,8 @@#include "input_manager.h"#include <SDL2/SDL_assert.h>++#include "config.h"#include "event_converter.h"#include "lock_util.h"#include "log.h"diff --git a/app/src/input_manager.h b/app/src/input_manager.hindex 83cb7405..61a0447f 100644--- a/app/src/input_manager.h+++ b/app/src/input_manager.h@@ -3,6 +3,7 @@#include <stdbool.h>+#include "config.h"#include "common.h"#include "controller.h"#include "fps_counter.h"diff --git a/app/src/lock_util.h b/app/src/lock_util.hindex d1ca7336..260d2c12 100644--- a/app/src/lock_util.h+++ b/app/src/lock_util.h@@ -4,6 +4,7 @@#include <stdint.h>#include <SDL2/SDL_mutex.h>+#include "config.h"#include "log.h"static inline voiddiff --git a/app/src/main.c b/app/src/main.cindex 3be74d6b..c00bf419 100644--- a/app/src/main.c+++ b/app/src/main.c@@ -8,8 +8,8 @@#define SDL_MAIN_HANDLED // avoid link error on Linux Windows Subsystem#include <SDL2/SDL.h>-#include "compat.h"#include "config.h"+#include "compat.h"#include "log.h"#include "recorder.h"diff --git a/app/src/net.c b/app/src/net.cindex a0bc38f2..bf4389dd 100644--- a/app/src/net.c+++ b/app/src/net.c@@ -2,6 +2,7 @@#include <stdio.h>+#include "config.h"#include "log.h"#ifdef __WINDOWS__diff --git a/app/src/net.h b/app/src/net.hindex dd82c083..ffd5dd89 100644--- a/app/src/net.h+++ b/app/src/net.h@@ -17,6 +17,8 @@typedef int socket_t;#endif+#include "config.h"+boolnet_init(void);diff --git a/app/src/queue.h b/app/src/queue.hindex ed3d4c21..6cf7aba6 100644--- a/app/src/queue.h+++ b/app/src/queue.h@@ -6,6 +6,8 @@#include <stddef.h>#include <SDL2/SDL_assert.h>+#include "config.h"+// To define a queue type of "struct foo":// struct queue_foo QUEUE(struct foo);#define QUEUE(TYPE) { \diff --git a/app/src/receiver.h b/app/src/receiver.hindex c119b827..6108e545 100644--- a/app/src/receiver.h+++ b/app/src/receiver.h@@ -5,6 +5,7 @@#include <SDL2/SDL_mutex.h>#include <SDL2/SDL_thread.h>+#include "config.h"#include "net.h"// receive events from the devicediff --git a/app/src/recorder.c b/app/src/recorder.cindex 0d4e4e68..77186350 100644--- a/app/src/recorder.c+++ b/app/src/recorder.c@@ -3,8 +3,8 @@#include <libavutil/time.h>#include <SDL2/SDL_assert.h>-#include "compat.h"#include "config.h"+#include "compat.h"#include "lock_util.h"#include "log.h"diff --git a/app/src/recorder.h b/app/src/recorder.hindex af541882..b1953fcb 100644--- a/app/src/recorder.h+++ b/app/src/recorder.h@@ -6,6 +6,7 @@#include <SDL2/SDL_mutex.h>#include <SDL2/SDL_thread.h>+#include "config.h"#include "common.h"#include "queue.h"diff --git a/app/src/scrcpy.c b/app/src/scrcpy.cindex ed988778..defcb751 100644--- a/app/src/scrcpy.c+++ b/app/src/scrcpy.c@@ -7,6 +7,7 @@#include <sys/time.h>#include <SDL2/SDL.h>+#include "config.h"#include "command.h"#include "common.h"#include "compat.h"diff --git a/app/src/scrcpy.h b/app/src/scrcpy.hindex faeb246f..1593fb1e 100644--- a/app/src/scrcpy.h+++ b/app/src/scrcpy.h@@ -5,6 +5,8 @@#include <stdint.h>#include <recorder.h>+#include "config.h"+struct scrcpy_options {const char *serial;const char *crop;diff --git a/app/src/screen.h b/app/src/screen.hindex 63da6aa5..bc189189 100644--- a/app/src/screen.h+++ b/app/src/screen.h@@ -5,6 +5,7 @@#include <SDL2/SDL.h>#include <libavformat/avformat.h>+#include "config.h"#include "common.h"struct video_buffer;diff --git a/app/src/server.h b/app/src/server.hindex 4970d64e..2140d8ab 100644--- a/app/src/server.h+++ b/app/src/server.h@@ -4,6 +4,7 @@#include <stdbool.h>#include <stdint.h>+#include "config.h"#include "command.h"#include "net.h"diff --git a/app/src/str_util.c b/app/src/str_util.cindex 7d46a1a0..15378d8a 100644--- a/app/src/str_util.c+++ b/app/src/str_util.c@@ -10,6 +10,8 @@#include <SDL2/SDL_stdinc.h>+#include "config.h"+size_txstrncpy(char *dest, const char *src, size_t n) {size_t i;diff --git a/app/src/str_util.h b/app/src/str_util.hindex 0b7a571a..56490190 100644--- a/app/src/str_util.h+++ b/app/src/str_util.h@@ -3,6 +3,8 @@#include <stddef.h>+#include "config.h"+// like strncpy, except:// - it copies at most n-1 chars// - the dest string is nul-terminateddiff --git a/app/src/stream.c b/app/src/stream.cindex bca89f71..6c3192f2 100644--- a/app/src/stream.c+++ b/app/src/stream.c@@ -8,8 +8,8 @@#include <SDL2/SDL_thread.h>#include <unistd.h>-#include "compat.h"#include "config.h"+#include "compat.h"#include "buffer_util.h"#include "decoder.h"#include "events.h"diff --git a/app/src/stream.h b/app/src/stream.hindex 160ed7f5..cb50468e 100644--- a/app/src/stream.h+++ b/app/src/stream.h@@ -7,6 +7,7 @@#include <SDL2/SDL_atomic.h>#include <SDL2/SDL_thread.h>+#include "config.h"#include "net.h"struct video_buffer;diff --git a/app/src/sys/unix/command.c b/app/src/sys/unix/command.cindex 9e00ccf8..6a3a5a47 100644--- a/app/src/sys/unix/command.c+++ b/app/src/sys/unix/command.c@@ -7,6 +7,8 @@#include "command.h"+#include "config.h"+#include <errno.h>#include <fcntl.h>#include <limits.h>diff --git a/app/src/sys/unix/net.c b/app/src/sys/unix/net.cindex 199cd7c2..d940f3bb 100644--- a/app/src/sys/unix/net.c+++ b/app/src/sys/unix/net.c@@ -2,6 +2,8 @@#include <unistd.h>+#include "config.h"+boolnet_init(void) {// do nothingdiff --git a/app/src/sys/win/net.c b/app/src/sys/win/net.cindex dc483682..55519782 100644--- a/app/src/sys/win/net.c+++ b/app/src/sys/win/net.c@@ -1,5 +1,6 @@#include "net.h"+#include "config.h"#include "log.h"booldiff --git a/app/src/tiny_xpm.c b/app/src/tiny_xpm.cindex 0fb410f3..5ea89078 100644--- a/app/src/tiny_xpm.c+++ b/app/src/tiny_xpm.c@@ -5,6 +5,7 @@#include <stdio.h>#include <stdlib.h>+#include "config.h"#include "log.h"struct index {diff --git a/app/src/tiny_xpm.h b/app/src/tiny_xpm.hindex 85dea5c2..6e6f8035 100644--- a/app/src/tiny_xpm.h+++ b/app/src/tiny_xpm.h@@ -3,6 +3,8 @@#include <SDL2/SDL.h>+#include "config.h"+SDL_Surface *read_xpm(char *xpm[]);diff --git a/app/src/video_buffer.h b/app/src/video_buffer.hindex 26a6fa1f..303b3fc2 100644--- a/app/src/video_buffer.h+++ b/app/src/video_buffer.h@@ -4,6 +4,7 @@#include <stdbool.h>#include <SDL2/SDL_mutex.h>+#include "config.h"#include "fps_counter.h"// forward declarations