mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.7.3.1
This commit is contained in:
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx;
|
||||
import gplx.core.consoles.*;
|
||||
public class Gfo_cache_mgr {
|
||||
private Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
private Ordered_hash recent = Ordered_hash_.new_bry_();
|
||||
@@ -64,7 +65,7 @@ public class Gfo_cache_mgr {
|
||||
hash.Add(key, itm);
|
||||
}
|
||||
public void Reduce_recent() {
|
||||
// ConsoleAdp._.WriteLine("reducing");
|
||||
// Console_adp__sys.I.WriteLine("reducing");
|
||||
int len = recent.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Gfo_cache_itm itm = (Gfo_cache_itm)recent.Get_at(i);
|
||||
@@ -73,7 +74,7 @@ public class Gfo_cache_mgr {
|
||||
recent.Clear();
|
||||
}
|
||||
public void Reduce_cache() {
|
||||
ConsoleAdp._.WriteLine("compacting:");
|
||||
Console_adp__sys.I.Write_str_w_nl("compacting:");
|
||||
// hash.Sort();
|
||||
// int len = hash.Count();
|
||||
// List_adp deleted = List_adp_.new_();
|
||||
|
||||
@@ -137,7 +137,7 @@ public class Gfo_url_parser {
|
||||
private void Parse_site(byte[] src, int bgn, int end) {
|
||||
int dot_count = 0, dot_pos_0 = -1, dot_pos_1 = -1;
|
||||
boolean loop = true;
|
||||
byte b = Byte_ascii.Nil;
|
||||
byte b = Byte_ascii.Null;
|
||||
while (loop) {
|
||||
if (bgn == end) {
|
||||
url.Err_(Gfo_url.Err_site_missing);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Int_2_ref {
|
||||
int v0 = Int_.parse_(itms[0]);
|
||||
int v1 = Int_.parse_(itms[1]);
|
||||
return new Int_2_ref(v0, v1);
|
||||
} catch (Exception e) {Exc_.Noop(e); throw Exc_.new_parse("Int_2_ref", raw);}
|
||||
} catch (Exception e) {Err_.Noop(e); throw Err_.new_parse("Int_2_ref", raw);}
|
||||
}
|
||||
public static Int_2_ref[] parse_ary_(String raw) {
|
||||
try {
|
||||
@@ -53,6 +53,6 @@ public class Int_2_ref {
|
||||
rv[i] = new Int_2_ref(v0, v1);
|
||||
}
|
||||
return rv;
|
||||
} catch (Exception e) {Exc_.Noop(e); throw Exc_.new_parse("Int_2_ref[]", raw);}
|
||||
} catch (Exception e) {Err_.Noop(e); throw Err_.new_parse("Int_2_ref[]", raw);}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Int_ary_parser extends Obj_ary_parser_base {
|
||||
Number_parser parser = new Number_parser(); int[] ary; int ary_idx;
|
||||
public int[] Parse_ary(String str, byte dlm) {byte[] bry = Bry_.new_u8(str); return Parse_ary(bry, 0, bry.length, dlm);}
|
||||
public int[] Parse_ary(byte[] bry, int bgn, int end, byte dlm) {
|
||||
Parse_core(bry, bgn, end, dlm, Byte_ascii.Nil);
|
||||
Parse_core(bry, bgn, end, dlm, Byte_ascii.Null);
|
||||
return ary;
|
||||
}
|
||||
@Override protected void Ary_len_(int v) {
|
||||
@@ -32,7 +32,7 @@ public class Int_ary_parser extends Obj_ary_parser_base {
|
||||
}
|
||||
}
|
||||
@Override protected void Parse_itm(byte[] bry, int bgn, int end) {
|
||||
parser.Parse(bry, bgn, end); if (parser.Has_err() || parser.Has_frac()) throw Exc_.new_("failed to parse number", "val", String_.new_u8(bry, bgn, end));
|
||||
parser.Parse(bry, bgn, end); if (parser.Has_err() || parser.Has_frac()) throw Err_.new_wo_type("failed to parse number", "val", String_.new_u8(bry, bgn, end));
|
||||
ary[ary_idx++] = parser.Rv_as_int();
|
||||
}
|
||||
public static final Int_ary_parser _ = new Int_ary_parser();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Io_zip_mgr_base implements Io_zip_mgr {
|
||||
Zip_dir__add_dir(zip_strm, bry, "", src_dir, Zip_dir__get_subs(src_dir));
|
||||
zip_strm.flush();
|
||||
zip_strm.close();
|
||||
} catch(IOException e) {Exc_.new_exc(e, "io", "error duing zip", "src", src_dir.Raw(), "trg", trg_fil.Raw());}
|
||||
} catch(IOException e) {Err_.new_exc(e, "io", "error duing zip", "src", src_dir.Raw(), "trg", trg_fil.Raw());}
|
||||
}
|
||||
private void Zip_dir__add_dir(ZipOutputStream zip_strm, byte[] bry, String zip_path, Io_url owner_dir, Io_url[] subs) {
|
||||
int len = subs.length;
|
||||
@@ -53,7 +53,7 @@ public class Io_zip_mgr_base implements Io_zip_mgr {
|
||||
while ((len = fil_strm.read(bry)) > 0)
|
||||
zip_strm.write(bry, 0, len);
|
||||
fil_strm.close();
|
||||
} catch(IOException e) {throw Exc_.new_exc(e, "io", "error duing zip", "src", zip_path);}
|
||||
} catch(IOException e) {throw Err_.new_exc(e, "io", "error duing zip", "src", zip_path);}
|
||||
}
|
||||
private Io_url[] Zip_dir__get_subs(Io_url url) {
|
||||
return Io_mgr.I.QueryDir_args(url).DirInclude_().ExecAsUrlAry();
|
||||
@@ -70,7 +70,7 @@ public class Io_zip_mgr_base implements Io_zip_mgr {
|
||||
trgZip.write(tmp, 0, count);
|
||||
}
|
||||
trgZip.close();
|
||||
} catch(Exception e) {throw Exc_.new_("failed to zip", "err", e.getMessage());}
|
||||
} catch(Exception e) {throw Err_.new_wo_type("failed to zip", "err", e.getMessage());}
|
||||
return trg_stream.toByteArray();
|
||||
}
|
||||
public byte[] Unzip_bry(byte[] src, int bgn, int len) {
|
||||
@@ -84,7 +84,7 @@ public class Io_zip_mgr_base implements Io_zip_mgr {
|
||||
trg_stream.write(tmp, 0, count);
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {throw Exc_.new_("failed to unzip", "err", e.getMessage());}
|
||||
} catch(Exception e) {throw Err_.new_wo_type("failed to unzip", "err", e.getMessage());}
|
||||
return trg_stream.toByteArray();
|
||||
}
|
||||
public void Unzip_to_dir(Io_url src_fil, Io_url trg_dir) {
|
||||
@@ -112,7 +112,7 @@ public class Io_zip_mgr_base implements Io_zip_mgr {
|
||||
}
|
||||
zip_strm.closeEntry();
|
||||
zip_strm.close();
|
||||
} catch(IOException e) {throw Exc_.new_exc(e, "io", "error duing unzip", "src", src_fil.Raw(), "trg", trg_dir.Raw());}
|
||||
} catch(IOException e) {throw Err_.new_exc(e, "io", "error duing unzip", "src", src_fil.Raw(), "trg", trg_dir.Raw());}
|
||||
}
|
||||
byte[] tmp = new byte[4096]; int tmpLen = 4096;
|
||||
public static final Io_zip_mgr _ = new Io_zip_mgr_base();
|
||||
|
||||
@@ -27,10 +27,10 @@ public class Io_zip_mgr_mok implements Io_zip_mgr {
|
||||
public byte[] Unzip_bry(byte[] src, int bgn, int len) {
|
||||
if (src == Bry_.Empty) return src;
|
||||
byte[] section = Bry_.Mid(src, bgn, bgn + len);
|
||||
if (!Bry_.Has_at_bgn(section, Bry_zipped, 0, section.length)) throw Exc_.new_("src not zipped", "section", String_.new_u8(section));
|
||||
if (!Bry_.Has_at_bgn(section, Bry_zipped, 0, section.length)) throw Err_.new_wo_type("src not zipped", "section", String_.new_u8(section));
|
||||
return Bry_.Mid(section, Bry_zipped.length, section.length);
|
||||
}
|
||||
public void Unzip_to_dir(Io_url src_fil, Io_url trg_dir) {}
|
||||
private static final byte[] Bry_zipped = Bry_.new_u8("zipped:");
|
||||
private static final byte[] Bry_zipped = Bry_.new_a7("zipped:");
|
||||
public static final Io_zip_mgr_mok _ = new Io_zip_mgr_mok(); Io_zip_mgr_mok() {}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public abstract class Obj_ary_parser_base {
|
||||
return;
|
||||
}
|
||||
int pos_idx = 0;
|
||||
int dlm_last = -1; // NOTE: -1 b/c dlm_2 can be 0 (Byte_ascii.Nil) and need to do dlm_last != dlm_2 check below
|
||||
int dlm_last = -1; // NOTE: -1 b/c dlm_2 can be 0 (Byte_ascii.Null) and need to do dlm_last != dlm_2 check below
|
||||
for (int i = bgn; i < end; i++) {
|
||||
byte b = bry[i];
|
||||
if (b == dlm_1 || b == dlm_2) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Tst_mgr {
|
||||
public void Tst_obj(Tst_chkr expd, Object actl) {
|
||||
results.Clear();
|
||||
int err = Tst_sub_obj(expd, actl, "", 0);
|
||||
if (throwError && err > 0) throw Exc_.new_(Build());
|
||||
if (throwError && err > 0) throw Err_.new_wo_type(Build());
|
||||
}
|
||||
public void Tst_ary(String ownerPath, Tst_chkr[] expd_ary, Object[] actl_ary) {
|
||||
results.Clear();
|
||||
@@ -59,7 +59,7 @@ public class Tst_mgr {
|
||||
}
|
||||
if (throwError && err > 0) {
|
||||
String s = Build();
|
||||
throw Exc_.new_(s);
|
||||
throw Err_.new_wo_type(s);
|
||||
}
|
||||
}
|
||||
public int Tst_sub_obj(Tst_chkr expd, Object actl, String path, int err) {
|
||||
|
||||
@@ -250,7 +250,7 @@ class Url_encoder_itm_hex implements Url_encoder_itm {
|
||||
}
|
||||
public int Decode(Bry_bfr bfr, byte[] src, int end, int idx, byte b, boolean fail_when_invalid) {
|
||||
if (idx + 2 >= end) {
|
||||
if (fail_when_invalid) throw Exc_.new_("decode needs 3 bytes", "idx", idx, "len", end, "snip", String_.new_u8(Bry_.Mid_by_len_safe(src, idx, 3)));
|
||||
if (fail_when_invalid) throw Err_.new_wo_type("decode needs 3 bytes", "idx", idx, "len", end, "snip", String_.new_u8(Bry_.Mid_by_len_safe(src, idx, 3)));
|
||||
else {
|
||||
bfr.Add_byte(b);
|
||||
return 0;
|
||||
@@ -270,7 +270,7 @@ class Url_encoder_itm_hex implements Url_encoder_itm {
|
||||
}
|
||||
}
|
||||
if (fail_when_invalid)
|
||||
throw Exc_.new_("decode is invalid", "idx", idx, "snip", String_.new_u8(Bry_.Mid_by_len_safe(src, idx, 3)));
|
||||
throw Err_.new_wo_type("decode is invalid", "idx", idx, "snip", String_.new_u8(Bry_.Mid_by_len_safe(src, idx, 3)));
|
||||
else {
|
||||
bfr.Add_byte(b);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user