Skip to content

Commit

Permalink
automatic commit at releng box
Browse files Browse the repository at this point in the history
  • Loading branch information
mc36 committed Feb 4, 2023
1 parent 9c84a9d commit aa0bb8a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
26 changes: 21 additions & 5 deletions src/net/freertr/enc/encXml.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,33 @@ public static String unescId(String s) {
}

/**
* unescape identifier
* check if name needs escaping
*
* @param s identifier
* @return unescaped
* @param s string
* @return true if yes, false if not
*/
public static String escId(String s) {
public static boolean needEsc(String s) {
if (s.length() < 1) {
return true;
}
char c = s.charAt(0);
if ((c >= 'a') && (c <= 'z')) {
return s;
return false;
}
if ((c >= 'A') && (c <= 'Z')) {
return false;
}
return true;
}

/**
* unescape identifier
*
* @param s identifier
* @return unescaped
*/
public static String escId(String s) {
if (!needEsc(s)) {
return s;
}
return escape + s;
Expand Down
8 changes: 6 additions & 2 deletions src/net/freertr/user/userFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,12 @@ public static void section2xml(encXml rep, String beg, List<userFilter> sec) {
if (a.length() < 1) {
break;
}
a = "/" + encXml.escId(a);
s += a;
if (!encXml.needEsc(a)) {
s += "/" + a;
continue;
}
s += "/" + encXml.value;
rep.data.add(new encXmlEntry(null, s, "", a));
}
rep.data.add(new encXmlEntry(null, s, "", ""));
rep.data.add(new encXmlEntry(null, beg, "", ""));
Expand Down

0 comments on commit aa0bb8a

Please sign in to comment.