[gimp-perl] Improve handling of non-num when expected num.



commit a37eaec3a444dfe8233f172367da32bbcaff5f6e
Author: Ed J <edj src gnome org>
Date:   Fri May 23 21:15:18 2014 +0100

    Improve handling of non-num when expected num.

 Gimp/Lib.xs |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/Gimp/Lib.xs b/Gimp/Lib.xs
index 7e58d8e..5ba6cdc 100644
--- a/Gimp/Lib.xs
+++ b/Gimp/Lib.xs
@@ -733,10 +733,10 @@ gotit:
    string constants here, and check for common typoes. */
 static int check_num (char *croak_str, SV *sv)
 {
-  if (SvTYPE (sv) == SVt_PV && !SvIOKp(sv))
+  if (SvIOKp(sv) || SvNOKp(sv)) return 1;
+  if (SvTYPE (sv) == SVt_PV)
     {
       char *p = SvPV_nolen (sv);
-
       if (*p
          && *p != '0' && *p != '1' && *p != '2' && *p != '3' && *p != '4'
          && *p != '5' && *p != '6' && *p != '7' && *p != '8' && *p != '9'
@@ -911,8 +911,8 @@ push_gimp_sv (const GimpParam *arg, int array_as_ref)
        if (SvROK(sv)) \
          sprintf (croak_str, __("Unable to convert a reference to type '%s'"), str);
 #define sv_getnum(sv, func, lvalue, typestr) \
-       sv_croak_ref(sv, typestr); \
-       check_num(croak_str, sv); \
+       sv_croak_ref(sv, typestr); if (*croak_str) return 1; \
+       check_num(croak_str, sv); if (*croak_str) return 1; \
        lvalue = func(sv);
 
 /*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]