Fix several build warnings and minor bugs

This commit is contained in:
Cameron Gutman 2022-11-20 19:20:42 -06:00
parent 56f84ab662
commit 098f53cd0b
11 changed files with 16 additions and 18 deletions

View File

@ -5,6 +5,8 @@ SET(CMAKE_C_STANDARD 99)
include(${CMAKE_ROOT}/Modules/GNUInstallDirs.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/generate_version_header.cmake)
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-pointer-sign -Wno-sign-compare -Wno-switch)
aux_source_directory(./src SRC_LIST)
list(APPEND SRC_LIST ./src/input/evdev.c ./src/input/mapping.c ./src/input/udev.c)

View File

@ -421,7 +421,7 @@ int gs_unpair(PSERVER_DATA server) {
int gs_pair(PSERVER_DATA server, char* pin) {
int ret = GS_OK;
char* result = NULL;
char url[4096];
char url[5120];
uuid_t uuid;
char uuid_str[UUID_STRLEN];
@ -701,10 +701,8 @@ int gs_start_app(PSERVER_DATA server, STREAM_CONFIGURATION *config, int appId, b
PDISPLAY_MODE mode = server->modes;
bool correct_mode = false;
bool supported_resolution = false;
while (mode != NULL) {
if (mode->width == config->width && mode->height == config->height) {
supported_resolution = true;
if (mode->refresh == config->fps)
correct_mode = true;
}

View File

@ -26,9 +26,6 @@
static CURL *curl;
static const char *pCertFile = "./client.pem";
static const char *pKeyFile = "./key.pem";
static bool debug;
static size_t _write_curl(void *contents, size_t size, size_t nmemb, void *userp)

View File

@ -25,8 +25,6 @@
#define STATUS_OK 200
static XML_Parser parser;
struct xml_query {
char *memory;
size_t size;

View File

@ -240,12 +240,14 @@ void *HandleMouseEmulation(void* param)
deltaY = pow((float)rawY / 32767.0f * MOUSE_EMULATION_MOTION_MULTIPLIER, 3);
// Enforce deadzones
deltaX = abs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0;
deltaY = abs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0;
deltaX = fabs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0;
deltaY = fabs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0;
if (deltaX != 0 || deltaY != 0)
LiSendMouseMoveEvent(deltaX, -deltaY);
}
return NULL;
}
static bool evdev_handle_event(struct input_event *ev, struct input_device *dev) {
@ -923,7 +925,7 @@ void evdev_map(char* device) {
buf += sprintf(buf, "%02x", ((unsigned char*) guid)[i]);
struct mapping map;
strncpy(map.name, libevdev_get_name(evdev), sizeof(map.name));
strncpy(map.name, name, sizeof(map.name));
strncpy(map.guid, str_guid, sizeof(map.guid));
libevdev_free(evdev);

View File

@ -36,7 +36,6 @@ static struct mapping* defaultMappings;
static struct udev *udev;
static struct udev_monitor *udev_mon;
static int udev_fd;
static int inputRotate;
static int udev_handle(int fd) {

View File

@ -381,7 +381,7 @@ int main(int argc, char* argv[]) {
if (config.pin > 0 && config.pin <= 9999) {
sprintf(pin, "%04d", config.pin);
} else {
sprintf(pin, "%d%d%d%d", (int)random() % 10, (int)random() % 10, (int)random() % 10, (int)random() % 10);
sprintf(pin, "%d%d%d%d", (unsigned)random() % 10, (unsigned)random() % 10, (unsigned)random() % 10, (unsigned)random() % 10);
}
printf("Please enter the following PIN on the target PC: %s\n", pin);
fflush(stdout);

View File

@ -82,6 +82,7 @@ void sdl_loop() {
case SDL_TOGGLE_FULLSCREEN:
fullscreen_flags ^= SDL_WINDOW_FULLSCREEN;
SDL_SetWindowFullscreen(window, fullscreen_flags);
break;
case SDL_MOUSE_GRAB:
SDL_ShowCursor(SDL_ENABLE);
SDL_SetRelativeMouseMode(SDL_TRUE);

View File

@ -143,7 +143,6 @@ void egl_init(EGLNativeDisplayType native_display, NativeWindowType native_windo
GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertex_shader, 1, &vertex_source, NULL);
glCompileShader(vertex_shader);
GLint maxLength = 0;
GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragment_shader, 1, &fragment_source, NULL);

View File

@ -65,6 +65,7 @@ int vaapi_init_lib() {
int vaapi_init(AVCodecContext* decoder_ctx) {
decoder_ctx->get_format = va_get_format;
decoder_ctx->get_buffer2 = va_get_buffer;
return 0;
}
void vaapi_queue(AVFrame* dec_frame, Window win, int width, int height) {

View File

@ -32,7 +32,8 @@
FILE* h264_dbgfile = NULL;
#define printf(...) fprintf((h264_dbgfile == NULL ? stdout : h264_dbgfile), __VA_ARGS__)
void fake_printf(int, ...) {}
#define printf(...) fake_printf(0, __VA_ARGS__)
/**
Calculate the log base 2 of the argument, rounded up.
@ -554,7 +555,7 @@ void read_pic_parameter_set_rbsp(h264_stream_t* h, bs_t* b)
if( 1 ) { have_more_data = more_rbsp_data(h, b); }
if( 0 )
{
have_more_data = pps->transform_8x8_mode_flag | pps->pic_scaling_matrix_present_flag | pps->second_chroma_qp_index_offset != 0;
have_more_data = pps->transform_8x8_mode_flag | pps->pic_scaling_matrix_present_flag | (pps->second_chroma_qp_index_offset != 0);
}
if( have_more_data )
@ -1441,7 +1442,7 @@ void write_pic_parameter_set_rbsp(h264_stream_t* h, bs_t* b)
if( 0 ) { have_more_data = more_rbsp_data(h, b); }
if( 1 )
{
have_more_data = pps->transform_8x8_mode_flag | pps->pic_scaling_matrix_present_flag | pps->second_chroma_qp_index_offset != 0;
have_more_data = pps->transform_8x8_mode_flag | pps->pic_scaling_matrix_present_flag | (pps->second_chroma_qp_index_offset != 0);
}
if( have_more_data )
@ -2328,7 +2329,7 @@ void read_debug_pic_parameter_set_rbsp(h264_stream_t* h, bs_t* b)
if( 1 ) { have_more_data = more_rbsp_data(h, b); }
if( 0 )
{
have_more_data = pps->transform_8x8_mode_flag | pps->pic_scaling_matrix_present_flag | pps->second_chroma_qp_index_offset != 0;
have_more_data = pps->transform_8x8_mode_flag | pps->pic_scaling_matrix_present_flag | (pps->second_chroma_qp_index_offset != 0);
}
if( have_more_data )