mirror of
https://github.com/libretro/libretro-common.git
synced 2024-06-22 14:12:37 -04:00
Updates
This commit is contained in:
parent
6419cc4fd0
commit
db0ddbefe8
|
@ -8,17 +8,15 @@ INSTALLDIR := $(PREFIX)/lib/retroarch/filters/audio
|
|||
|
||||
ifeq ($(platform),)
|
||||
platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
ifeq ($(shell uname -s),)
|
||||
platform = win
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
else ifneq ($(findstring Darwin,$(shell uname -s)),)
|
||||
platform = osx
|
||||
arch = intel
|
||||
arch = intel
|
||||
ifeq ($(shell uname -p),powerpc)
|
||||
arch = ppc
|
||||
endif
|
||||
else ifneq ($(findstring win,$(shell uname -a)),)
|
||||
else ifneq ($(findstring MINGW,$(shell uname -s)),)
|
||||
platform = win
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -348,12 +348,12 @@ static unsigned char check_arm_cpu_feature(const char* feature)
|
|||
if (!fp)
|
||||
return 0;
|
||||
|
||||
while (filestream_gets(fp, line, sizeof(line)) != NULL)
|
||||
while (filestream_gets(fp, line, sizeof(line)))
|
||||
{
|
||||
if (strncmp(line, "Features\t: ", 11))
|
||||
continue;
|
||||
|
||||
if (strstr(line + 11, feature) != NULL)
|
||||
if (strstr(line + 11, feature))
|
||||
status = 1;
|
||||
|
||||
break;
|
||||
|
|
|
@ -256,7 +256,7 @@ static int sevenzip_file_read(
|
|||
|
||||
outsize = outSizeProcessed;
|
||||
|
||||
if (optional_outfile != NULL)
|
||||
if (optional_outfile)
|
||||
{
|
||||
const void *ptr = (const void*)(output + offset);
|
||||
|
||||
|
|
|
@ -450,7 +450,7 @@ static config_file_t *config_file_new_internal(
|
|||
|
||||
conf->tail = list;
|
||||
|
||||
if (cb != NULL && list->key != NULL && list->value != NULL)
|
||||
if (cb && list->key && list->value)
|
||||
cb->config_file_new_entry_cb(list->key, list->value) ;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ void dirent_vfs_init(const struct retro_vfs_interface_info* vfs_info)
|
|||
|
||||
struct RDIR *retro_opendir_include_hidden(const char *name, bool include_hidden)
|
||||
{
|
||||
if (dirent_opendir_cb != NULL)
|
||||
if (dirent_opendir_cb)
|
||||
return (struct RDIR *)dirent_opendir_cb(name, include_hidden);
|
||||
return (struct RDIR *)retro_vfs_opendir_impl(name, include_hidden);
|
||||
}
|
||||
|
@ -79,14 +79,14 @@ bool retro_dirent_error(struct RDIR *rdir)
|
|||
|
||||
int retro_readdir(struct RDIR *rdir)
|
||||
{
|
||||
if (dirent_readdir_cb != NULL)
|
||||
if (dirent_readdir_cb)
|
||||
return dirent_readdir_cb((struct retro_vfs_dir_handle *)rdir);
|
||||
return retro_vfs_readdir_impl((struct retro_vfs_dir_handle *)rdir);
|
||||
}
|
||||
|
||||
const char *retro_dirent_get_name(struct RDIR *rdir)
|
||||
{
|
||||
if (dirent_dirent_get_name_cb != NULL)
|
||||
if (dirent_dirent_get_name_cb)
|
||||
return dirent_dirent_get_name_cb((struct retro_vfs_dir_handle *)rdir);
|
||||
return retro_vfs_dirent_get_name_impl((struct retro_vfs_dir_handle *)rdir);
|
||||
}
|
||||
|
@ -104,14 +104,14 @@ const char *retro_dirent_get_name(struct RDIR *rdir)
|
|||
*/
|
||||
bool retro_dirent_is_dir(struct RDIR *rdir, const char *unused)
|
||||
{
|
||||
if (dirent_dirent_is_dir_cb != NULL)
|
||||
if (dirent_dirent_is_dir_cb)
|
||||
return dirent_dirent_is_dir_cb((struct retro_vfs_dir_handle *)rdir);
|
||||
return retro_vfs_dirent_is_dir_impl((struct retro_vfs_dir_handle *)rdir);
|
||||
}
|
||||
|
||||
void retro_closedir(struct RDIR *rdir)
|
||||
{
|
||||
if (dirent_closedir_cb != NULL)
|
||||
if (dirent_closedir_cb)
|
||||
dirent_closedir_cb((struct retro_vfs_dir_handle *)rdir);
|
||||
else
|
||||
retro_vfs_closedir_impl((struct retro_vfs_dir_handle *)rdir);
|
||||
|
|
|
@ -156,19 +156,15 @@ int cdfs_open_file(cdfs_file_t* file, cdfs_track_t* track, const char* path)
|
|||
file->track = track;
|
||||
|
||||
file->current_sector = -1;
|
||||
if (path != NULL)
|
||||
{
|
||||
if (path)
|
||||
file->first_sector = cdfs_find_file(file, path);
|
||||
}
|
||||
else if (file->track->stream_sector_size)
|
||||
{
|
||||
file->first_sector = 0;
|
||||
file->size = (intfstream_get_size(file->track->stream) / file->track->stream_sector_size) * 2048;
|
||||
}
|
||||
else
|
||||
{
|
||||
file->first_sector = -1;
|
||||
}
|
||||
|
||||
return (file->first_sector >= 0);
|
||||
}
|
||||
|
|
|
@ -1117,7 +1117,7 @@ enum retro_mod
|
|||
* This may be still be done regardless of the core options
|
||||
* interface version.
|
||||
*
|
||||
* If version is 1 however, core options may instead be set by
|
||||
* If version is >= 1 however, core options may instead be set by
|
||||
* passing an array of retro_core_option_definition structs to
|
||||
* RETRO_ENVIRONMENT_SET_CORE_OPTIONS, or a 2D array of
|
||||
* retro_core_option_definition structs to RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL.
|
||||
|
@ -1132,8 +1132,8 @@ enum retro_mod
|
|||
* GET_VARIABLE.
|
||||
* This allows the frontend to present these variables to
|
||||
* a user dynamically.
|
||||
* This should only be called if RETRO_ENVIRONMENT_GET_ENHANCED_CORE_OPTIONS
|
||||
* returns an API version of 1.
|
||||
* This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION
|
||||
* returns an API version of >= 1.
|
||||
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
|
||||
* This should be called the first time as early as
|
||||
* possible (ideally in retro_set_environment).
|
||||
|
@ -1169,8 +1169,6 @@ enum retro_mod
|
|||
* i.e. it should be feasible to cycle through options
|
||||
* without a keyboard.
|
||||
*
|
||||
* First entry should be treated as a default.
|
||||
*
|
||||
* Example entry:
|
||||
* {
|
||||
* "foo_option",
|
||||
|
@ -1196,8 +1194,8 @@ enum retro_mod
|
|||
* GET_VARIABLE.
|
||||
* This allows the frontend to present these variables to
|
||||
* a user dynamically.
|
||||
* This should only be called if RETRO_ENVIRONMENT_GET_ENHANCED_CORE_OPTIONS
|
||||
* returns an API version of 1.
|
||||
* This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION
|
||||
* returns an API version of >= 1.
|
||||
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
|
||||
* This should be called the first time as early as
|
||||
* possible (ideally in retro_set_environment).
|
||||
|
@ -1257,7 +1255,38 @@ enum retro_mod
|
|||
*
|
||||
* 'data' points to an unsigned variable
|
||||
*/
|
||||
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION 57
|
||||
/* unsigned * --
|
||||
* Unsigned value is the API version number of the disk control
|
||||
* interface supported by the frontend. If callback return false,
|
||||
* API version is assumed to be 0.
|
||||
*
|
||||
* In legacy code, the disk control interface is defined by passing
|
||||
* a struct of type retro_disk_control_callback to
|
||||
* RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE.
|
||||
* This may be still be done regardless of the disk control
|
||||
* interface version.
|
||||
*
|
||||
* If version is >= 1 however, the disk control interface may
|
||||
* instead be defined by passing a struct of type
|
||||
* retro_disk_control_ext_callback to
|
||||
* RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE.
|
||||
* This allows the core to provide additional information about
|
||||
* disk images to the frontend and/or enables extra
|
||||
* disk control functionality by the frontend.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE 58
|
||||
/* const struct retro_disk_control_ext_callback * --
|
||||
* Sets an interface which frontend can use to eject and insert
|
||||
* disk images, and also obtain information about individual
|
||||
* disk image files registered by the core.
|
||||
* This is used for games which consist of multiple images and
|
||||
* must be manually swapped out by the user (e.g. PSX, floppy disk
|
||||
* based systems).
|
||||
*/
|
||||
|
||||
/* VFS functionality */
|
||||
|
||||
/* File paths:
|
||||
|
@ -2307,7 +2336,8 @@ struct retro_keyboard_callback
|
|||
retro_keyboard_event_t callback;
|
||||
};
|
||||
|
||||
/* Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE.
|
||||
/* Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE &
|
||||
* RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE.
|
||||
* Should be set for implementations which can swap out multiple disk
|
||||
* images in runtime.
|
||||
*
|
||||
|
@ -2365,6 +2395,53 @@ typedef bool (RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index,
|
|||
* with replace_image_index. */
|
||||
typedef bool (RETRO_CALLCONV *retro_add_image_index_t)(void);
|
||||
|
||||
/* Sets initial image to insert in drive when calling
|
||||
* core_load_game().
|
||||
* Since we cannot pass the initial index when loading
|
||||
* content (this would require a major API change), this
|
||||
* is set by the frontend *before* calling the core's
|
||||
* retro_load_game()/retro_load_game_special() implementation.
|
||||
* A core should therefore cache the index/path values and handle
|
||||
* them inside retro_load_game()/retro_load_game_special().
|
||||
* - If 'index' is invalid (index >= get_num_images()), the
|
||||
* core should ignore the set value and instead use 0
|
||||
* - 'path' is used purely for error checking - i.e. when
|
||||
* content is loaded, the core should verify that the
|
||||
* disk specified by 'index' has the specified file path.
|
||||
* This is to guard against auto selecting the wrong image
|
||||
* if (for example) the user should modify an existing M3U
|
||||
* playlist. We have to let the core handle this because
|
||||
* set_initial_image() must be called before loading content,
|
||||
* i.e. the frontend cannot access image paths in advance
|
||||
* and thus cannot perform the error check itself.
|
||||
* If set path and content path do not match, the core should
|
||||
* ignore the set 'index' value and instead use 0
|
||||
* Returns 'false' if index or 'path' are invalid, or core
|
||||
* does not support this functionality
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_set_initial_image_t)(unsigned index, const char *path);
|
||||
|
||||
/* Fetches the path of the specified disk image file.
|
||||
* Returns 'false' if index is invalid (index >= get_num_images())
|
||||
* or path is otherwise unavailable.
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_get_image_path_t)(unsigned index, char *path, size_t len);
|
||||
|
||||
/* Fetches a core-provided 'label' for the specified disk
|
||||
* image file. In the simplest case this may be a file name
|
||||
* (without extension), but for cores with more complex
|
||||
* content requirements information may be provided to
|
||||
* facilitate user disk swapping - for example, a core
|
||||
* running floppy-disk-based content may uniquely label
|
||||
* save disks, data disks, level disks, etc. with names
|
||||
* corresponding to in-game disk change prompts (so the
|
||||
* frontend can provide better user guidance than a 'dumb'
|
||||
* disk index value).
|
||||
* Returns 'false' if index is invalid (index >= get_num_images())
|
||||
* or label is otherwise unavailable.
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_get_image_label_t)(unsigned index, char *label, size_t len);
|
||||
|
||||
struct retro_disk_control_callback
|
||||
{
|
||||
retro_set_eject_state_t set_eject_state;
|
||||
|
@ -2378,6 +2455,27 @@ struct retro_disk_control_callback
|
|||
retro_add_image_index_t add_image_index;
|
||||
};
|
||||
|
||||
struct retro_disk_control_ext_callback
|
||||
{
|
||||
retro_set_eject_state_t set_eject_state;
|
||||
retro_get_eject_state_t get_eject_state;
|
||||
|
||||
retro_get_image_index_t get_image_index;
|
||||
retro_set_image_index_t set_image_index;
|
||||
retro_get_num_images_t get_num_images;
|
||||
|
||||
retro_replace_image_index_t replace_image_index;
|
||||
retro_add_image_index_t add_image_index;
|
||||
|
||||
/* NOTE: Frontend will only attempt to record/restore
|
||||
* last used disk index if both set_initial_image()
|
||||
* and get_image_path() are implemented */
|
||||
retro_set_initial_image_t set_initial_image; /* Optional - may be NULL */
|
||||
|
||||
retro_get_image_path_t get_image_path; /* Optional - may be NULL */
|
||||
retro_get_image_label_t get_image_label; /* Optional - may be NULL */
|
||||
};
|
||||
|
||||
enum retro_pixel_format
|
||||
{
|
||||
/* 0RGB1555, native endian.
|
||||
|
@ -2522,8 +2620,20 @@ struct retro_core_option_display
|
|||
};
|
||||
|
||||
/* Maximum number of values permitted for a core option
|
||||
* NOTE: This may be increased on a core-by-core basis
|
||||
* if required (doing so has no effect on the frontend) */
|
||||
* > Note: We have to set a maximum value due the limitations
|
||||
* of the C language - i.e. it is not possible to create an
|
||||
* array of structs each containing a variable sized array,
|
||||
* so the retro_core_option_definition values array must
|
||||
* have a fixed size. The size limit of 128 is a balancing
|
||||
* act - it needs to be large enough to support all 'sane'
|
||||
* core options, but setting it too large may impact low memory
|
||||
* platforms. In practise, if a core option has more than
|
||||
* 128 values then the implementation is likely flawed.
|
||||
* To quote the above API reference:
|
||||
* "The number of possible options should be very limited
|
||||
* i.e. it should be feasible to cycle through options
|
||||
* without a keyboard."
|
||||
*/
|
||||
#define RETRO_NUM_CORE_OPTION_VALUES_MAX 128
|
||||
|
||||
struct retro_core_option_value
|
||||
|
|
|
@ -334,9 +334,11 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
|
|||
|
||||
if (!memcmp(buf + offset, "SEGADISCSYSTEM", strlen("SEGADISCSYSTEM")))
|
||||
{
|
||||
const char *title_pos;
|
||||
const char *serial_pos;
|
||||
bool title_found = false;
|
||||
const char *title_pos = NULL;
|
||||
const char *serial_pos = NULL;
|
||||
#if 0
|
||||
bool title_found = false;
|
||||
#endif
|
||||
|
||||
/* All discs currently in Redump for MCD start with SEGADISCSYSTEM. There are other strings mentioned elsewhere online,
|
||||
* but I have not seen any real examples of them. */
|
||||
|
@ -366,11 +368,13 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
|
|||
}
|
||||
else if (!memcmp(buf + offset, "SEGA SEGASATURN", strlen("SEGA SEGASATURN")))
|
||||
{
|
||||
const char *title_pos;
|
||||
const char *serial_pos;
|
||||
const char *version_pos;
|
||||
const char *release_date_pos;
|
||||
bool title_found = false;
|
||||
const char *title_pos = NULL;
|
||||
const char *serial_pos = NULL;
|
||||
const char *version_pos = NULL;
|
||||
const char *release_date_pos = NULL;
|
||||
#if 0
|
||||
bool title_found = false;
|
||||
#endif
|
||||
|
||||
info->system_id = MEDIA_CD_SYSTEM_SATURN;
|
||||
|
||||
|
@ -418,11 +422,13 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
|
|||
}
|
||||
else if (!memcmp(buf + offset, "SEGA SEGAKATANA", strlen("SEGA SEGAKATANA")))
|
||||
{
|
||||
const char *title_pos;
|
||||
const char *serial_pos;
|
||||
const char *version_pos;
|
||||
const char *release_date_pos;
|
||||
bool title_found = false;
|
||||
const char *title_pos = NULL;
|
||||
const char *serial_pos = NULL;
|
||||
const char *version_pos = NULL;
|
||||
const char *release_date_pos = NULL;
|
||||
#if 0
|
||||
bool title_found = false;
|
||||
#endif
|
||||
|
||||
info->system_id = MEDIA_CD_SYSTEM_DREAMCAST;
|
||||
|
||||
|
@ -472,7 +478,9 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
|
|||
else if (!memcmp(buf + offset + (16 * sector_size), "\1CD001\1\0PLAYSTATION", 19))
|
||||
{
|
||||
const char *title_pos = NULL;
|
||||
#if 0
|
||||
bool title_found = false;
|
||||
#endif
|
||||
|
||||
info->system_id = MEDIA_CD_SYSTEM_PSX;
|
||||
|
||||
|
|
142
net/net_http.c
142
net/net_http.c
|
@ -252,15 +252,6 @@ static void net_http_send_str(
|
|||
struct http_connection_t *net_http_connection_new(const char *url,
|
||||
const char *method, const char *data)
|
||||
{
|
||||
char new_domain[2048];
|
||||
bool error = false;
|
||||
char **domain = NULL;
|
||||
char *uri = NULL;
|
||||
char *url_dup = NULL;
|
||||
char *domain_port = NULL;
|
||||
char *domain_port2 = NULL;
|
||||
char *url_port = NULL;
|
||||
|
||||
struct http_connection_t *conn = (struct http_connection_t*)calloc(1,
|
||||
sizeof(*conn));
|
||||
|
||||
|
@ -273,14 +264,13 @@ struct http_connection_t *net_http_connection_new(const char *url,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
conn->urlcopy = strdup(url);
|
||||
|
||||
if (method)
|
||||
conn->methodcopy = strdup(method);
|
||||
|
||||
if (data)
|
||||
conn->postdatacopy = strdup(data);
|
||||
|
||||
conn->urlcopy = strdup(url);
|
||||
if (!conn->urlcopy)
|
||||
goto error;
|
||||
|
||||
|
@ -292,57 +282,12 @@ struct http_connection_t *net_http_connection_new(const char *url,
|
|||
conn->sock_state.ssl = true;
|
||||
}
|
||||
else
|
||||
error = true;
|
||||
goto error;
|
||||
|
||||
if (string_is_empty(conn->scan))
|
||||
goto error;
|
||||
|
||||
/* Get the port here from the url if it's specified.
|
||||
does not work on username password urls: user:pass@domain.com
|
||||
|
||||
This code is not supposed to be needed, since the port
|
||||
should be gotten elsewhere when the url is being scanned
|
||||
for ":", but for whatever reason, it's not working correctly.
|
||||
*/
|
||||
|
||||
uri = strchr(conn->scan, (char) '/');
|
||||
|
||||
if (strchr(conn->scan, (char) ':'))
|
||||
{
|
||||
size_t buf_pos;
|
||||
url_dup = strdup(conn->scan);
|
||||
domain_port = strtok(url_dup, ":");
|
||||
domain_port2 = strtok(NULL, ":");
|
||||
url_port = domain_port2;
|
||||
if (strchr(domain_port2, (char) '/'))
|
||||
url_port = strtok(domain_port2, "/");
|
||||
|
||||
if (url_port)
|
||||
conn->port = atoi(url_port);
|
||||
|
||||
buf_pos = strlcpy(new_domain, domain_port, sizeof(new_domain));
|
||||
free(url_dup);
|
||||
|
||||
if (uri)
|
||||
{
|
||||
if (!strchr(uri, (char) '/'))
|
||||
strlcat(new_domain, uri, sizeof(new_domain));
|
||||
else
|
||||
{
|
||||
new_domain[buf_pos] = '/';
|
||||
new_domain[buf_pos+1] = '\0';
|
||||
strlcat(new_domain, strchr(uri, (char)'/') + sizeof(char),
|
||||
sizeof(new_domain));
|
||||
}
|
||||
strlcpy(conn->scan, new_domain, strlen(conn->scan) + 1);
|
||||
}
|
||||
}
|
||||
/* end of port-fetching from url */
|
||||
if (error)
|
||||
goto error;
|
||||
|
||||
domain = &conn->domain;
|
||||
*domain = conn->scan;
|
||||
conn->domain = conn->scan;
|
||||
|
||||
return conn;
|
||||
|
||||
|
@ -373,39 +318,80 @@ bool net_http_connection_iterate(struct http_connection_t *conn)
|
|||
|
||||
bool net_http_connection_done(struct http_connection_t *conn)
|
||||
{
|
||||
char **location = NULL;
|
||||
int has_port = 0;
|
||||
|
||||
if (!conn)
|
||||
return false;
|
||||
|
||||
location = &conn->location;
|
||||
|
||||
if (*conn->scan == '\0')
|
||||
if (!conn->domain || !*conn->domain)
|
||||
return false;
|
||||
*conn->scan = '\0';
|
||||
|
||||
if (conn->port == 0)
|
||||
{
|
||||
if (conn->sock_state.ssl)
|
||||
conn->port = 443;
|
||||
else
|
||||
conn->port = 80;
|
||||
}
|
||||
|
||||
if (*conn->scan == ':')
|
||||
{
|
||||
if (!isdigit((int)conn->scan[1]))
|
||||
/* domain followed by port, split off the port */
|
||||
*conn->scan++ = '\0';
|
||||
|
||||
if (!isdigit((int)(*conn->scan)))
|
||||
return false;
|
||||
|
||||
conn->port = (int)strtoul(conn->scan + 1, &conn->scan, 10);
|
||||
|
||||
if (*conn->scan != '/')
|
||||
return false;
|
||||
conn->port = (int)strtoul(conn->scan, &conn->scan, 10);
|
||||
has_port = 1;
|
||||
}
|
||||
else if (conn->port == 0)
|
||||
{
|
||||
/* port not specified, default to standard HTTP or HTTPS port */
|
||||
if (conn->sock_state.ssl)
|
||||
conn->port = 443;
|
||||
else
|
||||
conn->port = 80;
|
||||
}
|
||||
|
||||
*location = conn->scan + 1;
|
||||
if (*conn->scan == '/')
|
||||
{
|
||||
/* domain followed by location - split off the location */
|
||||
/* site.com/path.html or site.com:80/path.html */
|
||||
*conn->scan = '\0';
|
||||
conn->location = conn->scan + 1;
|
||||
return true;
|
||||
}
|
||||
else if (!*conn->scan)
|
||||
{
|
||||
/* domain with no location - point location at empty string */
|
||||
/* site.com or site.com:80 */
|
||||
conn->location = conn->scan;
|
||||
return true;
|
||||
}
|
||||
else if (*conn->scan == '?')
|
||||
{
|
||||
/* domain with no location, but still has query parms - point location at the query parms */
|
||||
/* site.com?param=3 or site.com:80?param=3 */
|
||||
if (!has_port)
|
||||
{
|
||||
/* if there wasn't a port, we have to expand the urlcopy so we can separate the two parts */
|
||||
size_t domain_len = strlen(conn->domain);
|
||||
size_t location_len = strlen(conn->scan);
|
||||
char* urlcopy = (char*)malloc(domain_len + location_len + 2);
|
||||
memcpy(urlcopy, conn->domain, domain_len);
|
||||
urlcopy[domain_len] = '\0';
|
||||
memcpy(urlcopy + domain_len + 1, conn->scan, location_len + 1);
|
||||
|
||||
return true;
|
||||
free(conn->urlcopy);
|
||||
conn->domain = conn->urlcopy = urlcopy;
|
||||
conn->location = conn->scan = urlcopy + domain_len + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* there was a port, so overwriting the : will terminate the domain and we can just point at the ? */
|
||||
conn->location = conn->scan;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* invalid character after domain/port */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void net_http_connection_free(struct http_connection_t *conn)
|
||||
|
|
|
@ -135,7 +135,7 @@ static retro_task_t *task_queue_get(task_queue_t *queue)
|
|||
static void retro_task_internal_gather(void)
|
||||
{
|
||||
retro_task_t *task = NULL;
|
||||
while ((task = task_queue_get(&tasks_finished)) != NULL)
|
||||
while ((task = task_queue_get(&tasks_finished)))
|
||||
{
|
||||
task_queue_push_progress(task);
|
||||
|
||||
|
@ -172,7 +172,7 @@ static void retro_task_regular_gather(void)
|
|||
retro_task_t *queue = NULL;
|
||||
retro_task_t *next = NULL;
|
||||
|
||||
while ((task = task_queue_get(&tasks_running)) != NULL)
|
||||
while ((task = task_queue_get(&tasks_running)))
|
||||
{
|
||||
task->next = queue;
|
||||
queue = task;
|
||||
|
@ -387,7 +387,7 @@ static void retro_task_threaded_wait(retro_task_condition_fn_t cond, void* data)
|
|||
retro_task_threaded_gather();
|
||||
|
||||
slock_lock(running_lock);
|
||||
wait = (tasks_running.front != NULL) &&
|
||||
wait = (tasks_running.front) &&
|
||||
(!cond || cond(data));
|
||||
slock_unlock(running_lock);
|
||||
} while (wait);
|
||||
|
|
|
@ -101,8 +101,8 @@ static tpool_work_t *tpool_work_get(tpool_t *tp)
|
|||
|
||||
static void tpool_worker(void *arg)
|
||||
{
|
||||
tpool_t *tp = arg;
|
||||
tpool_work_t *work;
|
||||
tpool_work_t *work = NULL;
|
||||
tpool_t *tp = (tpool_t*)arg;
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
|
|
@ -119,7 +119,7 @@ int64_t filestream_get_size(RFILE *stream)
|
|||
{
|
||||
int64_t output;
|
||||
|
||||
if (filestream_size_cb != NULL)
|
||||
if (filestream_size_cb)
|
||||
output = filestream_size_cb(stream->hfile);
|
||||
else
|
||||
output = retro_vfs_file_size_impl((libretro_vfs_implementation_file*)stream->hfile);
|
||||
|
@ -134,7 +134,7 @@ int64_t filestream_truncate(RFILE *stream, int64_t length)
|
|||
{
|
||||
int64_t output;
|
||||
|
||||
if (filestream_truncate_cb != NULL)
|
||||
if (filestream_truncate_cb)
|
||||
output = filestream_truncate_cb(stream->hfile, length);
|
||||
else
|
||||
output = retro_vfs_file_truncate_impl((libretro_vfs_implementation_file*)stream->hfile, length);
|
||||
|
@ -159,7 +159,7 @@ RFILE* filestream_open(const char *path, unsigned mode, unsigned hints)
|
|||
struct retro_vfs_file_handle *fp = NULL;
|
||||
RFILE* output = NULL;
|
||||
|
||||
if (filestream_open_cb != NULL)
|
||||
if (filestream_open_cb)
|
||||
fp = (struct retro_vfs_file_handle*)
|
||||
filestream_open_cb(path, mode, hints);
|
||||
else
|
||||
|
@ -309,7 +309,7 @@ int64_t filestream_seek(RFILE *stream, int64_t offset, int seek_position)
|
|||
{
|
||||
int64_t output;
|
||||
|
||||
if (filestream_seek_cb != NULL)
|
||||
if (filestream_seek_cb)
|
||||
output = filestream_seek_cb(stream->hfile, offset, seek_position);
|
||||
else
|
||||
output = retro_vfs_file_seek_impl((libretro_vfs_implementation_file*)stream->hfile, offset, seek_position);
|
||||
|
@ -330,7 +330,7 @@ int64_t filestream_tell(RFILE *stream)
|
|||
{
|
||||
int64_t output;
|
||||
|
||||
if (filestream_size_cb != NULL)
|
||||
if (filestream_size_cb)
|
||||
output = filestream_tell_cb(stream->hfile);
|
||||
else
|
||||
output = retro_vfs_file_tell_impl((libretro_vfs_implementation_file*)stream->hfile);
|
||||
|
@ -354,7 +354,7 @@ int64_t filestream_read(RFILE *stream, void *s, int64_t len)
|
|||
{
|
||||
int64_t output;
|
||||
|
||||
if (filestream_read_cb != NULL)
|
||||
if (filestream_read_cb)
|
||||
output = filestream_read_cb(stream->hfile, s, len);
|
||||
else
|
||||
output = retro_vfs_file_read_impl(
|
||||
|
@ -372,7 +372,7 @@ int filestream_flush(RFILE *stream)
|
|||
{
|
||||
int output;
|
||||
|
||||
if (filestream_flush_cb != NULL)
|
||||
if (filestream_flush_cb)
|
||||
output = filestream_flush_cb(stream->hfile);
|
||||
else
|
||||
output = retro_vfs_file_flush_impl((libretro_vfs_implementation_file*)stream->hfile);
|
||||
|
@ -385,7 +385,7 @@ int filestream_flush(RFILE *stream)
|
|||
|
||||
int filestream_delete(const char *path)
|
||||
{
|
||||
if (filestream_remove_cb != NULL)
|
||||
if (filestream_remove_cb)
|
||||
return filestream_remove_cb(path);
|
||||
|
||||
return retro_vfs_file_remove_impl(path);
|
||||
|
@ -393,7 +393,7 @@ int filestream_delete(const char *path)
|
|||
|
||||
int filestream_rename(const char *old_path, const char *new_path)
|
||||
{
|
||||
if (filestream_rename_cb != NULL)
|
||||
if (filestream_rename_cb)
|
||||
return filestream_rename_cb(old_path, new_path);
|
||||
|
||||
return retro_vfs_file_rename_impl(old_path, new_path);
|
||||
|
@ -401,7 +401,7 @@ int filestream_rename(const char *old_path, const char *new_path)
|
|||
|
||||
const char* filestream_get_path(RFILE *stream)
|
||||
{
|
||||
if (filestream_get_path_cb != NULL)
|
||||
if (filestream_get_path_cb)
|
||||
return filestream_get_path_cb(stream->hfile);
|
||||
|
||||
return retro_vfs_file_get_path_impl((libretro_vfs_implementation_file*)stream->hfile);
|
||||
|
@ -411,7 +411,7 @@ int64_t filestream_write(RFILE *stream, const void *s, int64_t len)
|
|||
{
|
||||
int64_t output;
|
||||
|
||||
if (filestream_write_cb != NULL)
|
||||
if (filestream_write_cb)
|
||||
output = filestream_write_cb(stream->hfile, s, len);
|
||||
else
|
||||
output = retro_vfs_file_write_impl((libretro_vfs_implementation_file*)stream->hfile, s, len);
|
||||
|
@ -465,7 +465,7 @@ int filestream_close(RFILE *stream)
|
|||
int output;
|
||||
struct retro_vfs_file_handle* fp = stream->hfile;
|
||||
|
||||
if (filestream_close_cb != NULL)
|
||||
if (filestream_close_cb)
|
||||
output = filestream_close_cb(fp);
|
||||
else
|
||||
output = retro_vfs_file_close_impl((libretro_vfs_implementation_file*)fp);
|
||||
|
|
|
@ -328,7 +328,7 @@ void string_replace_all_chars(char *str, char find, char replace)
|
|||
if (string_is_empty(str))
|
||||
return;
|
||||
|
||||
while((str_ptr = strchr(str_ptr, find)) != NULL)
|
||||
while ((str_ptr = strchr(str_ptr, find)))
|
||||
*str_ptr++ = replace;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue