mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +02:00
Fixed compiler warnings.
This commit is contained in:
parent
e0202c643c
commit
e697d8277b
1 changed files with 9 additions and 9 deletions
|
@ -126,12 +126,12 @@ public class ResourceTestHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IFile[] findFiles(String prefix, String suffix, int i, int n) {
|
public static IFile[] findFiles(String prefix, String suffix, int i, int n) {
|
||||||
List files= new ArrayList(n);
|
List<IFile> files= new ArrayList<IFile>(n);
|
||||||
for (int j= i; j < i + n; j++) {
|
for (int j= i; j < i + n; j++) {
|
||||||
String path= prefix + j + suffix;
|
String path= prefix + j + suffix;
|
||||||
files.add(findFile(path));
|
files.add(findFile(path));
|
||||||
}
|
}
|
||||||
return (IFile[]) files.toArray(new IFile[files.size()]);
|
return files.toArray(new IFile[files.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StringBuffer read(String src) throws IOException, CoreException {
|
public static StringBuffer read(String src) throws IOException, CoreException {
|
||||||
|
@ -151,7 +151,7 @@ public class ResourceTestHelper {
|
||||||
|
|
||||||
public static void replicate(String src, String destPrefix, String destSuffix, int n, String srcName, String destNamePrefix, int ifExists) throws IOException, CoreException {
|
public static void replicate(String src, String destPrefix, String destSuffix, int n, String srcName, String destNamePrefix, int ifExists) throws IOException, CoreException {
|
||||||
StringBuffer s= read(src);
|
StringBuffer s= read(src);
|
||||||
List positions= identifierPositions(s, srcName);
|
List<Integer> positions= identifierPositions(s, srcName);
|
||||||
for (int j= 0; j < n; j++) {
|
for (int j= 0; j < n; j++) {
|
||||||
String dest= destPrefix + j + destSuffix;
|
String dest= destPrefix + j + destSuffix;
|
||||||
if (handleExisting(dest, ifExists)) {
|
if (handleExisting(dest, ifExists)) {
|
||||||
|
@ -165,23 +165,23 @@ public class ResourceTestHelper {
|
||||||
public static void copy(String src, String dest, String srcName, String destName, int ifExists) throws IOException, CoreException {
|
public static void copy(String src, String dest, String srcName, String destName, int ifExists) throws IOException, CoreException {
|
||||||
if (handleExisting(dest, ifExists)) {
|
if (handleExisting(dest, ifExists)) {
|
||||||
StringBuffer buf= read(src);
|
StringBuffer buf= read(src);
|
||||||
List positions= identifierPositions(buf, srcName);
|
List<Integer> positions= identifierPositions(buf, srcName);
|
||||||
replacePositions(buf, srcName.length(), destName, positions);
|
replacePositions(buf, srcName.length(), destName, positions);
|
||||||
write(dest, buf.toString());
|
write(dest, buf.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void replacePositions(StringBuffer c, int origLength, String string, List positions) {
|
private static void replacePositions(StringBuffer c, int origLength, String string, List<Integer> positions) {
|
||||||
int offset= 0;
|
int offset= 0;
|
||||||
for (Iterator iter= positions.iterator(); iter.hasNext();) {
|
for (Iterator<Integer> iter= positions.iterator(); iter.hasNext();) {
|
||||||
int position= ((Integer) iter.next()).intValue();
|
int position= iter.next().intValue();
|
||||||
c.replace(offset + position, offset + position + origLength, string);
|
c.replace(offset + position, offset + position + origLength, string);
|
||||||
offset += string.length() - origLength;
|
offset += string.length() - origLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List identifierPositions(StringBuffer buffer, String identifier) {
|
private static List<Integer> identifierPositions(StringBuffer buffer, String identifier) {
|
||||||
List positions= new ArrayList();
|
List<Integer> positions= new ArrayList<Integer>();
|
||||||
int i= -1;
|
int i= -1;
|
||||||
while (true) {
|
while (true) {
|
||||||
i= buffer.indexOf(identifier, i + 1);
|
i= buffer.indexOf(identifier, i + 1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue