mirror of
https://github.com/scummvm/scummvm.git
synced 2026-05-21 05:40:43 +00:00
BASE: Remove an old strtol() limitation that was due to WinCE
The WinCE port is no more, so the strtol() check can use errno again.
This reverts some parts of commit 1b6453dff4.
This commit is contained in:
committed by
Filippos Karapetis
parent
1347482c55
commit
46adbc28e3
@@ -54,6 +54,8 @@
|
||||
#include "backends/platform/sdl/sdl-sys.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h> // For strtol result check
|
||||
|
||||
namespace Base {
|
||||
|
||||
#ifndef DISABLE_COMMAND_LINE
|
||||
@@ -551,12 +553,12 @@ bool ensureAccessibleDirectoryForPathOption(Common::FSNode &node,
|
||||
if (!option) usage("Option '%s' requires an argument", argv[isLongCmd ? i : i-1]);
|
||||
|
||||
// Use this for options which have a required integer value
|
||||
// (we don't check ERANGE because WinCE doesn't support errno, so we're stuck just rejecting LONG_MAX/LONG_MIN..)
|
||||
#define DO_OPTION_INT(shortCmd, longCmd) \
|
||||
DO_OPTION(shortCmd, longCmd) \
|
||||
char *endptr; \
|
||||
errno = 0; \
|
||||
long int retval = strtol(option, &endptr, 0); \
|
||||
if (*endptr != '\0' || retval == LONG_MAX || retval == LONG_MIN) \
|
||||
if (*endptr != '\0' || (errno == ERANGE && (retval == LONG_MAX || retval == LONG_MIN))) \
|
||||
usage("--%s: Invalid number '%s'", longCmd, option);
|
||||
|
||||
// Use this for boolean options; this distinguishes between "-x" and "-X",
|
||||
|
||||
Reference in New Issue
Block a user