fix: indexOf(...) -> contains(...)
This commit is contained in:
@@ -76,7 +76,7 @@ public class CL_parse {
|
|||||||
RandomAccessFile fp;
|
RandomAccessFile fp;
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
if (filename.indexOf("..") != -1) {
|
if (filename.contains("..")) {
|
||||||
log.warn("Refusing to download a path with ..");
|
log.warn("Refusing to download a path with ..");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -147,7 +147,7 @@ public class CL_parse {
|
|||||||
|
|
||||||
filename = Cmd.Argv(1);
|
filename = Cmd.Argv(1);
|
||||||
|
|
||||||
if (filename.indexOf("..") != -1) {
|
if (filename.contains("..")) {
|
||||||
log.warn("Refusing to download a path with ..");
|
log.warn("Refusing to download a path with ..");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4248,7 +4248,7 @@ public final class Menu extends Key {
|
|||||||
+ s.parent.y, s.name);
|
+ s.parent.y, s.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.itemnames[s.curvalue].indexOf('\n') == -1) {
|
if (!s.itemnames[s.curvalue].contains("\n")) {
|
||||||
Menu_DrawString(RCOLUMN_OFFSET + s.x + s.parent.x,
|
Menu_DrawString(RCOLUMN_OFFSET + s.x + s.parent.x,
|
||||||
s.y + s.parent.y, s.itemnames[s.curvalue]);
|
s.y + s.parent.y, s.itemnames[s.curvalue]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class GameTarget {
|
|||||||
+ Lib.vtos(ent.s.origin) + "\n");
|
+ Lib.vtos(ent.s.origin) + "\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GameBase.st.noise.indexOf(".wav") < 0)
|
if (!GameBase.st.noise.contains(".wav"))
|
||||||
buffer = "" + GameBase.st.noise + ".wav";
|
buffer = "" + GameBase.st.noise + ".wav";
|
||||||
else
|
else
|
||||||
buffer = GameBase.st.noise;
|
buffer = GameBase.st.noise;
|
||||||
@@ -438,7 +438,7 @@ public class GameTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if going to a new unit, clear cross triggers
|
// if going to a new unit, clear cross triggers
|
||||||
if (self.map.indexOf('*') > -1)
|
if (self.map.contains("*"))
|
||||||
GameBase.game.serverflags &= ~(Defines.SFL_CROSS_TRIGGER_MASK);
|
GameBase.game.serverflags &= ~(Defines.SFL_CROSS_TRIGGER_MASK);
|
||||||
|
|
||||||
PlayerHud.BeginIntermission(self);
|
PlayerHud.BeginIntermission(self);
|
||||||
|
|||||||
@@ -57,17 +57,17 @@ public class Info {
|
|||||||
if (value == null || value.length() == 0)
|
if (value == null || value.length() == 0)
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
if (key.indexOf('\\') != -1 || value.indexOf('\\') != -1) {
|
if (key.contains("\\") || value.contains("\\")) {
|
||||||
log.warn("Can't use keys or values with a \\");
|
log.warn("Can't use keys or values with a \\");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.indexOf(';') != -1) {
|
if (key.contains(";")) {
|
||||||
log.warn("Can't use keys or values with a semicolon");
|
log.warn("Can't use keys or values with a semicolon");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.indexOf('"') != -1 || value.indexOf('"') != -1) {
|
if (key.contains("\"") || value.contains("\"")) {
|
||||||
log.warn("Can't use keys or values with a \"");
|
log.warn("Can't use keys or values with a \"");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ public class Info {
|
|||||||
|
|
||||||
StringBuffer sb = new StringBuffer(512);
|
StringBuffer sb = new StringBuffer(512);
|
||||||
|
|
||||||
if (key.indexOf('\\') != -1) {
|
if (key.contains("\\")) {
|
||||||
log.warn("Can't use a key with a \\");
|
log.warn("Can't use a key with a \\");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class PlayerHud {
|
|||||||
GameBase.level.intermissiontime = GameBase.level.time;
|
GameBase.level.intermissiontime = GameBase.level.time;
|
||||||
GameBase.level.changemap = targ.map;
|
GameBase.level.changemap = targ.map;
|
||||||
|
|
||||||
if (GameBase.level.changemap.indexOf('*') > -1) {
|
if (GameBase.level.changemap.contains("*")) {
|
||||||
if (GameBase.coop.value != 0) {
|
if (GameBase.coop.value != 0) {
|
||||||
for (i = 0; i < GameBase.maxclients.value; i++) {
|
for (i = 0; i < GameBase.maxclients.value; i++) {
|
||||||
client = GameBase.g_edicts[1 + i];
|
client = GameBase.g_edicts[1 + i];
|
||||||
|
|||||||
@@ -442,11 +442,11 @@ public class Cvar {
|
|||||||
* Some characters are invalid for info strings.
|
* Some characters are invalid for info strings.
|
||||||
*/
|
*/
|
||||||
static boolean InfoValidate(String s) {
|
static boolean InfoValidate(String s) {
|
||||||
if (s.indexOf("\\") != -1)
|
if (s.contains("\\"))
|
||||||
return false;
|
return false;
|
||||||
if (s.indexOf("\"") != -1)
|
else if (s.contains("\""))
|
||||||
return false;
|
return false;
|
||||||
if (s.indexOf(";") != -1)
|
else if (s.contains(";"))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1095,25 +1095,25 @@ public abstract class Main extends Base {
|
|||||||
String renderer_buffer = gl_config.renderer_string.toLowerCase();
|
String renderer_buffer = gl_config.renderer_string.toLowerCase();
|
||||||
String vendor_buffer = gl_config.vendor_string.toLowerCase();
|
String vendor_buffer = gl_config.vendor_string.toLowerCase();
|
||||||
|
|
||||||
if (renderer_buffer.indexOf("voodoo") >= 0) {
|
if (renderer_buffer.contains("voodoo")) {
|
||||||
if (renderer_buffer.indexOf("rush") < 0)
|
if (!renderer_buffer.contains("rush"))
|
||||||
gl_config.renderer = GL_RENDERER_VOODOO;
|
gl_config.renderer = GL_RENDERER_VOODOO;
|
||||||
else
|
else
|
||||||
gl_config.renderer = GL_RENDERER_VOODOO_RUSH;
|
gl_config.renderer = GL_RENDERER_VOODOO_RUSH;
|
||||||
}
|
}
|
||||||
else if (vendor_buffer.indexOf("sgi") >= 0)
|
else if (vendor_buffer.contains("sgi"))
|
||||||
gl_config.renderer = GL_RENDERER_SGI;
|
gl_config.renderer = GL_RENDERER_SGI;
|
||||||
else if (renderer_buffer.indexOf("permedia") >= 0)
|
else if (renderer_buffer.contains("permedia"))
|
||||||
gl_config.renderer = GL_RENDERER_PERMEDIA2;
|
gl_config.renderer = GL_RENDERER_PERMEDIA2;
|
||||||
else if (renderer_buffer.indexOf("glint") >= 0)
|
else if (renderer_buffer.contains("glint"))
|
||||||
gl_config.renderer = GL_RENDERER_GLINT_MX;
|
gl_config.renderer = GL_RENDERER_GLINT_MX;
|
||||||
else if (renderer_buffer.indexOf("glzicd") >= 0)
|
else if (renderer_buffer.contains("glzicd"))
|
||||||
gl_config.renderer = GL_RENDERER_REALIZM;
|
gl_config.renderer = GL_RENDERER_REALIZM;
|
||||||
else if (renderer_buffer.indexOf("gdi") >= 0)
|
else if (renderer_buffer.contains("gdi"))
|
||||||
gl_config.renderer = GL_RENDERER_MCD;
|
gl_config.renderer = GL_RENDERER_MCD;
|
||||||
else if (renderer_buffer.indexOf("pcx2") >= 0)
|
else if (renderer_buffer.contains("pcx2"))
|
||||||
gl_config.renderer = GL_RENDERER_PCX2;
|
gl_config.renderer = GL_RENDERER_PCX2;
|
||||||
else if (renderer_buffer.indexOf("verite") >= 0)
|
else if (renderer_buffer.contains("verite"))
|
||||||
gl_config.renderer = GL_RENDERER_RENDITION;
|
gl_config.renderer = GL_RENDERER_RENDITION;
|
||||||
else
|
else
|
||||||
gl_config.renderer = GL_RENDERER_OTHER;
|
gl_config.renderer = GL_RENDERER_OTHER;
|
||||||
@@ -1164,8 +1164,8 @@ public abstract class Main extends Base {
|
|||||||
/*
|
/*
|
||||||
** grab extensions
|
** grab extensions
|
||||||
*/
|
*/
|
||||||
if (gl_config.extensions_string.indexOf("GL_EXT_compiled_vertex_array") >= 0
|
if (gl_config.extensions_string.contains("GL_EXT_compiled_vertex_array")
|
||||||
|| gl_config.extensions_string.indexOf("GL_SGI_compiled_vertex_array") >= 0) {
|
|| gl_config.extensions_string.contains("GL_SGI_compiled_vertex_array")) {
|
||||||
log.info("...enabling GL_EXT_compiled_vertex_array");
|
log.info("...enabling GL_EXT_compiled_vertex_array");
|
||||||
// qglLockArraysEXT = ( void * ) qwglGetProcAddress( "glLockArraysEXT" );
|
// qglLockArraysEXT = ( void * ) qwglGetProcAddress( "glLockArraysEXT" );
|
||||||
if (gl_ext_compiled_vertex_array.value != 0.0f)
|
if (gl_ext_compiled_vertex_array.value != 0.0f)
|
||||||
@@ -1180,7 +1180,7 @@ public abstract class Main extends Base {
|
|||||||
qglLockArraysEXT = false;
|
qglLockArraysEXT = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_config.extensions_string.indexOf("WGL_EXT_swap_control") >= 0) {
|
if (gl_config.extensions_string.contains("WGL_EXT_swap_control")) {
|
||||||
qwglSwapIntervalEXT = true;
|
qwglSwapIntervalEXT = true;
|
||||||
log.info("...enabling WGL_EXT_swap_control");
|
log.info("...enabling WGL_EXT_swap_control");
|
||||||
} else {
|
} else {
|
||||||
@@ -1188,7 +1188,7 @@ public abstract class Main extends Base {
|
|||||||
log.info("...WGL_EXT_swap_control not found");
|
log.info("...WGL_EXT_swap_control not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_config.extensions_string.indexOf("GL_EXT_point_parameters") >= 0) {
|
if (gl_config.extensions_string.contains("GL_EXT_point_parameters")) {
|
||||||
if (gl_ext_pointparameters.value != 0.0f) {
|
if (gl_ext_pointparameters.value != 0.0f) {
|
||||||
// qglPointParameterfEXT = ( void (APIENTRY *)( GLenum, GLfloat ) ) qwglGetProcAddress( "glPointParameterfEXT" );
|
// qglPointParameterfEXT = ( void (APIENTRY *)( GLenum, GLfloat ) ) qwglGetProcAddress( "glPointParameterfEXT" );
|
||||||
qglPointParameterfEXT = true;
|
qglPointParameterfEXT = true;
|
||||||
@@ -1239,7 +1239,7 @@ public abstract class Main extends Base {
|
|||||||
log.info("...GL_EXT_shared_texture_palette not found");
|
log.info("...GL_EXT_shared_texture_palette not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_config.extensions_string.indexOf("GL_ARB_multitexture") >= 0) {
|
if (gl_config.extensions_string.contains("GL_ARB_multitexture")) {
|
||||||
log.info("...using GL_ARB_multitexture");
|
log.info("...using GL_ARB_multitexture");
|
||||||
qglActiveTextureARB = true;
|
qglActiveTextureARB = true;
|
||||||
GL_TEXTURE0 = ARBMultitexture.GL_TEXTURE0_ARB;
|
GL_TEXTURE0 = ARBMultitexture.GL_TEXTURE0_ARB;
|
||||||
|
|||||||
@@ -594,7 +594,7 @@ public class SV_CCMDS {
|
|||||||
|
|
||||||
// if not a pcx, demo, or cinematic, check to make sure the level exists
|
// if not a pcx, demo, or cinematic, check to make sure the level exists
|
||||||
map = Cmd.Argv(1);
|
map = Cmd.Argv(1);
|
||||||
if (map.indexOf(".") < 0) {
|
if (!map.contains(".")) {
|
||||||
expanded = "maps/" + map + ".bsp";
|
expanded = "maps/" + map + ".bsp";
|
||||||
if (UnpackLoader.loadFile(expanded) == null) {
|
if (UnpackLoader.loadFile(expanded) == null) {
|
||||||
|
|
||||||
@@ -636,7 +636,7 @@ public class SV_CCMDS {
|
|||||||
log.warn("Loading game...");
|
log.warn("Loading game...");
|
||||||
|
|
||||||
dir = Cmd.Argv(1);
|
dir = Cmd.Argv(1);
|
||||||
if ( (dir.indexOf("..") > -1) || (dir.indexOf("/") > -1) || (dir.indexOf("\\") > -1)) {
|
if ( (dir.contains("..")) || (dir.contains("/")) || (dir.contains("\\"))) {
|
||||||
log.warn("Bad savedir.");
|
log.warn("Bad savedir.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -699,7 +699,7 @@ public class SV_CCMDS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dir = Cmd.Argv(1);
|
dir = Cmd.Argv(1);
|
||||||
if ( (dir.indexOf("..") > -1) || (dir.indexOf("/") > -1) || (dir.indexOf("\\") > -1)) {
|
if ( (dir.contains("..")) || (dir.contains("/")) || (dir.contains("\\"))) {
|
||||||
log.warn("Bad savedir.");
|
log.warn("Bad savedir.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ public class SV_USER {
|
|||||||
// hacked by zoid to allow more conrol over download
|
// hacked by zoid to allow more conrol over download
|
||||||
// first off, no .. or global allow check
|
// first off, no .. or global allow check
|
||||||
|
|
||||||
if (name.indexOf("..") != -1
|
if (name.contains("..")
|
||||||
|| SV_MAIN.allow_download.value == 0 // leading dot is no good
|
|| SV_MAIN.allow_download.value == 0 // leading dot is no good
|
||||||
|| name.charAt(0) == '.' // leading slash bad as well, must be
|
|| name.charAt(0) == '.' // leading slash bad as well, must be
|
||||||
// in subdir
|
// in subdir
|
||||||
|
|||||||
@@ -542,7 +542,7 @@ public final class LWJGLSoundImpl implements Sound {
|
|||||||
i = 1;
|
i = 1;
|
||||||
while (i < Cmd.Argc()) {
|
while (i < Cmd.Argc()) {
|
||||||
name = Cmd.Argv(i);
|
name = Cmd.Argv(i);
|
||||||
if (name.indexOf('.') == -1)
|
if (!name.contains("."))
|
||||||
name += ".wav";
|
name += ".wav";
|
||||||
|
|
||||||
sfx = RegisterSound(name);
|
sfx = RegisterSound(name);
|
||||||
|
|||||||
Reference in New Issue
Block a user