cleanup: use Java-style array declaration

This commit is contained in:
P0nk
2021-04-08 07:17:03 +02:00
parent ed5a444753
commit 5e3b346053
41 changed files with 163 additions and 182 deletions

View File

@@ -21,21 +21,13 @@
*/
package provider.wz;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import provider.MapleData;
import provider.MapleDataDirectoryEntry;
import provider.MapleDataFileEntry;
import provider.MapleDataProvider;
import tools.data.input.GenericLittleEndianAccessor;
import tools.data.input.GenericSeekableLittleEndianAccessor;
import tools.data.input.InputStreamByteStream;
import tools.data.input.LittleEndianAccessor;
import tools.data.input.RandomAccessByteStream;
import tools.data.input.SeekableLittleEndianAccessor;
import tools.data.input.*;
import java.io.*;
public class WZFile implements MapleDataProvider {
static {
@@ -116,7 +108,7 @@ public class WZFile implements MapleDataProvider {
}
public WZIMGFile getImgFile(String path) throws IOException {
String segments[] = path.split("/");
String[] segments = path.split("/");
WZDirectoryEntry dir = root;
for (int x = 0; x < segments.length - 1; x++) {
dir = (WZDirectoryEntry) dir.getEntry(segments[x]);

View File

@@ -21,12 +21,13 @@
*/
package provider.wz;
import provider.MapleData;
import provider.MapleDataEntity;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import provider.MapleData;
import provider.MapleDataEntity;
public class WZIMGEntry implements MapleData {
private String name;
@@ -56,7 +57,7 @@ public class WZIMGEntry implements MapleData {
@Override
public MapleData getChildByPath(String path) {
String segments[] = path.split("/");
String[] segments = path.split("/");
if (segments[0].equals("..")) {
return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
}

View File

@@ -21,15 +21,16 @@
*/
package provider.wz;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import tools.data.input.LittleEndianAccessor;
import tools.data.input.SeekableLittleEndianAccessor;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import tools.data.input.LittleEndianAccessor;
import tools.data.input.SeekableLittleEndianAccessor;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
/*
* Ported Code, see WZFile.java for more info
@@ -108,7 +109,7 @@ public class WZTool {
if (strLength < 0) {
return "";
}
byte str[] = new byte[strLength * 2];
byte[] str = new byte[strLength * 2];
for (int i = 0; i < strLength * 2; i++) {
str[i] = llea.readByte();
}
@@ -122,7 +123,7 @@ public class WZTool {
if (strLength < 0) {
return "";
}
byte str[] = new byte[strLength];
byte[] str = new byte[strLength];
for (int i = 0; i < strLength; i++) {
str[i] = llea.readByte();
}

View File

@@ -22,23 +22,24 @@
package provider.wz;
import constants.game.GameConstants;
import java.awt.Point;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import provider.MapleData;
import provider.MapleDataEntity;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.awt.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import provider.MapleData;
import provider.MapleDataEntity;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class XMLDomMapleData implements MapleData {
private Node node;
@@ -66,7 +67,7 @@ public class XMLDomMapleData implements MapleData {
@Override
public synchronized MapleData getChildByPath(String path) { // the whole XML reading system seems susceptible to give nulls on strenuous read scenarios
String segments[] = path.split("/");
String[] segments = path.split("/");
if (segments[0].equals("..")) {
return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
}