Remove uint

It's better to use the native types.
This commit is contained in:
phosit
2026-09-09 09:59:47 +02:00
parent ae7801c9c7
commit 281e8cd862
15 changed files with 214 additions and 156 deletions
+9 -8
View File
@@ -148,12 +148,12 @@ JSClass global_class = {
// Functions in the global namespace:
bool print(JSContext* cx, uint argc, JS::Value* vp)
bool print(JSContext* cx, unsigned int argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
Script::Request rq(cx);
for (uint i = 0; i < args.length(); ++i)
for (unsigned int i = 0; i < args.length(); ++i)
{
std::wstring str;
if (!Script::FromJSVal(rq, args[i], str))
@@ -165,7 +165,7 @@ bool print(JSContext* cx, uint argc, JS::Value* vp)
return true;
}
bool logmsg(JSContext* cx, uint argc, JS::Value* vp)
bool logmsg(JSContext* cx, unsigned int argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (args.length() < 1)
@@ -183,7 +183,7 @@ bool logmsg(JSContext* cx, uint argc, JS::Value* vp)
return true;
}
bool warn(JSContext* cx, uint argc, JS::Value* vp)
bool warn(JSContext* cx, unsigned int argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (args.length() < 1)
@@ -201,7 +201,7 @@ bool warn(JSContext* cx, uint argc, JS::Value* vp)
return true;
}
bool error(JSContext* cx, uint argc, JS::Value* vp)
bool error(JSContext* cx, unsigned int argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (args.length() < 1)
@@ -323,7 +323,7 @@ bool Interface::MathRandom(double& nbr) const
return true;
}
bool Interface::Math_random(JSContext* cx, uint argc, JS::Value* vp)
bool Interface::Math_random(JSContext* cx, unsigned int argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
double r;
@@ -528,7 +528,8 @@ void Interface::CallConstructor(JS::HandleValue ctor, JS::HandleValueArray argv,
out.setObjectOrNull(objOut);
}
void Interface::DefineCustomObjectType(JSClass *clasp, JSNative constructor, uint minArgs, JSPropertySpec *ps, JSFunctionSpec *fs, JSPropertySpec *static_ps, JSFunctionSpec *static_fs)
void Interface::DefineCustomObjectType(JSClass *clasp, JSNative constructor, unsigned int minArgs,
JSPropertySpec *ps, JSFunctionSpec *fs, JSPropertySpec *static_ps, JSFunctionSpec *static_fs)
{
Request rq(this);
std::string typeName = clasp->name;
@@ -606,7 +607,7 @@ bool Interface::SetGlobal_(const char* name, JS::HandleValue value, bool replace
}
}
uint attrs = 0;
unsigned int attrs = 0;
if (constant)
attrs |= JSPROP_READONLY;
if (enumerate)
+3 -3
View File
@@ -19,7 +19,6 @@
#define INCLUDED_SCRIPT_INTERFACE
#include "lib/code_annotation.h"
#include "lib/types.h"
#include "ps/Errors.h"
#include "scriptinterface/Conversions.h"
#include "scriptinterface/Exceptions.h"
@@ -196,7 +195,8 @@ public:
void CallConstructor(JS::HandleValue ctor, JS::HandleValueArray argv, JS::MutableHandleValue out) const;
JSObject* CreateCustomObject(const std::string & typeName) const;
void DefineCustomObjectType(JSClass *clasp, JSNative constructor, uint minArgs, JSPropertySpec *ps, JSFunctionSpec *fs, JSPropertySpec *static_ps, JSFunctionSpec *static_fs);
void DefineCustomObjectType(JSClass *clasp, JSNative constructor, unsigned int minArgs,
JSPropertySpec *ps, JSFunctionSpec *fs, JSPropertySpec *static_ps, JSFunctionSpec *static_fs);
/**
* Set the named property on the global object.
@@ -255,7 +255,7 @@ public:
/**
* JSNative wrapper of the above.
*/
static bool Math_random(JSContext* cx, uint argc, JS::Value* vp);
static bool Math_random(JSContext* cx, unsigned int argc, JS::Value* vp);
/**
* Name the reserved slots we may need to use in custom JSObjects.
+1 -2
View File
@@ -19,7 +19,6 @@
#define INCLUDED_SCRIPTINTERFACE_OBJECT
#include "lib/posix/posix_types.h"
#include "lib/types.h"
#include "ps/CLogger.h"
#include "scriptinterface/Conversions.h"
#include "scriptinterface/Request.h"
@@ -114,7 +113,7 @@ inline bool HasProperty(const Script::Request& rq, JS::HandleValue obj, const ch
template<typename PropType>
inline bool SetProperty(const Script::Request& rq, JS::HandleValue obj, PropType name, JS::HandleValue value, bool constant = false, bool enumerable = true)
{
uint attrs = 0;
unsigned int attrs = 0;
if (constant)
attrs |= JSPROP_READONLY | JSPROP_PERMANENT;
if (enumerable)