提交 ba4c7216 authored 作者: Jacek Ławrynowicz's avatar Jacek Ławrynowicz

cleanup - use conditions for loops instead of breaks

上级 e38cd27e
...@@ -101,10 +101,7 @@ public class StreamStore { ...@@ -101,10 +101,7 @@ public class StreamStore {
ByteArrayOutputStream id = new ByteArrayOutputStream(); ByteArrayOutputStream id = new ByteArrayOutputStream();
int level = 0; int level = 0;
try { try {
while (true) { while (!put(id, in, level)) {
if (put(id, in, level)) {
break;
}
if (id.size() > maxBlockSize / 2) { if (id.size() > maxBlockSize / 2) {
id = putIndirectId(id); id = putIndirectId(id);
level++; level++;
......
...@@ -584,10 +584,7 @@ public class ValueDataType implements DataType { ...@@ -584,10 +584,7 @@ public class ValueDataType implements DataType {
readVarInt(buff), readVarInt(buff),
readVarInt(buff)); readVarInt(buff));
} }
while (true) { while (buff.get() != 0) {
if (buff.get() == 0) {
break;
}
Object[] o = new Object[columns]; Object[] o = new Object[columns];
for (int i = 0; i < columns; i++) { for (int i = 0; i < columns; i++) {
o[i] = ((Value) readValue(buff)).getObject(); o[i] = ((Value) readValue(buff)).getObject();
......
...@@ -870,10 +870,7 @@ public class Data { ...@@ -870,10 +870,7 @@ public class Data {
for (int i = 0; i < columns; i++) { for (int i = 0; i < columns; i++) {
rs.addColumn(readString(), readVarInt(), readVarInt(), readVarInt()); rs.addColumn(readString(), readVarInt(), readVarInt(), readVarInt());
} }
while (true) { while (readByte() != 0) {
if (readByte() == 0) {
break;
}
Object[] o = new Object[columns]; Object[] o = new Object[columns];
for (int i = 0; i < columns; i++) { for (int i = 0; i < columns; i++) {
o[i] = readValue().getObject(); o[i] = readValue().getObject();
......
...@@ -455,15 +455,12 @@ public class Column { ...@@ -455,15 +455,12 @@ public class Column {
originalSQL = "INT"; originalSQL = "INT";
} }
String sequenceName; String sequenceName;
while (true) { do {
ValueUuid uuid = ValueUuid.getNewRandom(); ValueUuid uuid = ValueUuid.getNewRandom();
String s = uuid.getString(); String s = uuid.getString();
s = StringUtils.toUpperEnglish(s.replace('-', '_')); s = StringUtils.toUpperEnglish(s.replace('-', '_'));
sequenceName = "SYSTEM_SEQUENCE_" + s; sequenceName = "SYSTEM_SEQUENCE_" + s;
if (schema.findSequence(sequenceName) == null) { } while (schema.findSequence(sequenceName) != null);
break;
}
}
Sequence seq = new Sequence(schema, id, sequenceName, start, increment); Sequence seq = new Sequence(schema, id, sequenceName, start, increment);
seq.setTemporary(temporary); seq.setTemporary(temporary);
session.getDatabase().addSchemaObject(session, seq); session.getDatabase().addSchemaObject(session, seq);
......
...@@ -493,12 +493,9 @@ public class Csv implements SimpleRowSource { ...@@ -493,12 +493,9 @@ public class Csv implements SimpleRowSource {
} else if (lineComment != 0 && ch == lineComment) { } else if (lineComment != 0 && ch == lineComment) {
// comment until end of line // comment until end of line
inputBufferStart = -1; inputBufferStart = -1;
while (true) { do {
ch = readChar(); ch = readChar();
if (ch == '\n' || ch < 0 || ch == '\r') { } while (ch != '\n' && ch >= 0 && ch != '\r');
break;
}
}
endOfLine = true; endOfLine = true;
return null; return null;
} else { } else {
......
...@@ -668,10 +668,7 @@ public class Transfer { ...@@ -668,10 +668,7 @@ public class Transfer {
for (int i = 0; i < columns; i++) { for (int i = 0; i < columns; i++) {
rs.addColumn(readString(), readInt(), readInt(), readInt()); rs.addColumn(readString(), readInt(), readInt(), readInt());
} }
while (true) { while (readBoolean()) {
if (!readBoolean()) {
break;
}
Object[] o = new Object[columns]; Object[] o = new Object[columns];
for (int i = 0; i < columns; i++) { for (int i = 0; i < columns; i++) {
o[i] = readValue().getObject(); o[i] = readValue().getObject();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论