Fix build for C99
Signed-off-by: Mahyar Koshkouei <mahyar.koshkouei@gmail.com>
This commit is contained in:
parent
665aa372e0
commit
a8f84fa9b4
6
Makefile
6
Makefile
|
@ -112,15 +112,13 @@ else
|
|||
endif
|
||||
|
||||
OBJECTS := mpv-libretro.o
|
||||
LDFLAGS += -lmpv
|
||||
CFLAGS += -Wall -pedantic -std=c99
|
||||
LDFLAGS += -lmpv -lm
|
||||
CFLAGS += -Wall -pedantic -std=c99 -I.
|
||||
|
||||
ifneq (,$(findstring gles,$(platform)))
|
||||
LDFLAGS += -ldl
|
||||
endif
|
||||
|
||||
LDFLAGS += -lm
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
|
|
|
@ -15,12 +15,15 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Required for nanosleep */
|
||||
#define _POSIX_C_SOURCE 199309L
|
||||
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef HAVE_OPENGLES
|
||||
#include <dlfcn.h>
|
||||
|
@ -336,7 +339,8 @@ static void context_reset(void)
|
|||
"playback-time", MPV_FORMAT_INT64, &playback_time) < 0)
|
||||
{
|
||||
/* Garbage fix to overflowing log */
|
||||
usleep(10);
|
||||
static struct timespec ts = { 0, 10 * 1000 };
|
||||
nanosleep(&ts, NULL);
|
||||
}
|
||||
|
||||
/* TODO #2: Check for the highest samplerate in audio stream, and use that.
|
||||
|
@ -610,7 +614,13 @@ bool retro_load_game(const struct retro_game_info *info)
|
|||
/* Copy the file path to a global variable as we need it in context_reset()
|
||||
* where mpv is initialised.
|
||||
*/
|
||||
filepath = strdup(info->path);
|
||||
if((filepath = malloc(strlen(info->path)+1)) == NULL)
|
||||
{
|
||||
log_cb(RETRO_LOG_ERROR, "Unable to allocate memory for filepath\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
strcpy(filepath,info->path);
|
||||
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc);
|
||||
|
||||
|
|
Loading…
Reference in New Issue