summaryrefslogtreecommitdiff
path: root/source4/scripting/ejs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-31 04:12:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:21 -0500
commita05bd5e9d654b97e1a2128a5048b68b7efd9ccd7 (patch)
tree16dcf5a784b9db94db802d05af31817d0638653b /source4/scripting/ejs
parentee21d32b25fe5de19364d678317475d44b1d5e29 (diff)
downloadsamba-a05bd5e9d654b97e1a2128a5048b68b7efd9ccd7.tar.gz
samba-a05bd5e9d654b97e1a2128a5048b68b7efd9ccd7.tar.bz2
samba-a05bd5e9d654b97e1a2128a5048b68b7efd9ccd7.zip
r7135: make typeof() complient with ECMA 11.4.3
(This used to be commit 29ab4cc6cb244255ab75af7ae2076b51209f4f2d)
Diffstat (limited to 'source4/scripting/ejs')
-rw-r--r--source4/scripting/ejs/smbcalls.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/source4/scripting/ejs/smbcalls.c b/source4/scripting/ejs/smbcalls.c
index 02b40c46d8..fc2c16a456 100644
--- a/source4/scripting/ejs/smbcalls.c
+++ b/source4/scripting/ejs/smbcalls.c
@@ -35,20 +35,20 @@ static int ejs_typeof(MprVarHandle eid, int argc, struct MprVar **argv)
MprType type;
const char *name;
} types[] = {
- { MPR_TYPE_UNDEFINED, "undefined" },
- { MPR_TYPE_NULL, "null" },
- { MPR_TYPE_BOOL, "boolean" },
- { MPR_TYPE_CFUNCTION, "function" },
- { MPR_TYPE_FLOAT, "float" },
- { MPR_TYPE_INT, "int" },
- { MPR_TYPE_INT64, "int64" },
- { MPR_TYPE_OBJECT, "object" },
- { MPR_TYPE_FUNCTION, "function" },
- { MPR_TYPE_STRING, "string" },
+ { MPR_TYPE_UNDEFINED, "undefined" },
+ { MPR_TYPE_NULL, "object" },
+ { MPR_TYPE_BOOL, "boolean" },
+ { MPR_TYPE_CFUNCTION, "function" },
+ { MPR_TYPE_FLOAT, "number" },
+ { MPR_TYPE_INT, "number" },
+ { MPR_TYPE_INT64, "number" },
+ { MPR_TYPE_OBJECT, "object" },
+ { MPR_TYPE_FUNCTION, "function" },
+ { MPR_TYPE_STRING, "string" },
{ MPR_TYPE_STRING_CFUNCTION, "function" }
};
int i;
- const char *type = "unknown";
+ const char *type = NULL;
if (argc != 1) return -1;
@@ -58,6 +58,7 @@ static int ejs_typeof(MprVarHandle eid, int argc, struct MprVar **argv)
break;
}
}
+ if (type == NULL) return -1;
ejsSetReturnString(eid, type);
return 0;