mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[spidermonkey] unsigned char * -> char * in localstorage
This commit is contained in:
parent
69fadb536c
commit
21626c4831
@ -55,8 +55,8 @@
|
|||||||
#include "terminal/screen.h"
|
#include "terminal/screen.h"
|
||||||
|
|
||||||
/* IMPLEMENTS READ FROM STORAGE USING SQLITE DATABASE */
|
/* IMPLEMENTS READ FROM STORAGE USING SQLITE DATABASE */
|
||||||
static unsigned char *
|
static char *
|
||||||
readFromStorage(unsigned char *key)
|
readFromStorage(char *key)
|
||||||
{
|
{
|
||||||
|
|
||||||
char * val;
|
char * val;
|
||||||
@ -75,7 +75,7 @@ readFromStorage(unsigned char *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
removeFromStorage(const unsigned char *key)
|
removeFromStorage(const char *key)
|
||||||
{
|
{
|
||||||
if (local_storage_ready==0)
|
if (local_storage_ready==0)
|
||||||
{
|
{
|
||||||
@ -87,7 +87,7 @@ removeFromStorage(const unsigned char *key)
|
|||||||
|
|
||||||
/* IMPLEMENTS SAVE TO STORAGE USING SQLITE DATABASE */
|
/* IMPLEMENTS SAVE TO STORAGE USING SQLITE DATABASE */
|
||||||
static void
|
static void
|
||||||
saveToStorage(unsigned char *key, unsigned char *val)
|
saveToStorage(char *key, char *val)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (local_storage_ready==0) {
|
if (local_storage_ready==0) {
|
||||||
@ -107,8 +107,6 @@ saveToStorage(unsigned char *key, unsigned char *val)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool localstorage_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
|
|
||||||
|
|
||||||
JSClassOps localstorage_ops = {
|
JSClassOps localstorage_ops = {
|
||||||
nullptr, // addProperty
|
nullptr, // addProperty
|
||||||
nullptr, // deleteProperty
|
nullptr, // deleteProperty
|
||||||
@ -130,18 +128,6 @@ const JSClass localstorage_class = {
|
|||||||
&localstorage_ops
|
&localstorage_ops
|
||||||
};
|
};
|
||||||
|
|
||||||
///* @localstorage_class.getProperty */
|
|
||||||
static bool
|
|
||||||
localstorage_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp)
|
|
||||||
{
|
|
||||||
#ifdef ECMASCRIPT_DEBUG
|
|
||||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
|
||||||
#endif
|
|
||||||
JSObject *parent_win; /* instance of @window_class */
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool localstorage_getitem(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
static bool localstorage_getitem(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||||
static bool localstorage_removeitem(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
static bool localstorage_removeitem(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||||
static bool localstorage_setitem(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
static bool localstorage_setitem(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||||
@ -170,7 +156,6 @@ localstorage_getitem(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
|
|
||||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||||
|
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
@ -180,10 +165,10 @@ localstorage_getitem(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *key = jsval_to_string(ctx, args[0]);
|
char *key = jsval_to_string(ctx, args[0]);
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
unsigned char *val = readFromStorage(key);
|
char *val = readFromStorage(key);
|
||||||
|
|
||||||
if (val) {
|
if (val) {
|
||||||
args.rval().setString(JS_NewStringCopyZ(ctx, val));
|
args.rval().setString(JS_NewStringCopyZ(ctx, val));
|
||||||
@ -215,7 +200,6 @@ localstorage_removeitem(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
|
|
||||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||||
|
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
@ -224,7 +208,7 @@ localstorage_removeitem(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *key = jsval_to_string(ctx, args[0]);
|
char *key = jsval_to_string(ctx, args[0]);
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
removeFromStorage(key);
|
removeFromStorage(key);
|
||||||
@ -263,7 +247,7 @@ localstorage_setitem(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
|||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
|
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
|
||||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user