From 9e34f22a29cfe57f6c95dc453274da7a2d8664b9 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Fri, 14 Jul 2023 18:05:54 +0200 Subject: [PATCH] Silence Xcode code warnings + general cleanups --- command.c | 2 + gfx/video_driver.c | 4 +- gfx/video_shader_parse.c | 12 +- libretro-common/net/net_http.c | 477 ++++++++++++++++----------------- menu/cbs/menu_cbs_title.c | 2 +- menu/drivers/materialui.c | 6 +- menu/menu_displaylist.c | 14 +- runtime_file.c | 16 +- tasks/task_translation.c | 28 +- 9 files changed, 275 insertions(+), 286 deletions(-) diff --git a/command.c b/command.c index d89c52fd6c..ef7b4d59f8 100644 --- a/command.c +++ b/command.c @@ -422,6 +422,7 @@ bool command_get_config_param(command_t *cmd, const char* arg) reply[ _len] = ' '; reply[++_len] = '\0'; _len = strlcpy(reply + _len, value, sizeof(reply) - _len); + /* TODO/FIXME - replace strlen(reply) by _len? check if they are equal */ cmd->replier(cmd, reply, strlen(reply)); return true; } @@ -823,6 +824,7 @@ bool command_version(command_t *cmd, const char* arg) size_t _len = strlcpy(reply, PACKAGE_VERSION, sizeof(reply)); reply[ _len] = '\n'; reply[++_len] = '\0'; + /* TODO/FIXME - replace strlen(reply) by _len? Check if they are equal */ cmd->replier(cmd, reply, strlen(reply)); return true; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index df07b154c3..4e19a83f61 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3521,13 +3521,13 @@ void video_driver_frame(const void *data, unsigned width, status_text[++buf_pos ] = '|'; status_text[++buf_pos ] = ' '; status_text[++buf_pos ] = '\0'; - buf_pos += strlcpy( + strlcpy( status_text + buf_pos, runloop_st->core_status_msg.str, sizeof(status_text) - buf_pos); } else - buf_pos = strlcpy(status_text, + strlcpy(status_text, runloop_st->core_status_msg.str, sizeof(status_text)); } diff --git a/gfx/video_shader_parse.c b/gfx/video_shader_parse.c index 5970f72bf0..668098a03b 100644 --- a/gfx/video_shader_parse.c +++ b/gfx/video_shader_parse.c @@ -374,8 +374,10 @@ static void video_shader_replace_wildcards(char *inout_absolute_path, } { char *replace_output = string_replace_substring(replaced_path, - wildcard_tokens[i].token_name, strlen(wildcard_tokens[i].token_name), - replace_text, strlen(replace_text)); + wildcard_tokens[i].token_name, + strlen(wildcard_tokens[i].token_name), + replace_text, + strlen(replace_text)); strlcpy(replaced_path, replace_output, PATH_MAX_LENGTH); @@ -1524,7 +1526,7 @@ static bool video_shader_write_referenced_preset( /* If the reference path is the same as the path we want to save * or the reference path is in the config (auto shader) folder */ - if (string_is_equal(path_to_ref, path_to_save_conformed) + if ( string_is_equal(path_to_ref, path_to_save_conformed) || !strncmp(config_dir, path_to_ref, strlen(config_dir))) { /* If the config from the reference path has a reference in it, @@ -3002,9 +3004,9 @@ bool video_shader_apply_shader( else { msg[++_len] = '\0'; - _len += strlcpy(msg + _len, + strlcpy(msg + _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NONE), - sizeof(msg) - _len); + sizeof(msg) - _len); } #ifdef HAVE_GFX_WIDGETS diff --git a/libretro-common/net/net_http.c b/libretro-common/net/net_http.c index f43a432744..a57c79361d 100644 --- a/libretro-common/net/net_http.c +++ b/libretro-common/net/net_http.c @@ -716,16 +716,14 @@ const char* net_http_connection_method(struct http_connection_t* conn) struct http_t *net_http_new(struct http_connection_t *conn) { bool error = false; +#ifdef HAVE_SSL + if (!conn || (net_http_new_socket(conn)) < 0) + return NULL; +#else int fd = -1; - struct http_t *state = NULL; - - if (!conn) - goto error; - - if ((fd = net_http_new_socket(conn)) < 0) - goto error; - - error = false; + if (!conn || (fd = net_http_new_socket(conn)) < 0) + return NULL; +#endif /* This is a bit lazy, but it works. */ if (conn->methodcopy) @@ -786,7 +784,7 @@ struct http_t *net_http_new(struct http_connection_t *conn) char *len_str = NULL; if (!conn->postdatacopy) - goto error; + goto err; if (!conn->headerscopy) { @@ -842,49 +840,48 @@ struct http_t *net_http_new(struct http_connection_t *conn) net_http_send_str(&conn->sock_state, &error, conn->postdatacopy, strlen(conn->postdatacopy)); - if (error) - goto error; + if (!error) + { + struct http_t *state = (struct http_t*)malloc(sizeof(struct http_t)); + state->sock_state = conn->sock_state; + state->status = -1; + state->data = NULL; + state->part = P_HEADER_TOP; + state->bodytype = T_FULL; + state->error = false; + state->pos = 0; + state->len = 0; + state->buflen = 512; - state = (struct http_t*)malloc(sizeof(struct http_t)); - state->sock_state = conn->sock_state; - state->status = -1; - state->data = NULL; - state->part = P_HEADER_TOP; - state->bodytype = T_FULL; - state->error = false; - state->pos = 0; - state->len = 0; - state->buflen = 512; + if ((state->data = (char*)malloc(state->buflen))) + return state; + free(state); + } - if (!(state->data = (char*)malloc(state->buflen))) - goto error; - - return state; - -error: +err: if (conn) { if (conn->methodcopy) free(conn->methodcopy); if (conn->contenttypecopy) free(conn->contenttypecopy); - conn->methodcopy = NULL; - conn->contenttypecopy = NULL; - conn->postdatacopy = NULL; - } + conn->methodcopy = NULL; + conn->contenttypecopy = NULL; + conn->postdatacopy = NULL; + #ifdef HAVE_SSL - if (conn && conn->sock_state.ssl_ctx) - { - ssl_socket_close(conn->sock_state.ssl_ctx); - ssl_socket_free(conn->sock_state.ssl_ctx); - conn->sock_state.ssl_ctx = NULL; - } -#else - if (fd >= 0) - socket_close(fd); + if (conn->sock_state.ssl_ctx) + { + ssl_socket_close(conn->sock_state.ssl_ctx); + ssl_socket_free(conn->sock_state.ssl_ctx); + conn->sock_state.ssl_ctx = NULL; + } +#endif + } + +#ifndef HAVE_SSL + socket_close(fd); #endif - if (state) - free(state); return NULL; } @@ -911,248 +908,238 @@ int net_http_fd(struct http_t *state) **/ bool net_http_update(struct http_t *state, size_t* progress, size_t* total) { - ssize_t newlen = 0; - - if (!state) - return true; - if (state->error) - { - state->part = P_ERROR; - state->status = -1; - return true; - } - - if (state->part < P_BODY) + if (state) { + ssize_t newlen = 0; if (state->error) - { - state->part = P_ERROR; - state->status = -1; - return true; - } + goto error; -#ifdef HAVE_SSL - if (state->sock_state.ssl && state->sock_state.ssl_ctx) - newlen = ssl_socket_receive_all_nonblocking(state->sock_state.ssl_ctx, &state->error, - (uint8_t*)state->data + state->pos, - state->buflen - state->pos); - else -#endif - newlen = socket_receive_all_nonblocking(state->sock_state.fd, &state->error, - (uint8_t*)state->data + state->pos, - state->buflen - state->pos); - - if (newlen < 0) - { - state->error = true; - state->part = P_ERROR; - state->status = -1; - return true; - } - - if (state->pos + newlen >= state->buflen - 64) - { - state->buflen *= 2; - state->data = (char*)realloc(state->data, state->buflen); - } - state->pos += newlen; - - while (state->part < P_BODY) - { - char *dataend = state->data + state->pos; - char *lineend = (char*)memchr(state->data, '\n', state->pos); - - if (!lineend) - break; - - *lineend='\0'; - - if (lineend != state->data && lineend[-1]=='\r') - lineend[-1]='\0'; - - if (state->part == P_HEADER_TOP) - { - if (strncmp(state->data, "HTTP/1.", STRLEN_CONST("HTTP/1."))!=0) - { - state->error = true; - state->part = P_ERROR; - state->status = -1; - return true; - } - state->status = (int)strtoul(state->data - + STRLEN_CONST("HTTP/1.1 "), NULL, 10); - state->part = P_HEADER; - } - else - { - if (string_starts_with_case_insensitive(state->data, "Content-Length:")) - { - char* ptr = state->data + STRLEN_CONST("Content-Length:"); - while (ISSPACE(*ptr)) - ++ptr; - - state->bodytype = T_LEN; - state->len = strtol(ptr, NULL, 10); - } - if (string_is_equal_case_insensitive(state->data, "Transfer-Encoding: chunked")) - state->bodytype = T_CHUNK; - - /* TODO: save headers somewhere */ - if (state->data[0]=='\0') - { - state->part = P_BODY; - if (state->bodytype == T_CHUNK) - state->part = P_BODY_CHUNKLEN; - } - } - - memmove(state->data, lineend + 1, dataend-(lineend+1)); - state->pos = (dataend-(lineend + 1)); - } - - if (state->part >= P_BODY) - { - newlen = state->pos; - state->pos = 0; - } - } - - if (state->part >= P_BODY && state->part < P_DONE) - { - if (!newlen) + if (state->part < P_BODY) { if (state->error) - newlen = -1; - else - { + goto error; + #ifdef HAVE_SSL - if (state->sock_state.ssl && state->sock_state.ssl_ctx) - newlen = ssl_socket_receive_all_nonblocking( - state->sock_state.ssl_ctx, - &state->error, + if (state->sock_state.ssl && state->sock_state.ssl_ctx) + newlen = ssl_socket_receive_all_nonblocking(state->sock_state.ssl_ctx, &state->error, (uint8_t*)state->data + state->pos, state->buflen - state->pos); - else + else #endif - newlen = socket_receive_all_nonblocking( - state->sock_state.fd, - &state->error, + newlen = socket_receive_all_nonblocking(state->sock_state.fd, &state->error, (uint8_t*)state->data + state->pos, state->buflen - state->pos); - } if (newlen < 0) { - if (state->bodytype != T_FULL) - { - state->error = true; - state->part = P_ERROR; - state->status = -1; - return true; - } - state->part = P_DONE; - state->data = (char*)realloc(state->data, state->len); - newlen = 0; + state->error = true; + goto error; } if (state->pos + newlen >= state->buflen - 64) { - state->buflen *= 2; - state->data = (char*)realloc(state->data, state->buflen); + state->buflen *= 2; + state->data = (char*)realloc(state->data, state->buflen); } - } + state->pos += newlen; -parse_again: - if (state->bodytype == T_CHUNK) - { - if (state->part == P_BODY_CHUNKLEN) + while (state->part < P_BODY) { - state->pos += newlen; + char *dataend = state->data + state->pos; + char *lineend = (char*)memchr(state->data, '\n', state->pos); - if (state->pos - state->len >= 2) + if (!lineend) + break; + + *lineend = '\0'; + + if (lineend != state->data && lineend[-1]=='\r') + lineend[-1] = '\0'; + + if (state->part == P_HEADER_TOP) { - /* - * len=start of chunk including \r\n - * pos=end of data - */ - - char *fullend = state->data + state->pos; - char *end = (char*)memchr(state->data + state->len + 2, '\n', - state->pos - state->len - 2); - - if (end) + if (strncmp(state->data, "HTTP/1.", STRLEN_CONST("HTTP/1."))!=0) { - size_t chunklen = strtoul(state->data+state->len, NULL, 16); - state->pos = state->len; - end++; + state->error = true; + goto error; + } + state->status = (int)strtoul(state->data + + STRLEN_CONST("HTTP/1.1 "), NULL, 10); + state->part = P_HEADER; + } + else + { + if (string_starts_with_case_insensitive(state->data, "Content-Length:")) + { + char* ptr = state->data + STRLEN_CONST("Content-Length:"); + while (ISSPACE(*ptr)) + ++ptr; - memmove(state->data+state->len, end, fullend-end); - - state->len = chunklen; - newlen = (fullend - end); - - /* - len=num bytes - newlen=unparsed bytes after \n - pos=start of chunk including \r\n - */ + state->bodytype = T_LEN; + state->len = strtol(ptr, NULL, 10); + } + if (string_is_equal_case_insensitive(state->data, "Transfer-Encoding: chunked")) + state->bodytype = T_CHUNK; + /* TODO: save headers somewhere */ + if (state->data[0]=='\0') + { state->part = P_BODY; - if (state->len == 0) - { - state->part = P_DONE; - state->len = state->pos; - state->data = (char*)realloc(state->data, state->len); - } - goto parse_again; + if (state->bodytype == T_CHUNK) + state->part = P_BODY_CHUNKLEN; } } + + memmove(state->data, lineend + 1, dataend-(lineend+1)); + state->pos = (dataend-(lineend + 1)); } - else if (state->part == P_BODY) + + if (state->part >= P_BODY) { - if ((size_t)newlen >= state->len) - { - state->pos += state->len; - newlen -= state->len; - state->len = state->pos; - state->part = P_BODY_CHUNKLEN; - goto parse_again; - } - state->pos += newlen; - state->len -= newlen; + newlen = state->pos; + state->pos = 0; } } - else + + if (state->part >= P_BODY && state->part < P_DONE) { - state->pos += newlen; + if (!newlen) + { + if (state->error) + newlen = -1; + else + { +#ifdef HAVE_SSL + if (state->sock_state.ssl && state->sock_state.ssl_ctx) + newlen = ssl_socket_receive_all_nonblocking( + state->sock_state.ssl_ctx, + &state->error, + (uint8_t*)state->data + state->pos, + state->buflen - state->pos); + else +#endif + newlen = socket_receive_all_nonblocking( + state->sock_state.fd, + &state->error, + (uint8_t*)state->data + state->pos, + state->buflen - state->pos); + } - if (state->pos > state->len) - { - state->error = true; - state->part = P_ERROR; - state->status = -1; - return true; + if (newlen < 0) + { + if (state->bodytype != T_FULL) + { + state->error = true; + goto error; + } + state->part = P_DONE; + state->data = (char*)realloc(state->data, state->len); + newlen = 0; + } + + if (state->pos + newlen >= state->buflen - 64) + { + state->buflen *= 2; + state->data = (char*)realloc(state->data, state->buflen); + } } - else if (state->pos == state->len) + +parse_again: + if (state->bodytype == T_CHUNK) { - state->part = P_DONE; - state->data = (char*)realloc(state->data, state->len); + if (state->part == P_BODY_CHUNKLEN) + { + state->pos += newlen; + + if (state->pos - state->len >= 2) + { + /* + * len=start of chunk including \r\n + * pos=end of data + */ + + char *fullend = state->data + state->pos; + char *end = (char*)memchr(state->data + state->len + 2, '\n', + state->pos - state->len - 2); + + if (end) + { + size_t chunklen = strtoul(state->data+state->len, NULL, 16); + state->pos = state->len; + end++; + + memmove(state->data+state->len, end, fullend-end); + + state->len = chunklen; + newlen = (fullend - end); + + /* + len=num bytes + newlen=unparsed bytes after \n + pos=start of chunk including \r\n + */ + + state->part = P_BODY; + if (state->len == 0) + { + state->part = P_DONE; + state->len = state->pos; + state->data = (char*)realloc(state->data, state->len); + } + goto parse_again; + } + } + } + else if (state->part == P_BODY) + { + if ((size_t)newlen >= state->len) + { + state->pos += state->len; + newlen -= state->len; + state->len = state->pos; + state->part = P_BODY_CHUNKLEN; + goto parse_again; + } + state->pos += newlen; + state->len -= newlen; + } + } + else + { + state->pos += newlen; + + if (state->pos > state->len) + { + state->error = true; + goto error; + } + else if (state->pos == state->len) + { + state->part = P_DONE; + state->data = (char*)realloc(state->data, state->len); + } } } + + if (progress) + *progress = state->pos; + + if (total) + { + if (state->bodytype == T_LEN) + *total = state->len; + else + *total = 0; + } + + if (state->part != P_DONE) + return false; } - - if (progress) - *progress = state->pos; - - if (total) - { - if (state->bodytype == T_LEN) - *total = state->len; - else - *total = 0; - } - - return (state->part == P_DONE); + return true; +error: + state->part = P_ERROR; + state->status = -1; + return true; } /** diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index cea98e59d9..8c752f9f2a 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -540,7 +540,7 @@ static int action_get_title_dropdown_input_description_common( /* Build title string */ _len = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PORT), len); _len += snprintf(s + _len, len - _len, " %u - ", port + 1); - _len += strlcpy (s + _len, input_label, len - _len); + strlcpy(s + _len, input_label, len - _len); return 1; } diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 32f13a2603..30edf59ab3 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -3481,9 +3481,9 @@ static bool materialui_render_process_entry_playlist_desktop( _len += strlcpy(mui->status_bar.str + _len, MUI_TICKER_SPACER, sizeof(mui->status_bar.str) - _len); - _len += strlcpy(mui->status_bar.str + _len, - last_played_str, - sizeof(mui->status_bar.str) - _len); + strlcpy(mui->status_bar.str + _len, + last_played_str, + sizeof(mui->status_bar.str) - _len); /* All metadata is cached */ mui->status_bar.cached = true; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index dca264290c..35c26a7218 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1898,7 +1898,8 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list) entry[++_len] = ' '; entry[++_len] = '\0'; _len += strlcpy (entry + _len, os_ver, sizeof(entry) - _len); - _len += snprintf(entry + _len, sizeof(entry) - _len, + snprintf(entry + _len, + sizeof(entry) - _len, " (v%d.%d)", major, minor); if (menu_entries_append(list, entry, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, @@ -6219,7 +6220,7 @@ static unsigned menu_displaylist_populate_subsystem( { _len += strlcpy(s + _len, " [", sizeof(s) - _len); _len += strlcpy(s + _len, rom_buff, sizeof(s) - _len); - _len += strlcpy(s + _len, "]", sizeof(s) - _len); + strlcpy(s + _len, "]", sizeof(s) - _len); } } @@ -6254,7 +6255,7 @@ static unsigned menu_displaylist_populate_subsystem( _len += strlcpy(s + _len, " ", sizeof(s) - _len); _len += strlcpy(s + _len, subsystem->roms[0].desc, sizeof(s) - _len); - _len += strlcpy(s + _len, "]", sizeof(s) - _len); + strlcpy(s + _len, "]", sizeof(s) - _len); } } @@ -6416,7 +6417,7 @@ static unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list) _len += strlcpy(passworded + _len, msg_room_pwd, sizeof(passworded) - _len); - _len += strlcpy(passworded + _len, "] ", + strlcpy(passworded + _len, "] ", sizeof(passworded) - _len); } else @@ -6431,8 +6432,8 @@ static unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list) { size_t _len2 = strlcpy(country, " (", sizeof(country)); _len2 += strlcpy(country + _len2, room->country, sizeof(country) - _len2); - _len2 += strlcpy(country + _len2, ")", sizeof(country) - _len2); - strlcpy(buf + _len, country, sizeof(buf) - _len); + strlcpy(country + _len2, ")", sizeof(country) - _len2); + strlcpy(buf + _len, country, sizeof(buf) - _len); } else *country = '\0'; @@ -7839,7 +7840,6 @@ unsigned menu_displaylist_build_list( strlcpy(off_string + _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), sizeof(off_string) - _len); - _len = 0; } else { diff --git a/runtime_file.c b/runtime_file.c index 9c23586447..f2832c0edb 100644 --- a/runtime_file.c +++ b/runtime_file.c @@ -572,7 +572,7 @@ static void runtime_log_get_last_played_time(runtime_log_t *runtime_log, static bool runtime_last_played_human(runtime_log_t *runtime_log, char *str, size_t len) { - size_t _len, _len2; + size_t _len; struct tm time_info; time_t last_played; time_t current; @@ -612,16 +612,16 @@ static bool runtime_last_played_human(runtime_log_t *runtime_log, /* Generate string */ _len = snprintf(tmp, sizeof(tmp), "%u ", (int)delta); - _len += strlcpy (tmp + _len, + strlcpy(tmp + _len, msg_hash_to_str((enum msg_hash_enums)units[i][(delta == 1) ? 0 : 1]), - sizeof(tmp) - _len); + sizeof(tmp) - _len); - _len2 = strlcat(str, tmp, len); - str[ _len2] = ' '; - str[++_len2] = '\0'; - _len2 += strlcpy(str + _len2, + _len = strlcat(str, tmp, len); + str[ _len] = ' '; + str[++_len] = '\0'; + strlcpy(str + _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_TIME_UNIT_AGO), - len - _len2); + len - _len); return true; } diff --git a/tasks/task_translation.c b/tasks/task_translation.c index d2e69c4943..1ef7cd0621 100644 --- a/tasks/task_translation.c +++ b/tasks/task_translation.c @@ -134,7 +134,6 @@ static void handle_translation_cb( retro_task_t *task, void *task_data, void *user_data, const char *error) { - size_t pitch; unsigned width, height; unsigned image_width, image_height; uint8_t* raw_output_data = NULL; @@ -298,7 +297,6 @@ static void handle_translation_cb( dummy_data = video_st->frame_cache_data; width = video_st->frame_cache_width; height = video_st->frame_cache_height; - pitch = video_st->frame_cache_pitch; /* try two different modes for text display * * In the first mode, we use display widget overlays, but they require @@ -314,12 +312,12 @@ static void handle_translation_cb( bool ai_res; enum image_type_enum image_type; /* Write to overlay */ - if ( raw_image_file_data[0] == 'B' && - raw_image_file_data[1] == 'M') + if ( raw_image_file_data[0] == 'B' + && raw_image_file_data[1] == 'M') image_type = IMAGE_TYPE_BMP; - else if (raw_image_file_data[1] == 'P' && - raw_image_file_data[2] == 'N' && - raw_image_file_data[3] == 'G') + else if ( raw_image_file_data[1] == 'P' + && raw_image_file_data[2] == 'N' + && raw_image_file_data[3] == 'G') image_type = IMAGE_TYPE_PNG; else { @@ -352,6 +350,7 @@ static void handle_translation_cb( #endif /* Can't use display widget overlays, so try writing to video buffer */ { + size_t pitch; /* Write to video buffer directly (software cores only) */ if (raw_image_file_data[0] == 'B' && raw_image_file_data[1] == 'M') { @@ -434,8 +433,7 @@ static void handle_translation_cb( goto finish; } - scaler = (struct scaler_ctx*)calloc(1, sizeof(struct scaler_ctx)); - if (!scaler) + if (!(scaler = (struct scaler_ctx*)calloc(1, sizeof(struct scaler_ctx)))) goto finish; if (dummy_data == RETRO_HW_FRAME_BUFFER_VALID) @@ -460,14 +458,14 @@ static void handle_translation_cb( raw_output_data = (uint8_t*)malloc(width * height * 4 * sizeof(uint8_t)); scaler->out_fmt = SCALER_FMT_ARGB8888; pitch = width * 4; - scaler->out_stride = width * 4; + scaler->out_stride = pitch; } else { raw_output_data = (uint8_t*)malloc(width * height * 2 * sizeof(uint8_t)); scaler->out_fmt = SCALER_FMT_RGB565; pitch = width * 2; - scaler->out_stride = width * 1; + scaler->out_stride = width; } if (!raw_output_data) @@ -1096,9 +1094,9 @@ bool run_translation_service(settings_t *settings, bool paused) switch (ai_service_mode) { case 2: - _len += strlcpy(new_ai_service_url + _len, + strlcpy(new_ai_service_url + _len, "text", - sizeof(new_ai_service_url) - _len); + sizeof(new_ai_service_url) - _len); break; case 1: case 3: @@ -1116,9 +1114,9 @@ bool run_translation_service(settings_t *settings, bool paused) if ( video_st->poke && video_st->poke->load_texture && video_st->poke->unload_texture) - _len += strlcpy(new_ai_service_url + _len, + strlcpy(new_ai_service_url + _len, ",png-a", - sizeof(new_ai_service_url) - _len); + sizeof(new_ai_service_url) - _len); #endif break; default: