Skip to content

Commit

Permalink
Cosmetic changes (space trimming, comment changes)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 6, 2024
1 parent d888da0 commit 4a83100
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/ctc/wstx/api/ReaderConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ public final class ReaderConfig

// since 5.4/6.4
protected int mMaxDtdDepth = DEFAULT_MAX_DTD_DEPTH;

/**
* Base URL to use as the resolution context for relative entity
* references
Expand Down
14 changes: 5 additions & 9 deletions src/main/java/com/ctc/wstx/sr/BasicStreamReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -3671,9 +3671,7 @@ private int skipCoalescedText(int i)
private int skipTokenText(int i)
throws XMLStreamException
{
/* Fairly easy; except for potential to have entities
* expand to some crap?
*/
// Fairly easy; except for potential to have entities expand to some crap?
int count = 0;

main_loop:
Expand All @@ -3690,14 +3688,12 @@ && resolveSimpleEntity(true) != 0) {
;
} else {
i = fullyResolveEntity(true);
/* Either way, it's just fine; we don't care about
* returned single-char value.
*/
// Either way, it's just fine; we don't care about
// returned single-char value.
}
} else {
/* Can only skip character entities; others need to
* be returned separately.
*/
// Can only skip character entities; others need to
// be returned separately.
if (resolveCharOnlyEntity(true) == 0) {
/* Now points to the char after ampersand, and we need
* to return the ampersand itself
Expand Down
36 changes: 15 additions & 21 deletions src/main/java/com/ctc/wstx/sr/StreamScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -1240,13 +1240,11 @@ protected int resolveSimpleEntity(boolean checkStd)
return value;
}

/* If we ran out of input, need to just fall back, gets
* resolved via 'full' resolution mechanism.
*/
// If we ran out of input, need to just fall back, gets
// resolved via 'full' resolution mechanism.
} else if (checkStd) {
/* Caller may not want to resolve these quite yet...
* (when it wants separate events for non-char entities)
*/
// Caller may not want to resolve these quite yet...
// (when it wants separate events for non-char entities)
if (c == 'a') { // amp or apos?
c = buf[ptr++];

Expand Down Expand Up @@ -1420,14 +1418,12 @@ protected EntityDecl resolveNonCharEntity()
int avail = mInputEnd - mInputPtr;
if (avail < 6) {
// split entity, or buffer boundary
/* Don't want to lose leading '&' (in case we can not expand
* the entity), so let's push it back first
*/
// Don't want to lose leading '&' (in case we can not expand
// the entity), so let's push it back first
--mInputPtr;

/* Shortest valid reference would be 3 chars ('&a;'); which
* would only be legal from an expanded entity...
*/
// Shortest valid reference would be 3 chars ('&a;'); which
// would only be legal from an expanded entity...
if (!ensureInput(6)) {
avail = inputInBuffer();
if (avail < 3) {
Expand Down Expand Up @@ -1537,10 +1533,9 @@ protected int fullyResolveEntity(boolean allowExt)

// Perhaps we have a pre-defined char reference?
c = id.charAt(0);
/*
* 16-May-2004, TSa: Should custom entities (or ones defined in int/ext subset) override
* pre-defined settings for these?
*/

// 16-May-2004, TSa: Should custom entities (or ones defined in int/ext subset) override
// pre-defined settings for these?
char d = CHAR_NULL;
if (c == 'a') { // amp or apos?
if (id.equals("amp")) {
Expand Down Expand Up @@ -2325,11 +2320,11 @@ private int resolveCharEnt(StringBuffer originalCharacters)
{
int value = 0;
char c = getNextChar(SUFFIX_IN_ENTITY_REF);

if (originalCharacters != null) {
originalCharacters.append(c);
}

if (c == 'x') { // hex
while (true) {
c = (mInputPtr < mInputEnd) ? mInputBuffer[mInputPtr++]
Expand Down Expand Up @@ -2386,9 +2381,8 @@ private int resolveCharEnt(StringBuffer originalCharacters)
private final void validateChar(int value)
throws XMLStreamException
{
/* 24-Jan-2006, TSa: Ok, "high" Unicode chars are problematic,
* need to be reported by a surrogate pair..
*/
// 24-Jan-2006, TSa: Ok, "high" Unicode chars are problematic,
// need to be reported by a surrogate pair..
if (value >= 0xD800) {
if (value < 0xE000) { // no surrogates via entity expansion
reportIllegalChar(value);
Expand Down

0 comments on commit 4a83100

Please sign in to comment.