Eric Pouech : msvcrt: Use parameter checking macros for string to number functions.

Alexandre Julliard julliard at winehq.org
Mon Nov 1 11:54:34 CDT 2010


Module: wine
Branch: master
Commit: 1da9922ac322a8917d72719ce91395eefdcb9375
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1da9922ac322a8917d72719ce91395eefdcb9375

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Fri Oct 29 15:39:25 2010 +0200

msvcrt: Use parameter checking macros for string to number functions.

---

 dlls/msvcrt/string.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c
index fb02bd5..6b3725f 100644
--- a/dlls/msvcrt/string.c
+++ b/dlls/msvcrt/string.c
@@ -206,8 +206,7 @@ double CDECL MSVCRT_strtod_l( const char *str, char **end, MSVCRT__locale_t loca
     double ret;
     BOOL found_digit = FALSE;
 
-    if(!str) {
-        MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
+    if (!MSVCRT_CHECK_PMT(str != NULL)) {
         *MSVCRT__errno() = MSVCRT_EINVAL;
         return 0;
     }
@@ -529,8 +528,8 @@ __int64 CDECL MSVCRT_strtoi64_l(const char *nptr, char **endptr, int base, MSVCR
 
     TRACE("(%s %p %d %p)\n", nptr, endptr, base, locale);
 
-    if(!nptr || base<0 || base>36 || base==1) {
-        MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
+    if (!MSVCRT_CHECK_PMT(nptr != NULL) || !MSVCRT_CHECK_PMT(base == 0 || base >= 2) ||
+        !MSVCRT_CHECK_PMT(base <= 36)) {
         return 0;
     }
 
@@ -609,8 +608,8 @@ unsigned __int64 CDECL MSVCRT_strtoui64_l(const char *nptr, char **endptr, int b
 
     TRACE("(%s %p %d %p)\n", nptr, endptr, base, locale);
 
-    if(!nptr || base<0 || base>36 || base==1) {
-        MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
+    if (!MSVCRT_CHECK_PMT(nptr != NULL) || !MSVCRT_CHECK_PMT(base == 0 || base >= 2) ||
+        !MSVCRT_CHECK_PMT(base <= 36)) {
         return 0;
     }
 




More information about the wine-cvs mailing list