mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
AjayKemparaj: Tabs to spaces and minor java code fixups
This commit is contained in:
parent
6394d92279
commit
9420bb7e8b
9 changed files with 435 additions and 435 deletions
112
XMLTokener.java
112
XMLTokener.java
|
@ -272,7 +272,7 @@ public class XMLTokener extends JSONTokener {
|
|||
}
|
||||
switch (c) {
|
||||
case 0:
|
||||
return sb.toString();
|
||||
return sb.toString();
|
||||
case '>':
|
||||
case '/':
|
||||
case '=':
|
||||
|
@ -299,12 +299,12 @@ public class XMLTokener extends JSONTokener {
|
|||
* @throws JSONException
|
||||
*/
|
||||
public boolean skipPast(String to) throws JSONException {
|
||||
boolean b;
|
||||
char c;
|
||||
int i;
|
||||
int j;
|
||||
int offset = 0;
|
||||
int length = to.length();
|
||||
boolean b;
|
||||
char c;
|
||||
int i;
|
||||
int j;
|
||||
int offset = 0;
|
||||
int length = to.length();
|
||||
char[] circle = new char[length];
|
||||
|
||||
/*
|
||||
|
@ -312,54 +312,54 @@ public class XMLTokener extends JSONTokener {
|
|||
* to string. If we reach an early end, bail.
|
||||
*/
|
||||
|
||||
for (i = 0; i < length; i += 1) {
|
||||
c = next();
|
||||
if (c == 0) {
|
||||
return false;
|
||||
}
|
||||
circle[i] = c;
|
||||
}
|
||||
/*
|
||||
* We will loop, possibly for all of the remaining characters.
|
||||
*/
|
||||
for (;;) {
|
||||
j = offset;
|
||||
b = true;
|
||||
/*
|
||||
* Compare the circle buffer with the to string.
|
||||
*/
|
||||
for (i = 0; i < length; i += 1) {
|
||||
if (circle[j] != to.charAt(i)) {
|
||||
b = false;
|
||||
break;
|
||||
}
|
||||
j += 1;
|
||||
if (j >= length) {
|
||||
j -= length;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If we exit the loop with b intact, then victory is ours.
|
||||
*/
|
||||
if (b) {
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* Get the next character. If there isn't one, then defeat is ours.
|
||||
*/
|
||||
c = next();
|
||||
if (c == 0) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* Shove the character in the circle buffer and advance the
|
||||
* circle offset. The offset is mod n.
|
||||
*/
|
||||
circle[offset] = c;
|
||||
offset += 1;
|
||||
if (offset >= length) {
|
||||
offset -= length;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < length; i += 1) {
|
||||
c = next();
|
||||
if (c == 0) {
|
||||
return false;
|
||||
}
|
||||
circle[i] = c;
|
||||
}
|
||||
/*
|
||||
* We will loop, possibly for all of the remaining characters.
|
||||
*/
|
||||
for (;;) {
|
||||
j = offset;
|
||||
b = true;
|
||||
/*
|
||||
* Compare the circle buffer with the to string.
|
||||
*/
|
||||
for (i = 0; i < length; i += 1) {
|
||||
if (circle[j] != to.charAt(i)) {
|
||||
b = false;
|
||||
break;
|
||||
}
|
||||
j += 1;
|
||||
if (j >= length) {
|
||||
j -= length;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If we exit the loop with b intact, then victory is ours.
|
||||
*/
|
||||
if (b) {
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* Get the next character. If there isn't one, then defeat is ours.
|
||||
*/
|
||||
c = next();
|
||||
if (c == 0) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* Shove the character in the circle buffer and advance the
|
||||
* circle offset. The offset is mod n.
|
||||
*/
|
||||
circle[offset] = c;
|
||||
offset += 1;
|
||||
if (offset >= length) {
|
||||
offset -= length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue