Skip to content

Commit e1e0cb5

Browse files
authored
Merge pull request #30 from DevFactory/release/for_loop_stop_conditions_should_be_invariant
Fixing squid: ForLoopCounterChangedCheck "for" loop stop conditions should be invariant …
2 parents f8bf6e0 + 49ff3b4 commit e1e0cb5

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

geonetworking/src/main/java/net/gcdc/BtpUdpClient.java

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,42 +61,33 @@ public static void main(String[] args) throws IOException {
6161
hasEthernetHeader = true;
6262
MacAddress macAddress = new MacAddress(0);
6363

64-
for (int arg = 0; arg < args.length; arg++) {
64+
for (int arg = 0; arg < args.length; arg += 2) {
6565
if (args[arg].startsWith("--local-udp2eth-port")) {
66-
arg++;
67-
localUdp2EthPort = Integer.parseInt(args[arg]);
66+
localUdp2EthPort = Integer.parseInt(args[arg + 1]);
6867
} else if (args[arg].startsWith("--remote-udp2eth-address")) {
69-
arg++;
70-
String[] hostPort = args[arg].split(":");
68+
String[] hostPort = args[arg + 1].split(":");
7169
if (hostPort.length != 2) { System.err.println("Bad udp2eth host:port.\n" + usage); System.exit(1); }
7270
remoteUdp2EthAddress = new InetSocketAddress(hostPort[0], Integer.parseInt(hostPort[1]));
7371
} else if (args[arg].startsWith("--local-data-port")) {
74-
arg++;
75-
localDataPort = Integer.parseInt(args[arg]);
72+
localDataPort = Integer.parseInt(args[arg + 1]);
7673
} else if (args[arg].startsWith("--remote-data-address")) {
77-
arg++;
78-
String[] hostPort = args[arg].split(":");
74+
String[] hostPort = args[arg + 1].split(":");
7975
if (hostPort.length != 2) { System.err.println("Bad DATA host:port.\n" + usage); System.exit(1); }
8076
remoteDataAddress = new InetSocketAddress(hostPort[0], Integer.parseInt(hostPort[1]));
8177
} else if (args[arg].startsWith("--local-data-cam-port")) {
82-
arg++;
83-
localDataCamPort = Integer.parseInt(args[arg]);
78+
localDataCamPort = Integer.parseInt(args[arg + 1]);
8479
} else if (args[arg].startsWith("--remote-data-cam-address")) {
85-
arg++;
86-
String[] hostPort = args[arg].split(":");
80+
String[] hostPort = args[arg + 1].split(":");
8781
if (hostPort.length != 2) { System.err.println("Bad DATA host:port.\n" + usage); System.exit(1); }
8882
remoteDataCamAddress = new InetSocketAddress(hostPort[0], Integer.parseInt(hostPort[1]));
8983
} else if (args[arg].startsWith("--local-data-iclcm-port")) {
90-
arg++;
91-
localDataIclcmPort = Integer.parseInt(args[arg]);
84+
localDataIclcmPort = Integer.parseInt(args[arg + 1]);
9285
} else if (args[arg].startsWith("--remote-data-iclcm-address")) {
93-
arg++;
94-
String[] hostPort = args[arg].split(":");
86+
String[] hostPort = args[arg + 1].split(":");
9587
if (hostPort.length != 2) { System.err.println("Bad DATA host:port.\n" + usage); System.exit(1); }
9688
remoteDataIclcmAddress = new InetSocketAddress(hostPort[0], Integer.parseInt(hostPort[1]));
9789
} else if (args[arg].startsWith("--position")) {
98-
arg++;
99-
String[] latLon = args[arg].split(",");
90+
String[] latLon = args[arg + 1].split(",");
10091
if (latLon.length != 2) { System.err.println("Bad lat,lon.\n" + usage); System.exit(1); }
10192
final double lat = Double.parseDouble(latLon[0]);
10293
final double lon = Double.parseDouble(latLon[1]);
@@ -109,14 +100,12 @@ public static void main(String[] args) throws IOException {
109100
}
110101
};
111102
} else if (args[arg].startsWith("--gpsd-server")) {
112-
arg++;
113-
String[] hostPort = args[arg].split(":");
103+
String[] hostPort = args[arg + 1].split(":");
114104
if (hostPort.length != 2) { System.err.println("Bad gpsd host:port.\n" + usage); System.exit(1); }
115105
positionProvider = new GpsdClient(
116106
new InetSocketAddress(hostPort[0], Integer.parseInt(hostPort[1]))).startClient();
117107
} else if (args[arg].startsWith("--mac-address")) {
118-
arg++;
119-
macAddress = new MacAddress(MacAddress.parseFromString(args[arg]));
108+
macAddress = new MacAddress(MacAddress.parseFromString(args[arg + 1]));
120109
} else {
121110
throw new IllegalArgumentException("Unrecognized argument: " + args[arg]);
122111
}

0 commit comments

Comments
 (0)