0

- Resolved all Eclipse warnings. The only compiler warning left is

sun.misc.Perf-related.
- Fixed a bug where menu.lst in baseq2 was not picked up. The order it
checks is now the user folder, then baseq2, then the pak files.
- Fixed a bug where it would not find all of the skins for a model.
This commit is contained in:
Ethan Lee
2012-02-07 03:31:09 -05:00
parent eac56b4bfd
commit 236b34ef67
13 changed files with 95 additions and 98 deletions

View File

@@ -664,7 +664,7 @@ public class Key extends Globals {
} }
private static void printCompletions(String type, Vector compl) { private static void printCompletions(String type, Vector<String> compl) {
Com.Printf(type); Com.Printf(type);
for (int i = 0; i < compl.size(); i++) { for (int i = 0; i < compl.size(); i++) {
Com.Printf((String)compl.get(i) + " "); Com.Printf((String)compl.get(i) + " ");
@@ -683,8 +683,8 @@ public class Key extends Globals {
String s = new String(key_lines[edit_line], start, end-start); String s = new String(key_lines[edit_line], start, end-start);
Vector cmds = Cmd.CompleteCommand(s); Vector<String> cmds = Cmd.CompleteCommand(s);
Vector vars = Cvar.CompleteVariable(s); Vector<String> vars = Cvar.CompleteVariable(s);
int c = cmds.size(); int c = cmds.size();
int v = vars.size(); int v = vars.size();

View File

@@ -2172,16 +2172,11 @@ public final class Menu extends Key {
try { try {
f = new QuakeFile(name, "r"); f = new QuakeFile(name, "r");
if (f == null) { String str = f.readString();
m_savestrings[i] = "<EMPTY>"; if (str != null)
m_savevalid[i] = false; m_savestrings[i] = str;
} else { f.close();
String str = f.readString(); m_savevalid[i] = true;
if (str != null)
m_savestrings[i] = str;
f.close();
m_savevalid[i] = true;
}
} catch (Exception e) { } catch (Exception e) {
m_savestrings[i] = "<EMPTY>"; m_savestrings[i] = "<EMPTY>";
m_savevalid[i] = false; m_savevalid[i] = false;
@@ -2707,12 +2702,24 @@ public final class Menu extends Key {
*/ */
mapsname = FS.Gamedir() + "/maps.lst"; mapsname = FS.Gamedir() + "/maps.lst";
// Check user dir first (default ~/.lwjake2)
if ((fp = Lib.fopen(mapsname, "r")) == null) { if ((fp = Lib.fopen(mapsname, "r")) == null) {
buffer = FS.LoadFile("maps.lst"); // Check base dir first (baseq2 folder)
if (buffer == null) mapsname = FS.BaseGamedir() + "/maps.lst";
//if ((length = FS_LoadFile("maps.lst", (Object *) & buffer)) if ((fp = Lib.fopen(mapsname, "r")) == null) {
// == -1) // Open the pak's maplist
Com.Error(ERR_DROP, "couldn't find maps.lst\n"); buffer = FS.LoadFile("maps.lst");
if (buffer == null)
Com.Error(ERR_DROP, "couldn't find maps.lst\n");
} else {
try {
int len = (int) fp.length();
buffer = new byte[len];
fp.readFully(buffer);
} catch (Exception e) {
Com.Error(ERR_DROP, "couldn't load maps.lst\n");
}
}
} else { } else {
try { try {
int len = (int) fp.length(); int len = (int) fp.length();
@@ -3804,18 +3811,12 @@ public final class Menu extends Key {
pcxnames = FS.ListFiles(scratch, 0, 0); pcxnames = FS.ListFiles(scratch, 0, 0);
npcxfiles = pcxnames.length; npcxfiles = pcxnames.length;
if (pcxnames == null) {
dirnames[i] = null;
continue;
}
// count valid skins, which consist of a skin with a matching "_i" // count valid skins, which consist of a skin with a matching "_i"
// icon // icon
for (k = 0; k < npcxfiles - 1; k++) { for (k = 0; k < npcxfiles - 1; k++) {
if (!pcxnames[k].endsWith("_i.pcx")) { if (!pcxnames[k].endsWith("_i.pcx")) {
//if (!strstr(pcxnames[k], "_i.pcx")) { //if (!strstr(pcxnames[k], "_i.pcx")) {
if (IconOfSkinExists(pcxnames[k], pcxnames, npcxfiles - 1)) { if (IconOfSkinExists(pcxnames[k], pcxnames, npcxfiles)) {
nskins++; nskins++;
} }
} }
@@ -3828,10 +3829,10 @@ public final class Menu extends Key {
//memset(skinnames, 0, sizeof(String) * (nskins + 1)); //memset(skinnames, 0, sizeof(String) * (nskins + 1));
// copy the valid skins // copy the valid skins
for (s = 0, k = 0; k < npcxfiles - 1; k++) { for (s = 0, k = 0; k < npcxfiles; k++) {
if (pcxnames[k].indexOf("_i.pcx") < 0) { if (pcxnames[k].indexOf("_i.pcx") < 0) {
if (IconOfSkinExists(pcxnames[k], pcxnames, npcxfiles - 1)) { if (IconOfSkinExists(pcxnames[k], pcxnames, npcxfiles)) {
a = pcxnames[k].lastIndexOf('/'); a = pcxnames[k].lastIndexOf('/');
b = pcxnames[k].lastIndexOf('\\'); b = pcxnames[k].lastIndexOf('\\');
@@ -3878,9 +3879,7 @@ public final class Menu extends Key {
} }
static int pmicmpfnc(Object _a, Object _b) { static int pmicmpfnc(playermodelinfo_s a, playermodelinfo_s b) {
playermodelinfo_s a = (playermodelinfo_s) _a;
playermodelinfo_s b = (playermodelinfo_s) _b;
/* /*
* * sort by male, female, then alphabetical * * sort by male, female, then alphabetical
@@ -3938,8 +3937,8 @@ public final class Menu extends Key {
} }
//qsort(s_pmi, s_numplayermodels, sizeof(s_pmi[0]), pmicmpfnc); //qsort(s_pmi, s_numplayermodels, sizeof(s_pmi[0]), pmicmpfnc);
Arrays.sort(s_pmi, 0, s_numplayermodels, new Comparator() { Arrays.sort(s_pmi, 0, s_numplayermodels, new Comparator<playermodelinfo_s>() {
public int compare(Object o1, Object o2) { public int compare(playermodelinfo_s o1, playermodelinfo_s o2) {
return pmicmpfnc(o1, o2); return pmicmpfnc(o1, o2);
} }
}); });

View File

@@ -162,13 +162,11 @@ public final class Cmd {
private static char temporary[] = new char[Defines.MAX_STRING_CHARS]; private static char temporary[] = new char[Defines.MAX_STRING_CHARS];
public static Comparator PlayerSort = new Comparator() { public static Comparator<Integer> PlayerSort = new Comparator<Integer>() {
public int compare(Object o1, Object o2) { public int compare(Integer o1, Integer o2) {
int anum = ((Integer) o1).intValue();
int bnum = ((Integer) o2).intValue();
int anum1 = GameBase.game.clients[anum].ps.stats[Defines.STAT_FRAGS]; int anum1 = GameBase.game.clients[o1].ps.stats[Defines.STAT_FRAGS];
int bnum1 = GameBase.game.clients[bnum].ps.stats[Defines.STAT_FRAGS]; int bnum1 = GameBase.game.clients[o2].ps.stats[Defines.STAT_FRAGS];
if (anum1 < bnum1) if (anum1 < bnum1)
return -1; return -1;
@@ -1183,8 +1181,8 @@ public final class Cmd {
/** /**
* Cmd_CompleteCommand. * Cmd_CompleteCommand.
*/ */
public static Vector CompleteCommand(String partial) { public static Vector<String> CompleteCommand(String partial) {
Vector cmds = new Vector(); Vector<String> cmds = new Vector<String>();
// check for match // check for match
for (cmd_function_t cmd = cmd_functions; cmd != null; cmd = cmd.next) for (cmd_function_t cmd = cmd_functions; cmd != null; cmd = cmd.next)

View File

@@ -232,10 +232,7 @@ public class GameSave {
if (!autosave) if (!autosave)
PlayerClient.SaveClientData(); PlayerClient.SaveClientData();
f = new QuakeFile(filename, "rw"); f = new QuakeFile(filename, "rw");
if (f == null)
GameBase.gi.error("Couldn't write to " + filename);
GameBase.game.autosaved = autosave; GameBase.game.autosaved = autosave;
GameBase.game.write(f); GameBase.game.write(f);
@@ -247,6 +244,7 @@ public class GameSave {
Lib.fclose(f); Lib.fclose(f);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
GameBase.gi.error("Couldn't write to " + filename);
} }
} }
@@ -284,9 +282,7 @@ public class GameSave {
QuakeFile f; QuakeFile f;
f = new QuakeFile(filename, "rw"); f = new QuakeFile(filename, "rw");
if (f == null)
GameBase.gi.error("Couldn't open for writing: " + filename);
// write out level_locals_t // write out level_locals_t
GameBase.level.write(f); GameBase.level.write(f);
@@ -305,6 +301,7 @@ public class GameSave {
f.close(); f.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
GameBase.gi.error("Couldn't open for writing: " + filename);
} }
} }
@@ -327,9 +324,6 @@ public class GameSave {
QuakeFile f = new QuakeFile(filename, "r"); QuakeFile f = new QuakeFile(filename, "r");
if (f == null)
GameBase.gi.error("Couldn't read level file " + filename);
// wipe all the entities // wipe all the entities
CreateEdicts(); CreateEdicts();
@@ -376,6 +370,7 @@ public class GameSave {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
GameBase.gi.error("Couldn't read level file " + filename);
} }
} }
} }

View File

@@ -75,7 +75,7 @@ public final class FS extends Globals {
int numfiles; int numfiles;
Hashtable files; // with packfile_t entries Hashtable<String, packfile_t> files; // with packfile_t entries
} }
public static String fs_gamedir; public static String fs_gamedir;
@@ -97,7 +97,7 @@ public final class FS extends Globals {
} }
// with filelink_t entries // with filelink_t entries
public static List fs_links = new LinkedList(); public static List<filelink_t> fs_links = new LinkedList<filelink_t>();
public static class searchpath_t { public static class searchpath_t {
String filename; String filename;
@@ -171,8 +171,8 @@ public final class FS extends Globals {
file_from_pak = 0; file_from_pak = 0;
// check for links first // check for links first
for (Iterator it = fs_links.iterator(); it.hasNext();) { for (Iterator<filelink_t> it = fs_links.iterator(); it.hasNext();) {
link = (filelink_t) it.next(); link = it.next();
if (filename.regionMatches(0, link.from, 0, link.fromlength)) { if (filename.regionMatches(0, link.from, 0, link.fromlength)) {
netpath = link.to + filename.substring(link.fromlength); netpath = link.to + filename.substring(link.fromlength);
@@ -193,7 +193,7 @@ public final class FS extends Globals {
// look through all the pak file elements // look through all the pak file elements
pak = search.pack; pak = search.pack;
filename = filename.toLowerCase(); filename = filename.toLowerCase();
packfile_t entry = (packfile_t) pak.files.get(filename); packfile_t entry = pak.files.get(filename);
if (entry != null) { if (entry != null) {
// found it! // found it!
@@ -244,8 +244,8 @@ public final class FS extends Globals {
file_from_pak = 0; file_from_pak = 0;
// check for links first // check for links first
for (Iterator it = fs_links.iterator(); it.hasNext();) { for (Iterator<filelink_t> it = fs_links.iterator(); it.hasNext();) {
link = (filelink_t) it.next(); link = it.next();
// if (!strncmp (filename, link->from, link->fromlength)) // if (!strncmp (filename, link->from, link->fromlength))
if (filename.regionMatches(0, link.from, 0, link.fromlength)) { if (filename.regionMatches(0, link.from, 0, link.fromlength)) {
@@ -268,7 +268,7 @@ public final class FS extends Globals {
// look through all the pak file elements // look through all the pak file elements
pak = search.pack; pak = search.pack;
filename = filename.toLowerCase(); filename = filename.toLowerCase();
packfile_t entry = (packfile_t) pak.files.get(filename); packfile_t entry = pak.files.get(filename);
if (entry != null) { if (entry != null) {
// found it! // found it!
@@ -402,8 +402,8 @@ public final class FS extends Globals {
try { try {
// check for links first // check for links first
for (Iterator it = fs_links.iterator(); it.hasNext();) { for (Iterator<filelink_t> it = fs_links.iterator(); it.hasNext();) {
link = (filelink_t) it.next(); link = it.next();
if (filename.regionMatches(0, link.from, 0, link.fromlength)) { if (filename.regionMatches(0, link.from, 0, link.fromlength)) {
netpath = link.to + filename.substring(link.fromlength); netpath = link.to + filename.substring(link.fromlength);
@@ -430,7 +430,7 @@ public final class FS extends Globals {
// look through all the pak file elements // look through all the pak file elements
pak = search.pack; pak = search.pack;
filename = filename.toLowerCase(); filename = filename.toLowerCase();
packfile_t entry = (packfile_t) pak.files.get(filename); packfile_t entry = pak.files.get(filename);
if (entry != null) { if (entry != null) {
// found it! // found it!
@@ -521,7 +521,7 @@ public final class FS extends Globals {
static pack_t LoadPackFile(String packfile) { static pack_t LoadPackFile(String packfile) {
dpackheader_t header; dpackheader_t header;
Hashtable newfiles; Hashtable<String, packfile_t> newfiles;
RandomAccessFile file; RandomAccessFile file;
int numpackfiles = 0; int numpackfiles = 0;
pack_t pack = null; pack_t pack = null;
@@ -552,7 +552,7 @@ public final class FS extends Globals {
Com.Error(Defines.ERR_FATAL, packfile + " has " + numpackfiles Com.Error(Defines.ERR_FATAL, packfile + " has " + numpackfiles
+ " files"); + " files");
newfiles = new Hashtable(numpackfiles); newfiles = new Hashtable<String, packfile_t>(numpackfiles);
packhandle.position(header.dirofs); packhandle.position(header.dirofs);
@@ -742,8 +742,8 @@ public final class FS extends Globals {
} }
// see if the link already exists // see if the link already exists
for (Iterator it = fs_links.iterator(); it.hasNext();) { for (Iterator<filelink_t> it = fs_links.iterator(); it.hasNext();) {
entry = (filelink_t) it.next(); entry = it.next();
if (entry.from.equals(Cmd.Argv(1))) { if (entry.from.equals(Cmd.Argv(1))) {
if (Cmd.Argv(2).length() < 1) { if (Cmd.Argv(2).length() < 1) {
@@ -770,7 +770,7 @@ public final class FS extends Globals {
* ListFiles * ListFiles
*/ */
public static String[] ListFiles(String findname, int musthave, int canthave) { public static String[] ListFiles(String findname, int musthave, int canthave) {
String[] list = null; String[] list = new String[0];
File[] files = Sys.FindAll(findname, musthave, canthave); File[] files = Sys.FindAll(findname, musthave, canthave);
@@ -810,7 +810,7 @@ public final class FS extends Globals {
dirnames = ListFiles(findname, 0, 0); dirnames = ListFiles(findname, 0, 0);
if (dirnames != null) { if (dirnames.length != 0) {
int index = 0; int index = 0;
for (int i = 0; i < dirnames.length; i++) { for (int i = 0; i < dirnames.length; i++) {
if ((index = dirnames[i].lastIndexOf('/')) > 0) { if ((index = dirnames[i].lastIndexOf('/')) > 0) {
@@ -846,8 +846,8 @@ public final class FS extends Globals {
} }
Com.Printf("\nLinks:\n"); Com.Printf("\nLinks:\n");
for (Iterator it = fs_links.iterator(); it.hasNext();) { for (Iterator<filelink_t> it = fs_links.iterator(); it.hasNext();) {
link = (filelink_t) it.next(); link = it.next();
Com.Printf(link.from + " : " + link.to + '\n'); Com.Printf(link.from + " : " + link.to + '\n');
} }
} }

View File

@@ -21,6 +21,7 @@ package lwjake2.qcommon;
/** /**
* longjmpException is used to replace the setjmp/longjmp code. * longjmpException is used to replace the setjmp/longjmp code.
*/ */
@SuppressWarnings("serial")
public final class longjmpException extends IllegalStateException { public final class longjmpException extends IllegalStateException {
} }

View File

@@ -29,7 +29,7 @@ import java.util.Vector;
*/ */
public class Renderer { public class Renderer {
static Vector drivers = new Vector(1); static Vector<Ref> drivers = new Vector<Ref>(1);
static { static {
try { try {
@@ -62,7 +62,7 @@ public class Renderer {
Ref driver = null; Ref driver = null;
int count = drivers.size(); int count = drivers.size();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
driver = (Ref) drivers.get(i); driver = drivers.get(i);
if (driver.getName().equals(driverName)) { if (driver.getName().equals(driverName)) {
return driver.GetRefAPI(); return driver.GetRefAPI();
} }
@@ -72,11 +72,11 @@ public class Renderer {
} }
public static String getDefaultName() { public static String getDefaultName() {
return (drivers.isEmpty()) ? null : ((Ref) drivers.firstElement()).getName(); return (drivers.isEmpty()) ? null : (drivers.firstElement()).getName();
} }
public static String getPreferedName() { public static String getPreferedName() {
return (drivers.isEmpty()) ? null : ((Ref) drivers.lastElement()).getName(); return (drivers.isEmpty()) ? null : (drivers.lastElement()).getName();
} }
public static String[] getDriverNames() { public static String[] getDriverNames() {
@@ -84,7 +84,7 @@ public class Renderer {
int count = drivers.size(); int count = drivers.size();
String[] names = new String[count]; String[] names = new String[count];
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
names[i] = ((Ref) drivers.get(i)).getName(); names[i] = (drivers.get(i)).getName();
} }
return names; return names;
} }

View File

@@ -69,7 +69,7 @@ public abstract class LWJGLBase {
modes = Display.getAvailableDisplayModes(); modes = Display.getAvailableDisplayModes();
LinkedList l = new LinkedList(); LinkedList<java.awt.DisplayMode> l = new LinkedList<java.awt.DisplayMode>();
l.add(toAwtDisplayMode(oldDisplayMode)); l.add(toAwtDisplayMode(oldDisplayMode));
for (int i = 0; i < modes.length; i++) { for (int i = 0; i < modes.length; i++) {
@@ -109,7 +109,7 @@ public abstract class LWJGLBase {
try { try {
DisplayMode[] modes = Display.getAvailableDisplayModes(); DisplayMode[] modes = Display.getAvailableDisplayModes();
LinkedList l = new LinkedList(); LinkedList<DisplayMode> l = new LinkedList<DisplayMode>();
l.add(oldDisplayMode); l.add(oldDisplayMode);
for (int i = 0; i < modes.length; i++) { for (int i = 0; i < modes.length; i++) {

View File

@@ -34,7 +34,7 @@ public class S {
static Sound impl; static Sound impl;
static cvar_t s_impl; static cvar_t s_impl;
static Vector drivers = new Vector(1); static Vector<Sound> drivers = new Vector<Sound>(1);
/** /**
* Searches for and initializes all known sound drivers. * Searches for and initializes all known sound drivers.
@@ -78,14 +78,14 @@ public class S {
Sound driver = null; Sound driver = null;
int count = drivers.size(); int count = drivers.size();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
driver = (Sound) drivers.get(i); driver = drivers.get(i);
if (driver.getName().equals(driverName)) { if (driver.getName().equals(driverName)) {
impl = driver; impl = driver;
return; return;
} }
} }
// if driver not found use dummy // if driver not found use dummy
impl = (Sound)drivers.lastElement(); impl = drivers.lastElement();
} }
/** /**
@@ -105,7 +105,7 @@ public class S {
// set the last registered driver as default // set the last registered driver as default
String defaultDriver = "dummy"; String defaultDriver = "dummy";
if (drivers.size() > 1){ if (drivers.size() > 1){
defaultDriver = ((Sound)drivers.lastElement()).getName(); defaultDriver = (drivers.lastElement()).getName();
} }
s_impl = Cvar.Get("s_impl", defaultDriver, Defines.CVAR_ARCHIVE); s_impl = Cvar.Get("s_impl", defaultDriver, Defines.CVAR_ARCHIVE);
@@ -203,7 +203,7 @@ public class S {
public static String[] getDriverNames() { public static String[] getDriverNames() {
String[] names = new String[drivers.size()]; String[] names = new String[drivers.size()];
for (int i = 0; i < names.length; i++) { for (int i = 0; i < names.length; i++) {
names[i] = ((Sound)drivers.get(i)).getName(); names[i] = (drivers.get(i)).getName();
} }
return names; return names;
} }

View File

@@ -56,7 +56,7 @@ public class Channel {
private static IntBuffer sources = Lib.newIntBuffer(MAX_CHANNELS); private static IntBuffer sources = Lib.newIntBuffer(MAX_CHANNELS);
// a reference of LWJGLSoundImpl.buffers // a reference of LWJGLSoundImpl.buffers
private static IntBuffer buffers; private static IntBuffer buffers;
private static Map looptable = new Hashtable(MAX_CHANNELS); private static Map<Integer, Channel> looptable = new Hashtable<Integer, Channel>(MAX_CHANNELS);
private static int numChannels; private static int numChannels;
@@ -362,7 +362,7 @@ public class Channel {
sfxcache_t sc; sfxcache_t sc;
int num; int num;
entity_state_t ent; entity_state_t ent;
Object key; int key;
int sound = 0; int sound = 0;
for (int i=0 ; i<Globals.cl.frame.num_entities ; i++) { for (int i=0 ; i<Globals.cl.frame.num_entities ; i++) {
@@ -372,8 +372,8 @@ public class Channel {
if (sound == 0) continue; if (sound == 0) continue;
key = new Integer(ent.number); key = ent.number;
ch = (Channel)looptable.get(key); ch = looptable.get(key);
if (ch != null) { if (ch != null) {
// keep on looping // keep on looping
@@ -410,8 +410,8 @@ public class Channel {
private static void removeUnusedLoopSounds() { private static void removeUnusedLoopSounds() {
Channel ch; Channel ch;
// stop unused loopsounds // stop unused loopsounds
for (Iterator iter = looptable.values().iterator(); iter.hasNext();) { for (Iterator<Channel> iter = looptable.values().iterator(); iter.hasNext();) {
ch = (Channel)iter.next(); ch = iter.next();
if (!ch.autosound) { if (!ch.autosound) {
AL10.alSourceStop(ch.sourceId); AL10.alSourceStop(ch.sourceId);
AL10.alSourcei(ch.sourceId, AL10.AL_LOOPING, AL10.AL_FALSE); AL10.alSourcei(ch.sourceId, AL10.AL_LOOPING, AL10.AL_FALSE);

View File

@@ -20,6 +20,8 @@ package lwjake2.sys;
import sun.misc.Perf; import sun.misc.Perf;
// TODO: Is there an alternative to sun.misc.Perf? - flibit
class HighPrecisionTimer extends Timer { class HighPrecisionTimer extends Timer {
private Perf perf = Perf.getPerf(); private Perf perf = Perf.getPerf();

View File

@@ -545,7 +545,7 @@ public class PrintfFormat {
* @return The formatted String. * @return The formatted String.
*/ */
public String sprintf(Object[] o) { public String sprintf(Object[] o) {
Enumeration e = vFmt.elements(); Enumeration<Object> e = vFmt.elements();
ConversionSpecification cs = null; ConversionSpecification cs = null;
char c = 0; char c = 0;
int i = 0; int i = 0;
@@ -607,7 +607,7 @@ public class PrintfFormat {
* @return the formatted String. * @return the formatted String.
*/ */
public String sprintf() { public String sprintf() {
Enumeration e = vFmt.elements(); Enumeration<Object> e = vFmt.elements();
ConversionSpecification cs = null; ConversionSpecification cs = null;
char c = 0; char c = 0;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
@@ -630,7 +630,7 @@ public class PrintfFormat {
* or S. * or S.
*/ */
public String sprintf(int x) throws IllegalArgumentException { public String sprintf(int x) throws IllegalArgumentException {
Enumeration e = vFmt.elements(); Enumeration<Object> e = vFmt.elements();
ConversionSpecification cs = null; ConversionSpecification cs = null;
char c = 0; char c = 0;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
@@ -655,7 +655,7 @@ public class PrintfFormat {
* or S. * or S.
*/ */
public String sprintf(long x) throws IllegalArgumentException { public String sprintf(long x) throws IllegalArgumentException {
Enumeration e = vFmt.elements(); Enumeration<Object> e = vFmt.elements();
ConversionSpecification cs = null; ConversionSpecification cs = null;
char c = 0; char c = 0;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
@@ -680,7 +680,7 @@ public class PrintfFormat {
* d, d, x, X, or o. * d, d, x, X, or o.
*/ */
public String sprintf(double x) throws IllegalArgumentException { public String sprintf(double x) throws IllegalArgumentException {
Enumeration e = vFmt.elements(); Enumeration<Object> e = vFmt.elements();
ConversionSpecification cs = null; ConversionSpecification cs = null;
char c = 0; char c = 0;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
@@ -704,7 +704,7 @@ public class PrintfFormat {
* conversion character is neither s nor S. * conversion character is neither s nor S.
*/ */
public String sprintf(String x) throws IllegalArgumentException { public String sprintf(String x) throws IllegalArgumentException {
Enumeration e = vFmt.elements(); Enumeration<Object> e = vFmt.elements();
ConversionSpecification cs = null; ConversionSpecification cs = null;
char c = 0; char c = 0;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
@@ -734,7 +734,7 @@ public class PrintfFormat {
* formatting an unwrapped value. * formatting an unwrapped value.
*/ */
public String sprintf(Object x) throws IllegalArgumentException { public String sprintf(Object x) throws IllegalArgumentException {
Enumeration e = vFmt.elements(); Enumeration<Object> e = vFmt.elements();
ConversionSpecification cs = null; ConversionSpecification cs = null;
char c = 0; char c = 0;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
@@ -3206,7 +3206,7 @@ public class PrintfFormat {
private String fmt; private String fmt;
} }
/** Vector of control strings and format literals. */ /** Vector of control strings and format literals. */
private Vector vFmt = new Vector(); private Vector<Object> vFmt = new Vector<Object>();
/** Character position. Used by the constructor. */ /** Character position. Used by the constructor. */
private int cPos = 0; private int cPos = 0;
/** Character position. Used by the constructor. */ /** Character position. Used by the constructor. */

View File

@@ -30,7 +30,7 @@ public class Vargs {
// initial capacity // initial capacity
static final int SIZE = 5; static final int SIZE = 5;
Vector v; Vector<Object> v;
public Vargs() { public Vargs() {
this(SIZE); this(SIZE);
@@ -39,7 +39,7 @@ public class Vargs {
public Vargs(int initialSize) { public Vargs(int initialSize) {
if (v != null) if (v != null)
v.clear(); // clear previous list for GC v.clear(); // clear previous list for GC
v = new Vector(initialSize); v = new Vector<Object>(initialSize);
} }
public Vargs add(boolean value) { public Vargs add(boolean value) {
@@ -97,12 +97,14 @@ public class Vargs {
return this; return this;
} }
/* This apparently isn't even used? - flibit
public Vector toVector() { public Vector toVector() {
// Vector tmp = v; // Vector tmp = v;
// v = null; // v = null;
// return tmp; // return tmp;
return (Vector) v.clone(); return (Vector) v.clone();
} }
*/
public Object[] toArray() { public Object[] toArray() {
return v.toArray(); return v.toArray();