mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.8.5.1
This commit is contained in:
@@ -41,7 +41,7 @@ class Luaj_value_ {
|
||||
KeyVal kv = null;
|
||||
if (itm_val.type() == LuaValue.TFUNCTION) { // function is converted to Scrib_lua_proc
|
||||
String func_key = itm_key.tojstring();
|
||||
int func_id = Int_.cast_(itm_val_obj);
|
||||
int func_id = Int_.cast(itm_val_obj);
|
||||
Scrib_lua_proc lua_func = new Scrib_lua_proc(func_key, func_id);
|
||||
if (itm_key.type() == LuaValue.TSTRING) // most functions are named
|
||||
kv = KeyVal_.new_(func_key, lua_func);
|
||||
@@ -103,11 +103,11 @@ class Luaj_value_ {
|
||||
KeyVal itm = ary[i];
|
||||
LuaValue itm_val = X_obj_to_val(server, itm.Val());
|
||||
switch (itm.Key_tid()) {
|
||||
case KeyVal_.Key_tid_int:
|
||||
rv.set(Int_.cast_(itm.Key_as_obj()), itm_val);
|
||||
case Type_adp_.Tid__int:
|
||||
rv.set(Int_.cast(itm.Key_as_obj()), itm_val);
|
||||
break;
|
||||
case KeyVal_.Key_tid_str:
|
||||
case KeyVal_.Key_tid_obj:
|
||||
case Type_adp_.Tid__str:
|
||||
case Type_adp_.Tid__obj:
|
||||
rv.set(itm.Key(), itm_val);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Process_engine implements Scrib_engine {
|
||||
public Scrib_server Server() {return server;} public void Server_(Scrib_server v) {server = v;} Scrib_server server;
|
||||
public Scrib_lua_proc LoadString(String name, String text) {
|
||||
KeyVal[] rslt = this.Dispatch("op", "loadString", "text", text, "chunkName", name);
|
||||
return new Scrib_lua_proc(name, Int_.cast_(rslt[0].Val()));
|
||||
return new Scrib_lua_proc(name, Int_.cast(rslt[0].Val()));
|
||||
}
|
||||
public KeyVal[] CallFunction(int id, KeyVal[] args) {
|
||||
return this.Dispatch("op", "call", "id", id, "nargs", args.length, "args", args);
|
||||
|
||||
@@ -82,9 +82,9 @@ public class Process_send_wtr {
|
||||
public boolean Encode_obj(Bry_bfr bfr, Object o) {
|
||||
if (o == null) {bfr.Add(CONST_nil); return true;}
|
||||
Class<?> c = Type_adp_.ClassOf_obj(o);
|
||||
if (Object_.Eq(c, Bool_.Cls_ref_type)) Encode_bool(bfr, Bool_.cast_(o));
|
||||
else if (Object_.Eq(c, Int_.Cls_ref_type)) Encode_int(bfr, Int_.cast_(o));
|
||||
else if (Object_.Eq(c, Double_.Cls_ref_type)) {if (!Encode_double(bfr, Double_.cast_(o))) return false;}
|
||||
if (Object_.Eq(c, Bool_.Cls_ref_type)) Encode_bool(bfr, Bool_.cast(o));
|
||||
else if (Object_.Eq(c, Int_.Cls_ref_type)) Encode_int(bfr, Int_.cast(o));
|
||||
else if (Object_.Eq(c, Double_.Cls_ref_type)) {if (!Encode_double(bfr, Double_.cast(o))) return false;}
|
||||
else if (Object_.Eq(c, String.class)) {if (!Encode_str(bfr, (String)o)) return false;}
|
||||
else if (Object_.Eq(c, byte[].class)) {if (!Encode_str(bfr, (byte[])o)) return false;} // NOTE: not in Scribunto; added here for PERF of not re-creating a String Object
|
||||
else if (Object_.Eq(c, Scrib_lua_proc.class)) {if (!Encode_prc(bfr, (Scrib_lua_proc)o)) return false;}
|
||||
|
||||
@@ -67,7 +67,7 @@ class Process_server_mock_rcvd_val implements Process_server_mock_rcvd {
|
||||
KeyVal kv = ary[i];
|
||||
Object kv_val = kv.Val();
|
||||
if (kv_val == null) {
|
||||
bfr.Add(gplx.core.json.Json_itm_.Const_null);
|
||||
bfr.Add(gplx.core.json.Json_itm_.Bry__null);
|
||||
continue;
|
||||
}
|
||||
Class<?> kv_val_type = kv_val.getClass();
|
||||
@@ -75,7 +75,7 @@ class Process_server_mock_rcvd_val implements Process_server_mock_rcvd {
|
||||
if (print_key && !kv_val_is_array)
|
||||
bfr.Add_str(kv.Key()).Add_byte(Byte_ascii.Colon);
|
||||
if (Type_adp_.Eq(kv_val_type, Bool_.Cls_ref_type))
|
||||
bfr.Add(Bool_.cast_(kv_val) ? gplx.core.json.Json_itm_.Const_true : gplx.core.json.Json_itm_.Const_false);
|
||||
bfr.Add(Bool_.cast(kv_val) ? gplx.core.json.Json_itm_.Bry__true : gplx.core.json.Json_itm_.Bry__false);
|
||||
else if (kv_val_is_array) {
|
||||
KeyVal[] sub = (KeyVal[])kv_val;
|
||||
if (sub.length == 0) {bfr.Add_byte(Byte_ascii.Curly_bgn).Add_byte(Byte_ascii.Curly_end);}
|
||||
|
||||
@@ -26,8 +26,8 @@ public class Process_stream_rdr {
|
||||
if (bytes_read == -1) return null; // stream closed; should only occur when shutting down
|
||||
else throw Err_.new_wo_type("failed to read header");
|
||||
}
|
||||
int body_len = HexDecUtl.parse_or_(bry_header, 0,8, -1); if (body_len == -1) throw Err_.new_wo_type("failed to read body_len");
|
||||
int chk_len= HexDecUtl.parse_or_(bry_header, 9, 16, -1); if (chk_len == -1 || chk_len != (body_len * 2) - 1) throw Err_.new_wo_type("failed to read chk_len");
|
||||
int body_len = HexDecUtl.parse_or(bry_header, 0,8, -1); if (body_len == -1) throw Err_.new_wo_type("failed to read body_len");
|
||||
int chk_len= HexDecUtl.parse_or(bry_header, 9, 16, -1); if (chk_len == -1 || chk_len != (body_len * 2) - 1) throw Err_.new_wo_type("failed to read chk_len");
|
||||
byte[] trg_bry = (body_len > bry_body.length) ? new byte[body_len] : bry_body;
|
||||
return Read_body(trg_bry, body_len, rdr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user