Remove u16

It's better to use types from the standard library.
This commit is contained in:
phosit
2026-09-09 09:59:47 +02:00
parent 00ee825374
commit 500606e587
110 changed files with 848 additions and 818 deletions
+4 -4
View File
@@ -85,7 +85,7 @@ template<> bool FromJSVal<u32>(const Request& rq, JS::HandleValue v, u32& out)
return true;
}
template<> bool FromJSVal<u16>(const Request& rq, JS::HandleValue v, u16& out)
template<> bool FromJSVal<std::uint16_t>(const Request& rq, JS::HandleValue v, std::uint16_t& out)
{
FAIL_IF_NOT(v.isNumber(), v);
if (!JS::ToUint16(rq.cx, v, &out))
@@ -95,7 +95,7 @@ template<> bool FromJSVal<u16>(const Request& rq, JS::HandleValue v, u16& out)
template<> bool FromJSVal<std::uint8_t>(const Request& rq, JS::HandleValue v, std::uint8_t& out)
{
u16 tmp;
std::uint16_t tmp;
FAIL_IF_NOT(v.isNumber(), v);
if (!JS::ToUint16(rq.cx, v, &tmp))
return false;
@@ -211,7 +211,7 @@ template<> void ToJSVal<std::int32_t>(const Request&, JS::MutableHandleValue ret
ret.set(JS::NumberValue(val));
}
template<> void ToJSVal<u16>(const Request&, JS::MutableHandleValue ret, const u16& val)
template<> void ToJSVal<std::uint16_t>(const Request&, JS::MutableHandleValue ret, const std::uint16_t& val)
{
ret.set(JS::NumberValue(val));
}
@@ -278,7 +278,7 @@ template<> void ToJSVal<CStr8>(const Request& rq, JS::MutableHandleValue ret, c
JSVAL_VECTOR(int)
JSVAL_VECTOR(u32)
JSVAL_VECTOR(u16)
JSVAL_VECTOR(std::uint16_t)
JSVAL_VECTOR(std::string)
JSVAL_VECTOR(std::wstring)
JSVAL_VECTOR(std::vector<std::wstring>)
+4 -5
View File
@@ -18,7 +18,6 @@
#ifndef INCLUDED_FUNCTIONWRAPPER
#define INCLUDED_FUNCTIONWRAPPER
#include "lib/types.h"
#include "scriptinterface/Conversions.h"
#include "scriptinterface/Exceptions.h"
#include "scriptinterface/Request.h"
@@ -445,7 +444,7 @@ public:
*/
template <auto callable, GetterFor<callable> thisGetter = nullptr>
static JSFunctionSpec Wrap(const char* name,
const u16 flags = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)
const std::uint16_t flags = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)
{
return JS_FN(name, (&ToJSNative<callable, thisGetter>), args_info<callable>::nb_args, flags);
}
@@ -455,7 +454,7 @@ public:
*/
template <auto callable, GetterFor<callable> thisGetter = nullptr>
static JSFunction* Create(const Request& rq, const char* name,
const u16 flags = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)
const std::uint16_t flags = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)
{
return JS_NewFunction(rq.cx, &ToJSNative<callable, thisGetter>, args_info<callable>::nb_args, flags, name);
}
@@ -465,7 +464,7 @@ public:
*/
template <auto callable, GetterFor<callable> thisGetter = nullptr>
static void Register(const Request& rq, const char* name,
const u16 flags = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)
const std::uint16_t flags = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)
{
JS_DefineFunction(rq.cx, rq.nativeScope, name, &ToJSNative<callable, thisGetter>, args_info<callable>::nb_args, flags);
}
@@ -477,7 +476,7 @@ public:
*/
template <auto callable, GetterFor<callable> thisGetter = nullptr>
static void Register(JSContext* cx, JS::HandleObject scope, const char* name,
const u16 flags = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)
const std::uint16_t flags = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)
{
JS_DefineFunction(cx, scope, name, &ToJSNative<callable, thisGetter>, args_info<callable>::nb_args, flags);
}