mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-01 06:44:27 +08:00
Fixed warning C4702: unreachable code
Also switched SDL_IOFromFile() to use SDL_InvalidParamError()
This commit is contained in:
@@ -535,10 +535,16 @@ static SDL_bool IsRegularFileOrPipe(FILE *f)
|
|||||||
SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode)
|
SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode)
|
||||||
{
|
{
|
||||||
SDL_IOStream *iostr = NULL;
|
SDL_IOStream *iostr = NULL;
|
||||||
if (!file || !*file || !mode || !*mode) {
|
|
||||||
SDL_SetError("SDL_IOFromFile(): No file or no mode specified");
|
if (!file || !*file) {
|
||||||
|
SDL_InvalidParamError("file");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (!mode || !*mode) {
|
||||||
|
SDL_InvalidParamError("mode");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SDL_PLATFORM_ANDROID
|
#ifdef SDL_PLATFORM_ANDROID
|
||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
/* Try to open the file on the filesystem first */
|
/* Try to open the file on the filesystem first */
|
||||||
@@ -599,9 +605,6 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return iostr;
|
|
||||||
|
|
||||||
|
|
||||||
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT)
|
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT)
|
||||||
IOStreamWindowsData *iodata = (IOStreamWindowsData *) SDL_malloc(sizeof (*iodata));
|
IOStreamWindowsData *iodata = (IOStreamWindowsData *) SDL_malloc(sizeof (*iodata));
|
||||||
if (!iodata) {
|
if (!iodata) {
|
||||||
@@ -631,8 +634,6 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return iostr;
|
|
||||||
|
|
||||||
#elif defined(HAVE_STDIO_H)
|
#elif defined(HAVE_STDIO_H)
|
||||||
{
|
{
|
||||||
#if defined(SDL_PLATFORM_APPLE)
|
#if defined(SDL_PLATFORM_APPLE)
|
||||||
|
|||||||
Reference in New Issue
Block a user