[Scummvm-cvs-logs] scummvm master -> 92f4b7c611f0c317805e79a62ed883614572d9dd

fuzzie fuzzie at fuzzie.org
Thu Jun 23 10:33:38 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
92f4b7c611 BASE: Fix build, and error handling in DO_OPTION_INT.


Commit: 92f4b7c611f0c317805e79a62ed883614572d9dd
    https://github.com/scummvm/scummvm/commit/92f4b7c611f0c317805e79a62ed883614572d9dd
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-06-23T01:28:43-07:00

Commit Message:
BASE: Fix build, and error handling in DO_OPTION_INT.

This fixes the logic of 979fc29b (I hope) and includes some missing
headers.

Changed paths:
    base/commandLine.cpp



diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 6d187ac..6cb8585 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -25,6 +25,9 @@
 
 #define FORBIDDEN_SYMBOL_EXCEPTION_exit
 
+#include <errno.h>
+#include <limits.h>
+
 #include "engines/metaengine.h"
 #include "base/commandLine.h"
 #include "base/plugins.h"
@@ -267,8 +270,9 @@ void registerDefaults() {
 #define DO_OPTION_INT(shortCmd, longCmd) \
 	DO_OPTION(shortCmd, longCmd) \
 	char *endptr = 0; \
+	errno = 0; \
 	long int retval = strtol(option, &endptr, 0); \
-	if (endptr == NULL || *endptr != 0 || retval == 0 || retval == LONG_MAX || retval == LONG_MIN || errno == ERANGE) \
+	if (endptr == NULL || *endptr != 0 || (errno != 0 && retval == 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",






More information about the Scummvm-git-logs mailing list