mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Removed warnings that Doug introduced.
This commit is contained in:
parent
608ab71cce
commit
cd01f65fe6
2 changed files with 16 additions and 17 deletions
|
@ -24,7 +24,8 @@ import java.nio.charset.Charset;
|
||||||
*/
|
*/
|
||||||
public class CodeReader {
|
public class CodeReader {
|
||||||
|
|
||||||
private static final String NOFILE = "<text>";
|
private static final String UTF_8 = "UTF-8"; //$NON-NLS-1$
|
||||||
|
private static final String NOFILE = "<text>"; //$NON-NLS-1$
|
||||||
|
|
||||||
public final char[] buffer;
|
public final char[] buffer;
|
||||||
public final String filename;
|
public final String filename;
|
||||||
|
@ -67,31 +68,30 @@ public class CodeReader {
|
||||||
byteBuffer.rewind();
|
byteBuffer.rewind();
|
||||||
|
|
||||||
// TODO use the real encoding
|
// TODO use the real encoding
|
||||||
CharBuffer charBuffer = Charset.forName("UTF-8").decode(byteBuffer);
|
CharBuffer charBuffer = Charset.forName(UTF_8).decode(byteBuffer);
|
||||||
if (charBuffer.hasArray())
|
if (charBuffer.hasArray())
|
||||||
return charBuffer.array();
|
return charBuffer.array();
|
||||||
else {
|
// Got to copy it out
|
||||||
// Got to copy it out
|
char[] buff = new char[charBuffer.length()];
|
||||||
char[] buff = new char[charBuffer.length()];
|
charBuffer.get(buff);
|
||||||
charBuffer.get(buff);
|
return buff;
|
||||||
return buff;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private char[] xload(FileInputStream stream) throws IOException {
|
protected char[] xload(FileInputStream stream) throws IOException {
|
||||||
FileChannel channel = stream.getChannel();
|
FileChannel channel = stream.getChannel();
|
||||||
MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
|
MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
|
||||||
|
|
||||||
// TODO use the real encoding
|
// TODO use the real encoding
|
||||||
CharBuffer charBuffer = Charset.forName("UTF-8").decode(map);
|
CharBuffer charBuffer = Charset.forName(UTF_8).decode(map);
|
||||||
if (charBuffer.hasArray())
|
if (charBuffer.hasArray())
|
||||||
return charBuffer.array();
|
return charBuffer.array();
|
||||||
else {
|
|
||||||
// Got to copy it out
|
// Got to copy it out
|
||||||
char[] buff = new char[charBuffer.length()];
|
char[] buff = new char[charBuffer.length()];
|
||||||
charBuffer.get(buff);
|
charBuffer.get(buff);
|
||||||
return buff;
|
return buff;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFile() {
|
public boolean isFile() {
|
||||||
|
|
|
@ -762,7 +762,6 @@ public final class Scanner implements IScanner, IScannerData {
|
||||||
// private boolean enableTrigraphReplacement = true;
|
// private boolean enableTrigraphReplacement = true;
|
||||||
// private boolean enableTrigraphReplacementInStrings = true;
|
// private boolean enableTrigraphReplacementInStrings = true;
|
||||||
private boolean throwExceptionOnBadCharacterRead = false;
|
private boolean throwExceptionOnBadCharacterRead = false;
|
||||||
private boolean atEOF = false;
|
|
||||||
|
|
||||||
private boolean tokenizingMacroReplacementList = false;
|
private boolean tokenizingMacroReplacementList = false;
|
||||||
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
|
|
Loading…
Add table
Reference in a new issue