Skip to content

Commit

Permalink
Fix inconventionally placed auto increment/decrement operators
Browse files Browse the repository at this point in the history
  • Loading branch information
spannm committed Feb 18, 2024
1 parent ca6ef2e commit b750238
Show file tree
Hide file tree
Showing 26 changed files with 77 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/github/spannm/jackcess/impl/ByteUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ public void trimTrailing(byte minTrimCode, byte maxTrimCode) {
while (idx >= 0) {
int val = asUnsignedByte(get(idx));
if (val >= minTrim && val <= maxTrim) {
--idx;
idx--;
} else {
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/github/spannm/jackcess/impl/ColumnImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1484,11 +1484,11 @@ String decodeTextValue(byte[] data) {
decodeTextSegment(data, dataStart, dataEnd, inCompressedMode,
textBuf);
inCompressedMode = !inCompressedMode;
++dataEnd;
dataEnd++;
dataStart = dataEnd;

} else {
++dataEnd;
dataEnd++;
}
}
// handle last segment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,19 @@ public static boolean isAttachmentColumn(Table typeObjTable) {
for (Column col : typeCols) {
switch (col.getType()) {
case TEXT:
++numText;
numText++;
break;
case LONG:
++numLong;
numLong++;
break;
case SHORT_DATE_TIME:
++numDate;
numDate++;
break;
case OLE:
++numOle;
numOle++;
break;
case MEMO:
++numMemo;
numMemo++;
break;
default:
// ignore
Expand All @@ -168,10 +168,10 @@ public static boolean isVersionHistoryColumn(Table typeObjTable) {
for (Column col : typeCols) {
switch (col.getType()) {
case SHORT_DATE_TIME:
++numDate;
numDate++;
break;
case MEMO:
++numMemo;
numMemo++;
break;
default:
// ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ private int moveSomeRows(int numRows, boolean moveForward)
throws IOException {
int numMovedRows = 0;
while (numMovedRows < numRows && moveToAnotherRow(moveForward)) {
++numMovedRows;
numMovedRows++;
}
return numMovedRows;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void writeNonNullIndexTextValue(
}

if (ch.isSignificantChar()) {
++sigCharCount;
sigCharCount++;
// significant chars never have extra bytes
continue;
}
Expand Down Expand Up @@ -243,7 +243,7 @@ public void writeFillNibbles(int length, byte b) {

if (!nextIsHi()) {
writeLowNibble(b);
--length;
length--;
}

if (length > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ void writeNonNullIndexTextValue(
bout.write(bytes);

// only increment the charOffset for chars with inline codes
++charOffset;
charOffset++;
}

if (ch.getType() == Type.SIMPLE) {
Expand Down Expand Up @@ -666,7 +666,7 @@ protected static String toIndexCharSequence(Object value)
// trailing spaces are ignored for text index entries
if (len > 0 && str.charAt(len - 1) == ' ') {
do {
--len;
len--;
} while (len > 0 && str.charAt(len - 1) == ' ');

str = str.substring(0, len);
Expand Down Expand Up @@ -785,7 +785,7 @@ private static void writeCrazyCodes(ByteStream crazyCodes, ByteStream bout) {
nextByte <<= (2 - idx) * 2;
curByte |= nextByte;

++idx;
idx++;
if (idx == 3) {
// write current byte and reset
bout.write(curByte);
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/io/github/spannm/jackcess/impl/IndexData.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public enum EntryType {
int len = Math.min(left.length, right.length);
int pos = 0;
while (pos < len && left[pos] == right[pos]) {
++pos;
pos++;
}
if (pos < len) {
return ByteUtil.asUnsignedByte(left[pos]) < ByteUtil.asUnsignedByte(right[pos]) ? -1 : 1;
Expand Down Expand Up @@ -248,7 +248,7 @@ void addIndex(Index index) {
if (!_indexes.get(pos - 1).isForeignKey()) {
break;
}
--pos;
pos--;
}
_indexes.add(pos, index);

Expand Down Expand Up @@ -376,7 +376,7 @@ public int getEntryCount() throws IOException {
Entry endEntry = cursor.getLastEntry();
int count = 0;
while (!endEntry.equals(cursor.getNextEntry())) {
++count;
count++;
}
return count;
}
Expand Down Expand Up @@ -875,7 +875,7 @@ public Object[] constructPartialIndexRowFromEntry(Object filler, Object... value
Object[] idxRow = new Object[getTable().getColumnCount()];
for (ColumnDescriptor col : _columns) {
idxRow[col.getColumnIndex()] = valIdx < values.length ? values[valIdx] : filler;
++valIdx;
valIdx++;
}
return idxRow;
}
Expand Down Expand Up @@ -935,7 +935,7 @@ public Object[] constructPartialIndexRow(Object filler, Map<String, ?> row) {
}
break;
}
++numCols;
numCols++;
}

// fill in the row with either the prefix values or the filler value, as
Expand All @@ -944,7 +944,7 @@ public Object[] constructPartialIndexRow(Object filler, Map<String, ?> row) {
int valIdx = 0;
for (ColumnDescriptor col : _columns) {
idxRow[col.getColumnIndex()] = valIdx < numCols ? row.get(col.getName()) : filler;
++valIdx;
valIdx++;
}
return idxRow;
}
Expand Down Expand Up @@ -1150,7 +1150,7 @@ private int countNullValues(Object[] values) {
for (ColumnDescriptor col : _columns) {
Object value = values[col.getColumnIndex()];
if (col.isNullValue(value)) {
++nullCount;
nullCount++;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ public CacheDataPage findCacheDataPage(Entry e) throws IOException {
idx = missingIndexToInsertionPoint(idx);
if (idx == extra._entryView.size()) {
// just move to last child page
--idx;
idx--;
}
}

Expand Down Expand Up @@ -844,7 +844,7 @@ private static byte[] findCommonPrefix(Entry e1, Entry e2) {

int len = 0;
while (len < maxLen && b1[len] == b2[len]) {
++len;
len++;
}

if (len < prefix.length) {
Expand Down Expand Up @@ -1190,7 +1190,7 @@ private List<Entry> getEntries() {
public int size() {
int size = getEntries().size();
if (hasChildTail()) {
++size;
size++;
}
return size;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/spannm/jackcess/impl/OleUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ private static ContentImpl createSimplePackageContent(
// ignore
}

++strNum;
strNum++;
}

return new SimplePackageContentImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ private void writePropertyValues(
}
}

++nameIdx;
nameIdx++;
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/io/github/spannm/jackcess/impl/TableImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,7 @@ private Map.Entry<Integer, Integer> addUsageMaps(
ByteUtil.clearRange(umapBuf, dataOffset, rowStart + umapRowLength);

rowStart -= umapRowLength;
++umapRowNum;
umapRowNum++;
}

// finish the page
Expand Down Expand Up @@ -1773,7 +1773,7 @@ private static void createUsageMapDefinitionBuffer(TableCreator creator)
if (umapType == 1 && umapPageNumber != colState.getUmapPageNumber()) {
// we want to force both usage maps for a column to be on the same
// data page, so just discard the previous one we wrote
--i;
i--;
umapType = 0;
}

Expand All @@ -1789,7 +1789,7 @@ private static void createUsageMapDefinitionBuffer(TableCreator creator)

rowStart -= umapRowLength;
freeSpace -= umapSpaceUsage;
++umapRowNum;
umapRowNum++;

if (freeSpace <= umapSpaceUsage || i == umapNum - 1) {
// finish current page
Expand Down Expand Up @@ -2007,7 +2007,7 @@ private Object[] asRow(Map<String, ?> rowMap, Object defaultValue,
boolean returnRowId) {
int len = _columns.size();
if (returnRowId) {
++len;
len++;
}
Object[] row = new Object[len];
if (defaultValue != null) {
Expand Down Expand Up @@ -2134,7 +2134,7 @@ protected List<? extends Object[]> addRows(List<? extends Object[]> rows,

// fill in autonumbers
handleAutoNumbersForAdd(row, writeRowState);
++autoNumAssignCount;
autoNumAssignCount++;

// need to assign calculated values after all the other fields are
// filled in but before final validation
Expand Down Expand Up @@ -2197,7 +2197,7 @@ protected List<? extends Object[]> addRows(List<? extends Object[]> rows,
row[numCols] = rowId;
}

++updateCount;
updateCount++;
}

writeDataPage(dataPage, pageNumber);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/github/spannm/jackcess/impl/UsageMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ protected int getPrevPageNumber(int curPage) {
}

protected int getPrevBitIndex(int curIndex) {
--curIndex;
curIndex--;
while (curIndex >= 0 && !_pageNumbers.get(curIndex)) {
--curIndex;
curIndex--;
}
return curIndex;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ protected Value evalVar(EvalContext ctx, Value[] params) {
int q2 = getQuarter(ldt2);
while (y2 > y1) {
q2 += 4;
--y2;
y2--;
}
result = q2 - q1;
} else if (intv.equalsIgnoreCase(INTV_MONTH)) {
Expand All @@ -236,7 +236,7 @@ protected Value evalVar(EvalContext ctx, Value[] params) {
int m2 = ldt2.getMonthValue();
while (y2 > y1) {
m2 += 12;
--y2;
y2--;
}
result = m2 - m1;
} else if (intv.equalsIgnoreCase(INTV_DAY_OF_YEAR)
Expand All @@ -254,7 +254,7 @@ protected Value evalVar(EvalContext ctx, Value[] params) {
int w2 = ldt2.get(weekFields.weekOfWeekBasedYear());
int y2 = ldt2.get(weekFields.weekBasedYear());
while (y2 > y1) {
--y2;
y2--;
w2 += weeksInYear(y2, weekFields);
}
result = w2 - w1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public static double calculateRate(double nper, double pmt, double pv, double fv

y0 = y1;
y1 = y;
++i;
i++;
}

return rate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected Value evalVar(EvalContext ctx, Value[] params) {
if (params.length > 2) {
// 1 based offsets
start = params[0].getAsLongInt(ctx) - 1;
++idx;
idx++;
}
Value param1 = params[idx++];
if (param1.isNull()) {
Expand Down Expand Up @@ -144,7 +144,7 @@ protected Value evalVar(EvalContext ctx, Value[] params) {
// 1 based offsets
return ValueSupport.toValue(start + 1);
}
++start;
start++;
}
return ValueSupport.ZERO_VAL;
}
Expand Down Expand Up @@ -179,7 +179,7 @@ protected Value evalVar(EvalContext ctx, Value[] params) {
start = s1Len;
}
// 1 based offsets
--start;
start--;
}
boolean ignoreCase = getIgnoreCase(ctx, params, 3);
start = Math.min(s1Len - s2Len, start - s2Len + 1);
Expand All @@ -188,7 +188,7 @@ protected Value evalVar(EvalContext ctx, Value[] params) {
// 1 based offsets
return ValueSupport.toValue(start + 1);
}
--start;
start--;
}
return ValueSupport.ZERO_VAL;
}
Expand Down Expand Up @@ -322,7 +322,7 @@ protected Value evalVar(EvalContext ctx, Value[] params) {
if (matchCount < count
&& str.regionMatches(ignoreCase, i, searchStr, 0, searchLen)) {
result.append(replStr);
++matchCount;
matchCount++;
i += searchLen - 1;
} else {
result.append(str.charAt(i));
Expand Down Expand Up @@ -451,12 +451,12 @@ private static String trim(String str, boolean doLeft, boolean doRight) {

if (doLeft) {
while (start < end && str.charAt(start) == ' ') {
++start;
start++;
}
}
if (doRight) {
while (start < end && str.charAt(end - 1) == ' ') {
--end;
end--;
}
}
return str.substring(start, end);
Expand Down
Loading

0 comments on commit b750238

Please sign in to comment.