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

cleanup - use conditions for loops instead of breaks

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