diff --git a/100_core/src/gplx/core/btries/Btrie_slim_mgr.java b/100_core/src/gplx/core/btries/Btrie_slim_mgr.java
index 5cdfa6a09..bfa14396f 100644
--- a/100_core/src/gplx/core/btries/Btrie_slim_mgr.java
+++ b/100_core/src/gplx/core/btries/Btrie_slim_mgr.java
@@ -20,7 +20,14 @@ public class Btrie_slim_mgr implements Btrie_mgr {
public int Count() {return count;} private int count;
public int Match_pos() {return match_pos;} private int match_pos;
- public Object Match_at(Btrie_rv rv, byte[] src, int bgn_pos, int end_pos) {return bgn_pos < end_pos ? Match_at_w_b0(rv, src[bgn_pos], src, bgn_pos, end_pos) : null;} // handle out of bounds gracefully; EX: Match_bgn("abc", 3, 3) should return null not fail
+ public Object Match_at(Btrie_rv rv, byte[] src, int bgn_pos, int end_pos) {
+ if (bgn_pos < end_pos)
+ return Match_at_w_b0(rv, src[bgn_pos], src, bgn_pos, end_pos);
+ else { // handle out of bounds gracefully; EX: Match_bgn("abc", 3, 3) should (a) return null not fail; (b) return a pos of bgn_pos, not 0; DATE:2018-04-12
+ rv.Init(bgn_pos, null);
+ return null;
+ }
+ }
public Object Match_at_w_b0(Btrie_rv rv, byte b, byte[] src, int bgn_pos, int src_end) {
Object rv_obj = null;
int rv_pos = bgn_pos;
diff --git a/100_core/src/gplx/core/btries/Btrie_slim_mgr_tst.java b/100_core/src/gplx/core/btries/Btrie_slim_mgr_tst.java
index 9affb847d..1e4e2dfa8 100644
--- a/100_core/src/gplx/core/btries/Btrie_slim_mgr_tst.java
+++ b/100_core/src/gplx/core/btries/Btrie_slim_mgr_tst.java
@@ -14,7 +14,7 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.core.btries; import gplx.*; import gplx.core.*;
-import org.junit.*;
+import org.junit.*; import gplx.core.tests.*;
public class Btrie_slim_mgr_tst {
@Before public void init() {
} private Btrie_slim_mgr trie;
@@ -70,6 +70,12 @@ public class Btrie_slim_mgr_tst {
trie.Del(Bry_.new_a7("abc"));
tst_MatchAtCur("abc" , null);
}
+ @Test public void Match_none() {
+ Btrie_slim_mgr_fxt fxt = new Btrie_slim_mgr_fxt();
+ fxt.Init__add("k1", "v1");
+ fxt.Exec__match("ak1", 1, 3, "v1", 3); // 3 to position after match
+ fxt.Exec__match("ak2", 1, 1, null, 1); // 1 to position at current pos; used to be 0; de.w:Butter; DATE:2018-04-12
+ }
private void run_Add(String k, int val) {trie.Add_obj(Bry_.new_a7(k), val);}
private void tst_Match(String srcStr, byte b, int bgn_pos, int expd) {
@@ -88,3 +94,16 @@ public class Btrie_slim_mgr_tst {
Tfds.Eq(expd, actl);
}
}
+class Btrie_slim_mgr_fxt {
+ private final Btrie_slim_mgr trie = Btrie_slim_mgr.cs();
+ public Btrie_slim_mgr_fxt Init__add(String key, String val) {
+ trie.Add_str_str(key, val);
+ return this;
+ }
+ public void Exec__match(String src, int bgn_pos, int end_pos, Object expd_val, int expd_pos) {
+ Btrie_rv trv = new Btrie_rv();
+ Object actl_val = trie.Match_at(trv, Bry_.new_u8(src), bgn_pos, end_pos);
+ Gftest.Eq__obj_or_null(expd_val, actl_val);
+ Gftest.Eq__int(expd_pos, trv.Pos());
+ }
+}
diff --git a/400_xowa/src/gplx/xowa/htmls/core/hzips/Xoh_hzip_dict_.java b/400_xowa/src/gplx/xowa/htmls/core/hzips/Xoh_hzip_dict_.java
index 328719925..df3aaf5dd 100644
--- a/400_xowa/src/gplx/xowa/htmls/core/hzips/Xoh_hzip_dict_.java
+++ b/400_xowa/src/gplx/xowa/htmls/core/hzips/Xoh_hzip_dict_.java
@@ -51,5 +51,9 @@ public class Xoh_hzip_dict_ {
, Key__pgbnr = "pgbnr"
, Key__media = "media"
;
- public static final int Hzip__none = 0, Hzip__v1 = 1, Hzip__plain = 2; // SERIALIZED
+ public static final int // SERIALIZED
+ Hzip__none = 0
+ , Hzip__v1 = 1
+ , Hzip__plain = 2 // used for page_sync
+ ;
}
diff --git a/400_xowa/src/gplx/xowa/htmls/core/wkrs/imgs/Xoh_img_hzip__dump__basic__tst.java b/400_xowa/src/gplx/xowa/htmls/core/wkrs/imgs/Xoh_img_hzip__dump__basic__tst.java
index 1a72024dc..20d4f7424 100644
--- a/400_xowa/src/gplx/xowa/htmls/core/wkrs/imgs/Xoh_img_hzip__dump__basic__tst.java
+++ b/400_xowa/src/gplx/xowa/htmls/core/wkrs/imgs/Xoh_img_hzip__dump__basic__tst.java
@@ -93,6 +93,12 @@ public class Xoh_img_hzip__dump__basic__tst {
, ""
);
}
+ @Test public void Manual_img_cls_empty() { // PURPOSE: handle empty class; EX: [[File:A.png|class=""]] de.w:Butter; DATE:2018-04-11
+ fxt.Test__bicode
+ ( "~%!-A.png~)#Sabc~"
+ , ""
+ );
+ }
@Test public void Imap() {
fxt.Test__bicode
( "~%}#P`uA.png~#:#S#+\""