update libretro-common. lots of noisy EOL changes because originally I screwed up and changed them.

This commit is contained in:
zeromus 2016-03-21 02:12:11 +00:00
parent 655dd15cc1
commit 7f0c1276d4
140 changed files with 32163 additions and 31144 deletions

View File

@ -0,0 +1,661 @@
/*
Copyright (c) 2013, Kenneth MacKay
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <compat/ifaddrs.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <errno.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netpacket/packet.h>
#include <net/if_arp.h>
#include <netinet/in.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
typedef struct NetlinkList
{
struct NetlinkList *m_next;
struct nlmsghdr *m_data;
unsigned int m_size;
} NetlinkList;
static int netlink_socket(void)
{
int l_socket = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if(l_socket < 0)
{
return -1;
}
struct sockaddr_nl l_addr;
memset(&l_addr, 0, sizeof(l_addr));
l_addr.nl_family = AF_NETLINK;
if(bind(l_socket, (struct sockaddr *)&l_addr, sizeof(l_addr)) < 0)
{
close(l_socket);
return -1;
}
return l_socket;
}
static int netlink_send(int p_socket, int p_request)
{
struct
{
struct nlmsghdr m_hdr;
struct rtgenmsg m_msg;
} l_data;
memset(&l_data, 0, sizeof(l_data));
l_data.m_hdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg));
l_data.m_hdr.nlmsg_type = p_request;
l_data.m_hdr.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
l_data.m_hdr.nlmsg_pid = 0;
l_data.m_hdr.nlmsg_seq = p_socket;
l_data.m_msg.rtgen_family = AF_UNSPEC;
struct sockaddr_nl l_addr;
memset(&l_addr, 0, sizeof(l_addr));
l_addr.nl_family = AF_NETLINK;
return (sendto(p_socket, &l_data.m_hdr, l_data.m_hdr.nlmsg_len, 0, (struct sockaddr *)&l_addr, sizeof(l_addr)));
}
static int netlink_recv(int p_socket, void *p_buffer, size_t p_len)
{
struct msghdr l_msg;
struct iovec l_iov = { p_buffer, p_len };
struct sockaddr_nl l_addr;
for(;;)
{
l_msg.msg_name = (void *)&l_addr;
l_msg.msg_namelen = sizeof(l_addr);
l_msg.msg_iov = &l_iov;
l_msg.msg_iovlen = 1;
l_msg.msg_control = NULL;
l_msg.msg_controllen = 0;
l_msg.msg_flags = 0;
int l_result = recvmsg(p_socket, &l_msg, 0);
if(l_result < 0)
{
if(errno == EINTR)
{
continue;
}
return -2;
}
if(l_msg.msg_flags & MSG_TRUNC)
{ // buffer was too small
return -1;
}
return l_result;
}
}
static struct nlmsghdr *getNetlinkResponse(int p_socket, int *p_size, int *p_done)
{
size_t l_size = 4096;
void *l_buffer = NULL;
for(;;)
{
free(l_buffer);
l_buffer = malloc(l_size);
if (l_buffer == NULL)
{
return NULL;
}
int l_read = netlink_recv(p_socket, l_buffer, l_size);
*p_size = l_read;
if(l_read == -2)
{
free(l_buffer);
return NULL;
}
if(l_read >= 0)
{
pid_t l_pid = getpid();
struct nlmsghdr *l_hdr;
for(l_hdr = (struct nlmsghdr *)l_buffer; NLMSG_OK(l_hdr, (unsigned int)l_read); l_hdr = (struct nlmsghdr *)NLMSG_NEXT(l_hdr, l_read))
{
if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket)
{
continue;
}
if(l_hdr->nlmsg_type == NLMSG_DONE)
{
*p_done = 1;
break;
}
if(l_hdr->nlmsg_type == NLMSG_ERROR)
{
free(l_buffer);
return NULL;
}
}
return l_buffer;
}
l_size *= 2;
}
}
static NetlinkList *newListItem(struct nlmsghdr *p_data, unsigned int p_size)
{
NetlinkList *l_item = malloc(sizeof(NetlinkList));
if (l_item == NULL)
{
return NULL;
}
l_item->m_next = NULL;
l_item->m_data = p_data;
l_item->m_size = p_size;
return l_item;
}
static void freeResultList(NetlinkList *p_list)
{
NetlinkList *l_cur;
while(p_list)
{
l_cur = p_list;
p_list = p_list->m_next;
free(l_cur->m_data);
free(l_cur);
}
}
static NetlinkList *getResultList(int p_socket, int p_request)
{
if(netlink_send(p_socket, p_request) < 0)
{
return NULL;
}
NetlinkList *l_list = NULL;
NetlinkList *l_end = NULL;
int l_size;
int l_done = 0;
while(!l_done)
{
struct nlmsghdr *l_hdr = getNetlinkResponse(p_socket, &l_size, &l_done);
if(!l_hdr)
{ // error
freeResultList(l_list);
return NULL;
}
NetlinkList *l_item = newListItem(l_hdr, l_size);
if (!l_item)
{
freeResultList(l_list);
return NULL;
}
if(!l_list)
{
l_list = l_item;
}
else
{
l_end->m_next = l_item;
}
l_end = l_item;
}
return l_list;
}
static size_t maxSize(size_t a, size_t b)
{
return (a > b ? a : b);
}
static size_t calcAddrLen(sa_family_t p_family, int p_dataSize)
{
switch(p_family)
{
case AF_INET:
return sizeof(struct sockaddr_in);
case AF_INET6:
return sizeof(struct sockaddr_in6);
case AF_PACKET:
return maxSize(sizeof(struct sockaddr_ll), offsetof(struct sockaddr_ll, sll_addr) + p_dataSize);
default:
return maxSize(sizeof(struct sockaddr), offsetof(struct sockaddr, sa_data) + p_dataSize);
}
}
static void makeSockaddr(sa_family_t p_family, struct sockaddr *p_dest, void *p_data, size_t p_size)
{
switch(p_family)
{
case AF_INET:
memcpy(&((struct sockaddr_in*)p_dest)->sin_addr, p_data, p_size);
break;
case AF_INET6:
memcpy(&((struct sockaddr_in6*)p_dest)->sin6_addr, p_data, p_size);
break;
case AF_PACKET:
memcpy(((struct sockaddr_ll*)p_dest)->sll_addr, p_data, p_size);
((struct sockaddr_ll*)p_dest)->sll_halen = p_size;
break;
default:
memcpy(p_dest->sa_data, p_data, p_size);
break;
}
p_dest->sa_family = p_family;
}
static void addToEnd(struct ifaddrs **p_resultList, struct ifaddrs *p_entry)
{
if(!*p_resultList)
{
*p_resultList = p_entry;
}
else
{
struct ifaddrs *l_cur = *p_resultList;
while(l_cur->ifa_next)
{
l_cur = l_cur->ifa_next;
}
l_cur->ifa_next = p_entry;
}
}
static int interpretLink(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList)
{
struct ifinfomsg *l_info = (struct ifinfomsg *)NLMSG_DATA(p_hdr);
size_t l_nameSize = 0;
size_t l_addrSize = 0;
size_t l_dataSize = 0;
size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg));
struct rtattr *l_rta;
for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize))
{
size_t l_rtaDataSize = RTA_PAYLOAD(l_rta);
switch(l_rta->rta_type)
{
case IFLA_ADDRESS:
case IFLA_BROADCAST:
l_addrSize += NLMSG_ALIGN(calcAddrLen(AF_PACKET, l_rtaDataSize));
break;
case IFLA_IFNAME:
l_nameSize += NLMSG_ALIGN(l_rtaSize + 1);
break;
case IFLA_STATS:
l_dataSize += NLMSG_ALIGN(l_rtaSize);
break;
default:
break;
}
}
struct ifaddrs *l_entry = malloc(sizeof(struct ifaddrs) + sizeof(int) + l_nameSize + l_addrSize + l_dataSize);
if (l_entry == NULL)
{
return -1;
}
memset(l_entry, 0, sizeof(struct ifaddrs));
l_entry->ifa_name = "";
char *l_index = ((char *)l_entry) + sizeof(struct ifaddrs);
char *l_name = l_index + sizeof(int);
char *l_addr = l_name + l_nameSize;
char *l_data = l_addr + l_addrSize;
// save the interface index so we can look it up when handling the addresses.
memcpy(l_index, &l_info->ifi_index, sizeof(int));
l_entry->ifa_flags = l_info->ifi_flags;
l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg));
for(l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize))
{
void *l_rtaData = RTA_DATA(l_rta);
size_t l_rtaDataSize = RTA_PAYLOAD(l_rta);
switch(l_rta->rta_type)
{
case IFLA_ADDRESS:
case IFLA_BROADCAST:
{
size_t l_addrLen = calcAddrLen(AF_PACKET, l_rtaDataSize);
makeSockaddr(AF_PACKET, (struct sockaddr *)l_addr, l_rtaData, l_rtaDataSize);
((struct sockaddr_ll *)l_addr)->sll_ifindex = l_info->ifi_index;
((struct sockaddr_ll *)l_addr)->sll_hatype = l_info->ifi_type;
if(l_rta->rta_type == IFLA_ADDRESS)
{
l_entry->ifa_addr = (struct sockaddr *)l_addr;
}
else
{
l_entry->ifa_broadaddr = (struct sockaddr *)l_addr;
}
l_addr += NLMSG_ALIGN(l_addrLen);
break;
}
case IFLA_IFNAME:
strncpy(l_name, l_rtaData, l_rtaDataSize);
l_name[l_rtaDataSize] = '\0';
l_entry->ifa_name = l_name;
break;
case IFLA_STATS:
memcpy(l_data, l_rtaData, l_rtaDataSize);
l_entry->ifa_data = l_data;
break;
default:
break;
}
}
addToEnd(p_resultList, l_entry);
return 0;
}
static struct ifaddrs *findInterface(int p_index, struct ifaddrs **p_links, int p_numLinks)
{
int l_num = 0;
struct ifaddrs *l_cur = *p_links;
while(l_cur && l_num < p_numLinks)
{
char *l_indexPtr = ((char *)l_cur) + sizeof(struct ifaddrs);
int l_index;
memcpy(&l_index, l_indexPtr, sizeof(int));
if(l_index == p_index)
{
return l_cur;
}
l_cur = l_cur->ifa_next;
++l_num;
}
return NULL;
}
static int interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList, int p_numLinks)
{
struct ifaddrmsg *l_info = (struct ifaddrmsg *)NLMSG_DATA(p_hdr);
struct ifaddrs *l_interface = findInterface(l_info->ifa_index, p_resultList, p_numLinks);
if(l_info->ifa_family == AF_PACKET)
{
return 0;
}
size_t l_nameSize = 0;
size_t l_addrSize = 0;
int l_addedNetmask = 0;
size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg));
struct rtattr *l_rta;
for(l_rta = IFA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize))
{
size_t l_rtaDataSize = RTA_PAYLOAD(l_rta);
switch(l_rta->rta_type)
{
case IFA_ADDRESS:
case IFA_LOCAL:
if((l_info->ifa_family == AF_INET || l_info->ifa_family == AF_INET6) && !l_addedNetmask)
{ // make room for netmask
l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize));
l_addedNetmask = 1;
}
case IFA_BROADCAST:
l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize));
break;
case IFA_LABEL:
l_nameSize += NLMSG_ALIGN(l_rtaSize + 1);
break;
default:
break;
}
}
struct ifaddrs *l_entry = malloc(sizeof(struct ifaddrs) + l_nameSize + l_addrSize);
if (l_entry == NULL)
{
return -1;
}
memset(l_entry, 0, sizeof(struct ifaddrs));
l_entry->ifa_name = (l_interface ? l_interface->ifa_name : "");
char *l_name = ((char *)l_entry) + sizeof(struct ifaddrs);
char *l_addr = l_name + l_nameSize;
l_entry->ifa_flags = l_info->ifa_flags;
if(l_interface)
{
l_entry->ifa_flags |= l_interface->ifa_flags;
}
l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg));
for(l_rta = IFA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize))
{
void *l_rtaData = RTA_DATA(l_rta);
size_t l_rtaDataSize = RTA_PAYLOAD(l_rta);
switch(l_rta->rta_type)
{
case IFA_ADDRESS:
case IFA_BROADCAST:
case IFA_LOCAL:
{
size_t l_addrLen = calcAddrLen(l_info->ifa_family, l_rtaDataSize);
makeSockaddr(l_info->ifa_family, (struct sockaddr *)l_addr, l_rtaData, l_rtaDataSize);
if(l_info->ifa_family == AF_INET6)
{
if(IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)l_rtaData) || IN6_IS_ADDR_MC_LINKLOCAL((struct in6_addr *)l_rtaData))
{
((struct sockaddr_in6 *)l_addr)->sin6_scope_id = l_info->ifa_index;
}
}
if(l_rta->rta_type == IFA_ADDRESS)
{ // apparently in a point-to-point network IFA_ADDRESS contains the dest address and IFA_LOCAL contains the local address
if(l_entry->ifa_addr)
{
l_entry->ifa_dstaddr = (struct sockaddr *)l_addr;
}
else
{
l_entry->ifa_addr = (struct sockaddr *)l_addr;
}
}
else if(l_rta->rta_type == IFA_LOCAL)
{
if(l_entry->ifa_addr)
{
l_entry->ifa_dstaddr = l_entry->ifa_addr;
}
l_entry->ifa_addr = (struct sockaddr *)l_addr;
}
else
{
l_entry->ifa_broadaddr = (struct sockaddr *)l_addr;
}
l_addr += NLMSG_ALIGN(l_addrLen);
break;
}
case IFA_LABEL:
strncpy(l_name, l_rtaData, l_rtaDataSize);
l_name[l_rtaDataSize] = '\0';
l_entry->ifa_name = l_name;
break;
default:
break;
}
}
if(l_entry->ifa_addr && (l_entry->ifa_addr->sa_family == AF_INET || l_entry->ifa_addr->sa_family == AF_INET6))
{
unsigned l_maxPrefix = (l_entry->ifa_addr->sa_family == AF_INET ? 32 : 128);
unsigned l_prefix = (l_info->ifa_prefixlen > l_maxPrefix ? l_maxPrefix : l_info->ifa_prefixlen);
char l_mask[16] = {0};
unsigned i;
for(i=0; i<(l_prefix/8); ++i)
{
l_mask[i] = 0xff;
}
if(l_prefix % 8)
{
l_mask[i] = 0xff << (8 - (l_prefix % 8));
}
makeSockaddr(l_entry->ifa_addr->sa_family, (struct sockaddr *)l_addr, l_mask, l_maxPrefix / 8);
l_entry->ifa_netmask = (struct sockaddr *)l_addr;
}
addToEnd(p_resultList, l_entry);
return 0;
}
static int interpretLinks(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs **p_resultList)
{
int l_numLinks = 0;
pid_t l_pid = getpid();
for(; p_netlinkList; p_netlinkList = p_netlinkList->m_next)
{
unsigned int l_nlsize = p_netlinkList->m_size;
struct nlmsghdr *l_hdr;
for(l_hdr = p_netlinkList->m_data; NLMSG_OK(l_hdr, l_nlsize); l_hdr = NLMSG_NEXT(l_hdr, l_nlsize))
{
if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket)
{
continue;
}
if(l_hdr->nlmsg_type == NLMSG_DONE)
{
break;
}
if(l_hdr->nlmsg_type == RTM_NEWLINK)
{
if(interpretLink(l_hdr, p_resultList) == -1)
{
return -1;
}
++l_numLinks;
}
}
}
return l_numLinks;
}
static int interpretAddrs(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs **p_resultList, int p_numLinks)
{
pid_t l_pid = getpid();
for(; p_netlinkList; p_netlinkList = p_netlinkList->m_next)
{
unsigned int l_nlsize = p_netlinkList->m_size;
struct nlmsghdr *l_hdr;
for(l_hdr = p_netlinkList->m_data; NLMSG_OK(l_hdr, l_nlsize); l_hdr = NLMSG_NEXT(l_hdr, l_nlsize))
{
if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket)
{
continue;
}
if(l_hdr->nlmsg_type == NLMSG_DONE)
{
break;
}
if(l_hdr->nlmsg_type == RTM_NEWADDR)
{
if (interpretAddr(l_hdr, p_resultList, p_numLinks) == -1)
{
return -1;
}
}
}
}
return 0;
}
int getifaddrs(struct ifaddrs **ifap)
{
if(!ifap)
{
return -1;
}
*ifap = NULL;
int l_socket = netlink_socket();
if(l_socket < 0)
{
return -1;
}
NetlinkList *l_linkResults = getResultList(l_socket, RTM_GETLINK);
if(!l_linkResults)
{
close(l_socket);
return -1;
}
NetlinkList *l_addrResults = getResultList(l_socket, RTM_GETADDR);
if(!l_addrResults)
{
close(l_socket);
freeResultList(l_linkResults);
return -1;
}
int l_result = 0;
int l_numLinks = interpretLinks(l_socket, l_linkResults, ifap);
if(l_numLinks == -1 || interpretAddrs(l_socket, l_addrResults, ifap, l_numLinks) == -1)
{
l_result = -1;
}
freeResultList(l_linkResults);
freeResultList(l_addrResults);
close(l_socket);
return l_result;
}
void freeifaddrs(struct ifaddrs *ifa)
{
struct ifaddrs *l_cur;
while(ifa)
{
l_cur = ifa;
ifa = ifa->ifa_next;
free(l_cur);
}
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (dylib.c). * The following license statement only applies to this file (dylib.c).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (encodings_utf.c). * The following license statement only applies to this file (encodings_utf.c).

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (file_archive.c). * The following license statement only applies to this file (archive_file.c).
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* *
* Permission is hereby granted, free of charge, * Permission is hereby granted, free of charge,
@ -39,12 +39,12 @@
#endif #endif
#include <compat/strl.h> #include <compat/strl.h>
#include <file/file_archive.h> #include <file/archive_file.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <retro_file.h> #include <streams/file_stream.h>
#include <retro_stat.h> #include <retro_stat.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <string/string_list.h> #include <lists/string_list.h>
#ifndef CENTRAL_FILE_HEADER_SIGNATURE #ifndef CENTRAL_FILE_HEADER_SIGNATURE
#define CENTRAL_FILE_HEADER_SIGNATURE 0x02014b50 #define CENTRAL_FILE_HEADER_SIGNATURE 0x02014b50
@ -578,12 +578,10 @@ bool file_archive_extract_first_content_file(
bool ret = true; bool ret = true;
struct zip_extract_userdata userdata = {0}; struct zip_extract_userdata userdata = {0};
/* We cannot unzip if the libretro
* implementation does not have any valid extensions. */
if (!valid_exts) if (!valid_exts)
{
/* Libretro implementation does not have any valid extensions.
* Cannot unzip without knowing this. */
return false; return false;
}
list = string_split(valid_exts, "|"); list = string_split(valid_exts, "|");
if (!list) if (!list)
@ -672,7 +670,8 @@ bool file_archive_perform_mode(const char *path, const char *valid_exts,
return false; return false;
do{ do{
ret = handle.backend->stream_decompress_data_to_file_iterate(handle.stream); ret = handle.backend->stream_decompress_data_to_file_iterate(
handle.stream);
}while(ret == 0); }while(ret == 0);
if (!file_archive_decompress_data_to_file(&handle, if (!file_archive_decompress_data_to_file(&handle,

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (file_archive_zlib.c). * The following license statement only applies to this file (archive_file_zlib.c).
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* *
* Permission is hereby granted, free of charge, * Permission is hereby granted, free of charge,
@ -23,8 +23,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <compat/zlib.h> #include <compat/zlib.h>
#include <file/file_archive.h> #include <file/archive_file.h>
#include <retro_file.h> #include <streams/file_stream.h>
static void *zlib_stream_new(void) static void *zlib_stream_new(void)
{ {

View File

@ -42,7 +42,7 @@
#include <file/config_file.h> #include <file/config_file.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <retro_stat.h> #include <retro_stat.h>
#include <string/string_list.h> #include <lists/string_list.h>
#include <rhash.h> #include <rhash.h>
#define MAX_INCLUDE_DEPTH 16 #define MAX_INCLUDE_DEPTH 16

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (config_file_userdata.c). * The following license statement only applies to this file (config_file_userdata.c).
@ -22,7 +22,7 @@
#include <file/config_file_userdata.h> #include <file/config_file_userdata.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <string/string_list.h> #include <lists/string_list.h>
#define get_array_setup() \ #define get_array_setup() \
char key[2][256]; \ char key[2][256]; \

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (file_path.c). * The following license statement only applies to this file (file_path.c).
@ -20,17 +20,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <boolean.h> #include <boolean.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#ifdef __HAIKU__
#include <kernel/image.h>
#endif
#include <sys/stat.h> #include <sys/stat.h>
#include <file/file_path.h> #include <file/file_path.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_dirent.c). * The following license statement only applies to this file (retro_dirent.c).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_stat.c). * The following license statement only applies to this file (retro_stat.c).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rbmp_encode.c). * The following license statement only applies to this file (rbmp_encode.c).
@ -23,7 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <retro_file.h> #include <streams/file_stream.h>
#include <formats/rbmp.h> #include <formats/rbmp.h>
static bool write_header_bmp(RFILE *file, unsigned width, unsigned height, bool is32bpp) static bool write_header_bmp(RFILE *file, unsigned width, unsigned height, bool is32bpp)
@ -138,11 +138,11 @@ static void dump_line_32_to_24(uint8_t *line, const uint32_t *src, unsigned widt
} }
static void dump_content(RFILE *file, const void *frame, static void dump_content(RFILE *file, const void *frame,
int width, int height, int pitch, rbmp_source_type type) int width, int height, int pitch, enum rbmp_source_type type)
{ {
uint8_t *line; uint8_t *line;
size_t line_size; size_t line_size;
int i, j; int j;
int bytes_per_pixel = (type==RBMP_SOURCE_TYPE_ARGB8888?4:3); int bytes_per_pixel = (type==RBMP_SOURCE_TYPE_ARGB8888?4:3);
union union
{ {
@ -202,7 +202,7 @@ static void dump_content(RFILE *file, const void *frame,
bool rbmp_save_image(const char *filename, const void *frame, bool rbmp_save_image(const char *filename, const void *frame,
unsigned width, unsigned height, unsigned width, unsigned height,
unsigned pitch, rbmp_source_type type) unsigned pitch, enum rbmp_source_type type)
{ {
bool ret; bool ret;
RFILE *file = retro_fopen(filename, RFILE_MODE_WRITE, -1); RFILE *file = retro_fopen(filename, RFILE_MODE_WRITE, -1);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (jsonsax.c). * The following license statement only applies to this file (jsonsax.c).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rpng.c). * The following license statement only applies to this file (rpng.c).
@ -32,7 +32,7 @@
#include <boolean.h> #include <boolean.h>
#include <file/nbio.h> #include <file/nbio.h>
#include <formats/rpng.h> #include <formats/rpng.h>
#include <file/file_archive.h> #include <file/archive_file.h>
#include "rpng_internal.h" #include "rpng_internal.h"

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rpng.c). * The following license statement only applies to this file (rpng_encode.c).
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* *
* Permission is hereby granted, free of charge, * Permission is hereby granted, free of charge,
@ -24,7 +24,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <retro_file.h> #include <streams/file_stream.h>
#include "rpng_internal.h" #include "rpng_internal.h"

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rpng.c). * The following license statement only applies to this file (rpng_internal.h).
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* *
* Permission is hereby granted, free of charge, * Permission is hereby granted, free of charge,

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rpng_test.c). * The following license statement only applies to this file (rpng_test.c).

View File

@ -1,23 +1,30 @@
/* RetroArch - A frontend for libretro. /* Copyright (C) 2010-2016 The RetroArch team
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
* *
* RetroArch is free software: you can redistribute it and/or modify it under the terms * ---------------------------------------------------------------------------------------
* of the GNU General Public License as published by the Free Software Found- * The following license statement only applies to this file (rtga.c).
* ation, either version 3 of the License, or (at your option) any later version. * ---------------------------------------------------------------------------------------
* *
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * Permission is hereby granted, free of charge,
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * to any person obtaining a copy of this software and associated documentation files (the "Software"),
* PURPOSE. See the GNU General Public License for more details. * to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* *
* You should have received a copy of the GNU General Public License along with RetroArch. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* If not, see <http://www.gnu.org/licenses/>. *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <formats/tga.h> #include <formats/tga.h>
#include <formats/image.h> #include <formats/image.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rxml.c). * The following license statement only applies to this file (rxml.c).
@ -29,7 +29,7 @@
#include <ctype.h> #include <ctype.h>
#include <boolean.h> #include <boolean.h>
#include <retro_file.h> #include <streams/file_stream.h>
#include <compat/posix_string.h> #include <compat/posix_string.h>
#include <formats/rxml.h> #include <formats/rxml.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rxml_test.c). * The following license statement only applies to this file (rxml_test.c).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (matrix_3x3.c). * The following license statement only applies to this file (matrix_3x3.c).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (matrix.c). * The following license statement only applies to this file (matrix.c).

View File

@ -30,7 +30,7 @@
#include <rhash.h> #include <rhash.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <retro_endianness.h> #include <retro_endianness.h>
#include <retro_file.h> #include <streams/file_stream.h>
#define LSL32(x, n) ((uint32_t)(x) << (n)) #define LSL32(x, n) ((uint32_t)(x) << (n))
#define LSR32(x, n) ((uint32_t)(x) >> (n)) #define LSR32(x, n) ((uint32_t)(x) >> (n))

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (boolean.h). * The following license statement only applies to this file (boolean.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (boolean.h). * The following license statement only applies to this file (boolean.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (apple_compat.h). * The following license statement only applies to this file (apple_compat.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (compat_fnmatch.h). * The following license statement only applies to this file (compat_fnmatch.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (compat_getopt.h). * The following license statement only applies to this file (compat_getopt.h).

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 1995, 1999
* Berkeley Software Design, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp
*/
#ifndef _IFADDRS_H_
#define _IFADDRS_H_
struct ifaddrs
{
struct ifaddrs *ifa_next;
char *ifa_name;
unsigned int ifa_flags;
struct sockaddr *ifa_addr;
struct sockaddr *ifa_netmask;
struct sockaddr *ifa_dstaddr;
void *ifa_data;
};
/*
* This may have been defined in <net/if.h>. Note that if <net/if.h> is
* to be included it must be included before this header file.
*/
#ifndef ifa_broadaddr
#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */
#endif
#include <sys/cdefs.h>
extern int getifaddrs(struct ifaddrs **ifap);
extern void freeifaddrs(struct ifaddrs *ifa);
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (msvc_compat.h). * The following license statement only applies to this file (msvc_compat.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (posix_string.h). * The following license statement only applies to this file (posix_string.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (strcasestr.h). * --------------------------------------------------------------------------------------- * The following license statement only applies to this file (strcasestr.h). * ---------------------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (strl.h). * The following license statement only applies to this file (strl.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (dylib.h). * The following license statement only applies to this file (dylib.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (utf.h). * The following license statement only applies to this file (utf.h).

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (file_archive.h). * The following license statement only applies to this file (archive_file.h).
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* *
* Permission is hereby granted, free of charge, * Permission is hereby granted, free of charge,
@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef FILE_ARCHIVE_H__ #ifndef LIBRETRO_SDK_ARCHIVE_FILE_H__
#define FILE_ARCHIVE_H__ #define LIBRETRO_SDK_ARCHIVE_FILE_H__
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>

View File

@ -29,17 +29,22 @@
extern "C" { extern "C" {
#endif #endif
typedef enum enum rbmp_source_type
{ {
RBMP_SOURCE_TYPE_DONT_CARE,
RBMP_SOURCE_TYPE_BGR24, RBMP_SOURCE_TYPE_BGR24,
RBMP_SOURCE_TYPE_XRGB888, RBMP_SOURCE_TYPE_XRGB888,
RBMP_SOURCE_TYPE_RGB565, RBMP_SOURCE_TYPE_RGB565,
RBMP_SOURCE_TYPE_ARGB8888, RBMP_SOURCE_TYPE_ARGB8888
} rbmp_source_type; };
bool rbmp_save_image(const char *filename, const void *frame, bool rbmp_save_image(
unsigned width, unsigned height, const char *filename,
unsigned pitch, rbmp_source_type type); const void *frame,
unsigned width,
unsigned height,
unsigned pitch,
enum rbmp_source_type type);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -27,7 +27,7 @@
#include <stddef.h> #include <stddef.h>
#include <boolean.h> #include <boolean.h>
#include <file/file_archive.h> #include <file/archive_file.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rpng.h). * The following license statement only applies to this file (rtga.h).
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* *
* Permission is hereby granted, free of charge, * Permission is hereby granted, free of charge,

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (matrix_3x3.h). * The following license statement only applies to this file (matrix_3x3.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (matrix.h). * The following license statement only applies to this file (matrix.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (filter.h). * The following license statement only applies to this file (filter.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (pixconv.h). * The following license statement only applies to this file (pixconv.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (scaler.h). * The following license statement only applies to this file (scaler.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (scaler_int.h). * The following license statement only applies to this file (scaler_int.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (libco.h). * The following license statement only applies to this file (libco.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (dir_list.h). * The following license statement only applies to this file (dir_list.h).
@ -23,7 +23,7 @@
#ifndef __LIBRETRO_SDK_DIR_LIST_H #ifndef __LIBRETRO_SDK_DIR_LIST_H
#define __LIBRETRO_SDK_DIR_LIST_H #define __LIBRETRO_SDK_DIR_LIST_H
#include <string/string_list.h> #include <lists/string_list.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (file_list.h). * The following license statement only applies to this file (file_list.h).
@ -61,7 +61,7 @@ void *file_list_get_actiondata_at_offset(const file_list_t *list,
void file_list_free(file_list_t *list); void file_list_free(file_list_t *list);
void file_list_push(file_list_t *userdata, const char *path, bool file_list_push(file_list_t *userdata, const char *path,
const char *label, unsigned type, size_t current_directory_ptr, const char *label, unsigned type, size_t current_directory_ptr,
size_t entry_index); size_t entry_index);
@ -79,8 +79,6 @@ void *file_list_get_last_actiondata(const file_list_t *list);
size_t file_list_get_size(const file_list_t *list); size_t file_list_get_size(const file_list_t *list);
size_t file_list_get_entry_index(const file_list_t *list);
size_t file_list_get_directory_ptr(const file_list_t *list); size_t file_list_get_directory_ptr(const file_list_t *list);
void file_list_get_at_offset(const file_list_t *list, size_t index, void file_list_get_at_offset(const file_list_t *list, size_t index,

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (string_list.h). * The following license statement only applies to this file (string_list.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (memalign.h). * The following license statement only applies to this file (memalign.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (memmap.h). * The following license statement only applies to this file (memmap.h).

View File

@ -1,21 +1,27 @@
/* RetroArch - A frontend for libretro. /* Copyright (C) 2010-2016 The RetroArch team
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
* *
* RetroArch is free software: you can redistribute it and/or modify it under the terms * ---------------------------------------------------------------------------------------
* of the GNU General Public License as published by the Free Software Found- * The following license statement only applies to this file (net_compat.h).
* ation, either version 3 of the License, or (at your option) any later version. * ---------------------------------------------------------------------------------------
* *
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * Permission is hereby granted, free of charge,
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * to any person obtaining a copy of this software and associated documentation files (the "Software"),
* PURPOSE. See the GNU General Public License for more details. * to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* *
* You should have received a copy of the GNU General Public License along with RetroArch. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* If not, see <http://www.gnu.org/licenses/>. *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef NETPLAY_COMPAT_H__ #ifndef LIBRETRO_SDK_NETPLAY_COMPAT_H__
#define NETPLAY_COMPAT_H__ #define LIBRETRO_SDK_NETPLAY_COMPAT_H__
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"

View File

@ -1,21 +1,27 @@
/* RetroArch - A frontend for libretro. /* Copyright (C) 2010-2016 The RetroArch team
* Copyright (C) 2011-2015 - Daniel De Matteis
* Copyright (C) 2014-2015 - Alfred Agrell
* *
* RetroArch is free software: you can redistribute it and/or modify it under the terms * ---------------------------------------------------------------------------------------
* of the GNU General Public License as published by the Free Software Found- * The following license statement only applies to this file (net_http.h).
* ation, either version 3 of the License, or (at your option) any later version. * ---------------------------------------------------------------------------------------
* *
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * Permission is hereby granted, free of charge,
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * to any person obtaining a copy of this software and associated documentation files (the "Software"),
* PURPOSE. See the GNU General Public License for more details. * to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* *
* You should have received a copy of the GNU General Public License along with RetroArch. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* If not, see <http://www.gnu.org/licenses/>. *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _NET_HTTP_H #ifndef _LIBRETRO_SDK_NET_HTTP_H
#define _NET_HTTP_H #define _LIBRETRO_SDK_NET_HTTP_H
#include <stdint.h> #include <stdint.h>
#include <boolean.h> #include <boolean.h>

View File

@ -0,0 +1,49 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (net_ifinfo.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _LIBRETRO_NET_IFINFO_H
#define _LIBRETRO_NET_IFINFO_H
#include <stdint.h>
#include <stddef.h>
#include <boolean.h>
struct net_ifinfo_entry
{
char *name;
char *host;
};
struct net_ifinfo
{
struct net_ifinfo_entry *entries;
size_t size;
};
typedef struct net_ifinfo net_ifinfo_t;
void net_ifinfo_free(net_ifinfo_t *list);
bool net_ifinfo_new(net_ifinfo_t *list);
#endif

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (boolean.h). * The following license statement only applies to this file (fifo_queue.h).
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* *
* Permission is hereby granted, free of charge, * Permission is hereby granted, free of charge,

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (boolean.h). * The following license statement only applies to this file (message_queue.h).
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* *
* Permission is hereby granted, free of charge, * Permission is hereby granted, free of charge,

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_assert.h). * The following license statement only applies to this file (retro_assert.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_dirent.h). * The following license statement only applies to this file (retro_dirent.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_environment.h). * The following license statement only applies to this file (retro_environment.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_inline.h). * The following license statement only applies to this file (retro_inline.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_miscellaneous.h). * The following license statement only applies to this file (retro_miscellaneous.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_stat.h). * The following license statement only applies to this file (retro_stat.h).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rhash.h). * The following license statement only applies to this file (rhash.h).

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_file.h). * The following license statement only applies to this file (file_stream.h).
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* *
* Permission is hereby granted, free of charge, * Permission is hereby granted, free of charge,
@ -20,8 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef __RETRO_FILE_H #ifndef __LIBRETRO_SDK_FILE_STREAM_H
#define __RETRO_FILE_H #define __LIBRETRO_SDK_FILE_STREAM_H
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (dir_list.c). * The following license statement only applies to this file (dir_list.c).
@ -22,9 +22,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <file/dir_list.h> #include <lists/dir_list.h>
#include <lists/string_list.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <string/string_list.h>
#include <compat/strl.h> #include <compat/strl.h>
#include <retro_dirent.h> #include <retro_dirent.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (file_list.c). * The following license statement only applies to this file (file_list.c).
@ -20,29 +20,53 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <retro_assert.h>
#include <retro_common.h> #include <retro_common.h>
#include <file/file_list.h> #include <lists/file_list.h>
#include <compat/strcasestr.h> #include <compat/strcasestr.h>
void file_list_push(file_list_t *list, /**
* file_list_capacity:
* @list : pointer to file list
* @cap : new capacity for file list.
*
* Change maximum capacity of file list's size.
*
* Returns: true (1) if successful, otherwise false (0).
**/
static bool file_list_capacity(file_list_t *list, size_t cap)
{
struct item_file *new_data = NULL;
retro_assert(cap > list->size);
new_data = (struct item_file*)realloc(list->list,
cap * sizeof(struct item_file));
if (!new_data)
return false;
if (cap > list->capacity)
memset(&new_data[list->capacity], 0,
sizeof(*new_data) * (cap - list->capacity));
list->list = new_data;
list->capacity = cap;
return true;
}
bool file_list_push(file_list_t *list,
const char *path, const char *label, const char *path, const char *label,
unsigned type, size_t directory_ptr, unsigned type, size_t directory_ptr,
size_t entry_idx) size_t entry_idx)
{ {
if (list->size >= list->capacity) if (list->size >= list->capacity &&
{ !file_list_capacity(list, list->capacity * 2 + 1))
list->capacity += 1; return false;
list->capacity *= 2;
list->list = (struct item_file*)realloc(list->list,
list->capacity * sizeof(struct item_file));
if (!list->list)
return;
}
list->list[list->size].label = NULL; list->list[list->size].label = NULL;
list->list[list->size].path = NULL; list->list[list->size].path = NULL;
@ -59,6 +83,8 @@ void file_list_push(file_list_t *list,
list->list[list->size].path = strdup(path); list->list[list->size].path = strdup(path);
list->size++; list->size++;
return true;
} }
size_t file_list_get_size(const file_list_t *list) size_t file_list_get_size(const file_list_t *list)
@ -68,15 +94,6 @@ size_t file_list_get_size(const file_list_t *list)
return list->size; return list->size;
} }
size_t file_list_get_entry_index(const file_list_t *list)
{
size_t size = 0;
if (!list)
return 0;
size = file_list_get_size(list);
return list->list[size].entry_idx;
}
size_t file_list_get_directory_ptr(const file_list_t *list) size_t file_list_get_directory_ptr(const file_list_t *list)
{ {
size_t size = file_list_get_size(list); size_t size = file_list_get_size(list);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (string_list.c). * The following license statement only applies to this file (string_list.c).
@ -24,7 +24,7 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <string/string_list.h> #include <lists/string_list.h>
#include <retro_assert.h> #include <retro_assert.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <compat/strl.h> #include <compat/strl.h>

View File

@ -0,0 +1,178 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (compat_fnmatch.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <retro_miscellaneous.h>
#if defined(_WIN32) && !defined(_XBOX)
#include <winsock2.h>
#include <IPHlpApi.h>
#include <WS2tcpip.h>
#else
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netdb.h>
#ifdef WANT_IFADDRS
#include <compat/ifaddrs.h>
#else
#include <ifaddrs.h>
#endif
#endif
#include <net/net_ifinfo.h>
void net_ifinfo_free(net_ifinfo_t *list)
{
unsigned k;
if (!list)
return;
for (k = 0; k < list->size; k++)
{
struct net_ifinfo_entry *ptr =
(struct net_ifinfo_entry*)&list->entries[k];
if (!ptr)
continue;
if (*ptr->name)
free(ptr->name);
if (*ptr->host)
free(ptr->host);
ptr->name = NULL;
ptr->host = NULL;
}
free(list->entries);
free(list);
}
bool net_ifinfo_new(net_ifinfo_t *list)
{
unsigned k = 0;
#if defined(_WIN32) && !defined(_XBOX)
DWORD size;
PIP_ADAPTER_ADDRESSES adapter_addresses, aa;
PIP_ADAPTER_UNICAST_ADDRESS ua;
DWORD rv = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, NULL, &size);
adapter_addresses = (PIP_ADAPTER_ADDRESSES)malloc(size);
rv = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, adapter_addresses, &size);
if (rv != ERROR_SUCCESS)
goto error;
for (aa = adapter_addresses; aa != NULL; aa = aa->Next)
{
char name[PATH_MAX_LENGTH];
memset(name, 0, sizeof(name));
WideCharToMultiByte(CP_ACP, 0, aa->FriendlyName, wcslen(aa->FriendlyName),
name, PATH_MAX_LENGTH, NULL, NULL);
for (ua = aa->FirstUnicastAddress; ua != NULL; ua = ua->Next)
{
char host[PATH_MAX_LENGTH];
struct net_ifinfo_entry *ptr = (struct net_ifinfo_entry*)
realloc(list->entries, (k+1) * sizeof(struct net_ifinfo_entry));
if (!ptr)
goto error;
list->entries = ptr;
memset(host, 0, sizeof(host));
getnameinfo(ua->Address.lpSockaddr, ua->Address.iSockaddrLength,
host, sizeof(host), NULL, NI_MAXSERV, NI_NUMERICHOST);
list->entries[k].name = strdup(name);
list->entries[k].host = strdup(host);
list->size = k + 1;
k++;
}
}
free(adapter_addresses);
#else
struct ifaddrs *ifa = NULL;
struct ifaddrs *ifaddr = NULL;
if (getifaddrs(&ifaddr) == -1)
goto error;
if (!list)
goto error;
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next)
{
char host[NI_MAXHOST];
struct net_ifinfo_entry *ptr = NULL;
if (!ifa->ifa_addr)
continue;
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
if (getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in),
host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) != 0)
goto error;
ptr = (struct net_ifinfo_entry*)
realloc(list->entries, (k+1) * sizeof(struct net_ifinfo_entry));
if (!ptr)
goto error;
list->entries = ptr;
list->entries[k].name = strdup(ifa->ifa_name);
list->entries[k].host = strdup(host);
list->size = k + 1;
k++;
}
freeifaddrs(ifaddr);
#endif
return true;
error:
#ifdef _WIN32
if (adapter_addresses)
free(adapter_addresses);
#else
freeifaddrs(ifaddr);
#endif
net_ifinfo_free(list);
return false;
}

View File

@ -0,0 +1,49 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (compat_fnmatch.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <net/net_ifinfo.h>
int main(int argc, const char *argv[])
{
unsigned k = 0;
net_ifinfo_t *list =
(net_ifinfo_t*)calloc(1, sizeof(*list));
if (!list)
return -1;
if (!net_ifinfo_new(list))
return -1;
for (k = 0; k < list->size; k++)
{
printf("%s:%s\n", list->entries[k].name, list->entries[k].host);
}
net_ifinfo_free(list);
return 0;
}

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rthreads.c). * The following license statement only applies to this file (fifo_queue.c).
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* *
* Permission is hereby granted, free of charge, * Permission is hereby granted, free of charge,
@ -23,12 +23,12 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <queues/fifo_buffer.h> #include <queues/fifo_queue.h>
struct fifo_buffer struct fifo_buffer
{ {
uint8_t *buffer; uint8_t *buffer;
size_t bufsize; size_t size;
size_t first; size_t first;
size_t end; size_t end;
}; };
@ -46,7 +46,7 @@ fifo_buffer_t *fifo_new(size_t size)
free(buf); free(buf);
return NULL; return NULL;
} }
buf->bufsize = size + 1; buf->size = size + 1;
return buf; return buf;
} }
@ -72,7 +72,7 @@ size_t fifo_read_avail(fifo_buffer_t *buffer)
size_t end = buffer->end; size_t end = buffer->end;
if (end < first) if (end < first)
end += buffer->bufsize; end += buffer->size;
return end - first; return end - first;
} }
@ -82,9 +82,9 @@ size_t fifo_write_avail(fifo_buffer_t *buffer)
size_t end = buffer->end; size_t end = buffer->end;
if (end < first) if (end < first)
end += buffer->bufsize; end += buffer->size;
return (buffer->bufsize - 1) - (end - first); return (buffer->size - 1) - (end - first);
} }
void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size) void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size)
@ -92,16 +92,16 @@ void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size)
size_t first_write = size; size_t first_write = size;
size_t rest_write = 0; size_t rest_write = 0;
if (buffer->end + size > buffer->bufsize) if (buffer->end + size > buffer->size)
{ {
first_write = buffer->bufsize - buffer->end; first_write = buffer->size - buffer->end;
rest_write = size - first_write; rest_write = size - first_write;
} }
memcpy(buffer->buffer + buffer->end, in_buf, first_write); memcpy(buffer->buffer + buffer->end, in_buf, first_write);
memcpy(buffer->buffer, (const uint8_t*)in_buf + first_write, rest_write); memcpy(buffer->buffer, (const uint8_t*)in_buf + first_write, rest_write);
buffer->end = (buffer->end + size) % buffer->bufsize; buffer->end = (buffer->end + size) % buffer->size;
} }
@ -110,15 +110,15 @@ void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t size)
size_t first_read = size; size_t first_read = size;
size_t rest_read = 0; size_t rest_read = 0;
if (buffer->first + size > buffer->bufsize) if (buffer->first + size > buffer->size)
{ {
first_read = buffer->bufsize - buffer->first; first_read = buffer->size - buffer->first;
rest_read = size - first_read; rest_read = size - first_read;
} }
memcpy(in_buf, (const uint8_t*)buffer->buffer + buffer->first, first_read); memcpy(in_buf, (const uint8_t*)buffer->buffer + buffer->first, first_read);
memcpy((uint8_t*)in_buf + first_read, buffer->buffer, rest_read); memcpy((uint8_t*)in_buf + first_read, buffer->buffer, rest_read);
buffer->first = (buffer->first + size) % buffer->bufsize; buffer->first = (buffer->first + size) % buffer->size;
} }

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rthreads.c). * The following license statement only applies to this file (message_queue.c).
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* *
* Permission is hereby granted, free of charge, * Permission is hereby granted, free of charge,

View File

@ -404,7 +404,7 @@ bool task_queue_ctl(enum task_queue_ctl_state state, void *data)
impl_current = &impl_regular; impl_current = &impl_regular;
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
if (*boolean_val) if (boolean_val && *boolean_val)
{ {
task_queue_ctl(TASK_QUEUE_CTL_SET_THREADED, NULL); task_queue_ctl(TASK_QUEUE_CTL_SET_THREADED, NULL);
impl_current = &impl_threaded; impl_current = &impl_threaded;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (async_job.c). * The following license statement only applies to this file (async_job.c).

View File

@ -1,27 +1,23 @@
/* /* Copyright (C) 2010-2016 The RetroArch team
Copyright 2005 Allen B. Downey *
* ---------------------------------------------------------------------------------------
This file contains an example program from The Little Book of * The following license statement only applies to this file (rsemaphore.c).
Semaphores, available from Green Tea Press, greenteapress.com * ---------------------------------------------------------------------------------------
*
This program is free software; you can redistribute it and/or modify * Permission is hereby granted, free of charge,
it under the terms of the GNU General Public License as published by * to any person obtaining a copy of this software and associated documentation files (the "Software"),
the Free Software Foundation; either version 2 of the License, or * to deal in the Software without restriction, including without limitation the rights to
(at your option) any later version. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
This program is distributed in the hope that it will be useful, *
but WITHOUT ANY WARRANTY; without even the implied warranty of * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
GNU General Public License for more details. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
You should have received a copy of the GNU General Public License * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
along with this program; if not, see http://www.gnu.org/licenses/gpl.html * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
or write to the Free Software Foundation, Inc., 51 Franklin St, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Fifth Floor, Boston, MA 02110-1301 USA * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* Code taken from http://greenteapress.com/semaphores/semaphore.c
* and changed to use libretro-common's mutexes and conditions.
*/ */
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rthreads.c). * The following license statement only applies to this file (rthreads.c).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (xenon_sdl_threads.c). * The following license statement only applies to this file (xenon_sdl_threads.c).

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_file.c). * The following license statement only applies to this file (file_stream.c).
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* *
* Permission is hereby granted, free of charge, * Permission is hereby granted, free of charge,
@ -63,7 +63,7 @@
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#include <retro_file.h> #include <streams/file_stream.h>
#include <memmap.h> #include <memmap.h>
#if 1 #if 1

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (memory_stream.c). * The following license statement only applies to this file (memory_stream.c).
@ -20,11 +20,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <string.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <file/memory_stream.h> #include <streams/memory_stream.h>
static uint8_t* g_buffer = NULL; static uint8_t* g_buffer = NULL;
static size_t g_size = 0; static size_t g_size = 0;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team /* Copyright (C) 2010-2016 The RetroArch team
* *
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (stdstring.c). * The following license statement only applies to this file (stdstring.c).