Patches to make sure everything is correctly typed and good.

This commit is contained in:
grail%cafebabe.org 1999-02-11 11:07:55 +00:00
Родитель 02a2bc0d4e
Коммит 384bf6d0fb
5 изменённых файлов: 71 добавлений и 71 удалений

Просмотреть файл

@ -35,14 +35,14 @@ public final class MimeBase64Encoder extends MimeEncoder {
static private final byte crlf[] = "\r\n".getBytes();
static private final byte map[] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 0-7
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 8-15
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 16-23
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', // 24-31
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 32-39
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 40-47
'w', 'x', 'y', 'z', '0', '1', '2', '3', // 48-55
'4', '5', '6', '7', '8', '9', '+', '/', // 56-63
(byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', (byte)'H', // 0-7
(byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O', (byte)'P', // 8-15
(byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', (byte)'V', (byte)'W', (byte)'X', // 16-23
(byte)'Y', (byte)'Z', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', // 24-31
(byte)'g', (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', // 32-39
(byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', (byte)'v', // 40-47
(byte)'w', (byte)'x', (byte)'y', (byte)'z', (byte)'0', (byte)'1', (byte)'2', (byte)'3', // 48-55
(byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/', // 56-63
};
private final void encode_token() {
@ -62,12 +62,12 @@ public final class MimeBase64Encoder extends MimeEncoder {
line[i+1] = map[0x3F & (buf >> 12)]; // sextet 2 (octet 1 and 2)
if (buf_bytes == 1)
line[i+2] = '=';
line[i+2] = (byte)'=';
else
line[i+2] = map[0x3F & (buf >> 6)]; // sextet 3 (octet 2 and 3)
if (buf_bytes <= 2)
line[i+3] = '=';
line[i+3] = (byte)'=';
else
line[i+3] = map[0x3F & buf]; // sextet 4 (octet 3)
line_length += 4;
@ -76,8 +76,8 @@ public final class MimeBase64Encoder extends MimeEncoder {
}
private final void flush_line(ByteBuf out) {
line[line_length] = '\r';
line[line_length+1] = '\n';
line[line_length] = (byte)'\r';
line[line_length+1] = (byte)'\n';
out.append(line, 0, line_length + 2);
line_length = 0;
}

Просмотреть файл

@ -78,8 +78,8 @@ public class MimeQuotedPrintableEncoder extends MimeEncoder {
};
static private final byte hex[] = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
(byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7',
(byte)'8', (byte)'9', (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F'
};
static private final byte crlf[] = "\r\n".getBytes();

Просмотреть файл

@ -38,14 +38,14 @@ public final class MimeUUEncoder extends MimeEncoder {
static private final byte end_crlf[] = "end\r\n".getBytes();
static private final byte map[] = {
'`', '!', '"', '#', '$', '%', '&', '\'', // 0-7
'(', ')', '*', '+', ',', '-', '.', '/', // 8-15
'0', '1', '2', '3', '4', '5', '6', '7', // 16-23
'8', '9', ':', ';', '<', '=', '>', '?', // 24-31
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', // 32-39
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', // 40-47
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', // 48-55
'X', 'Y', 'Z', '[', '\\',']', '^', '_', // 56-63
(byte)'`', (byte)'!', (byte)'"', (byte)'#', (byte)'$', (byte)'%', (byte)'&', (byte)'\'', // 0-7
(byte)'(', (byte)')', (byte)'*', (byte)'+', (byte)',', (byte)'-', (byte)'.', (byte)'/', // 8-15
(byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', // 16-23
(byte)'8', (byte)'9', (byte)':', (byte)';', (byte)'<', (byte)'=', (byte)'>', (byte)'?', // 24-31
(byte)'@', (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', // 32-39
(byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O', // 40-47
(byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', (byte)'V', (byte)'W', // 48-55
(byte)'X', (byte)'Y', (byte)'Z', (byte)'[', (byte)'\\',(byte)']', (byte)'^', (byte)'_', // 56-63
};
@ -67,8 +67,8 @@ public final class MimeUUEncoder extends MimeEncoder {
private final void flush_line(ByteBuf out, int offset) {
line[0] = map[(line_length * 3 / 4) - offset];
line[line_length] = '\r';
line[line_length+1] = '\n';
line[line_length] = (byte)'\r';
line[line_length+1] = (byte)'\n';
out.append(line, 0, line_length + 2);
line_length = 1;
}

Просмотреть файл

@ -172,10 +172,10 @@ class NNTPConnection {
if (DEBUG) {
String s = "NNTP: ==> ";
for (int i = start; i < start+length; i++)
s += (b[i] == '\r' ? "\\r" :
b[i] == '\n' ? "\\n" :
b[i] == '\t' ? "\\t" :
b[i] == '\\' ? "\\\\" :
s += (b[i] == (byte)'\r' ? "\\r" :
b[i] == (byte)'\n' ? "\\n" :
b[i] == (byte)'\t' ? "\\t" :
b[i] == (byte)'\\' ? "\\\\" :
new String(b, i, 1));
System.err.print(s + "\n");
}
@ -202,9 +202,9 @@ class NNTPConnection {
String s = "NNTP: <== ";
byte b[] = into_buf.toBytes();
for (int i = 0; i < into_buf.length(); i++)
s += (b[i] == '\r' ? "\\r" :
b[i] == '\n' ? "\\n" :
b[i] == '\t' ? "\\t" :
s += (b[i] == (byte)'\r' ? "\\r" :
b[i] == (byte)'\n' ? "\\n" :
b[i] == (byte)(byte)'\t' ? "\\t" :
b[i] == '\\' ? "\\\\" :
new String(b, i, 1));
System.err.print(s + "\n");
@ -214,8 +214,8 @@ class NNTPConnection {
int i = into_buf.length();
int j = i;
while (j > 0 &&
(into_buf.byteAt(j-1) == '\r' ||
into_buf.byteAt(j-1) == '\n'))
(into_buf.byteAt(j-1) == (byte)'\r' ||
into_buf.byteAt(j-1) == (byte)'\n'))
j--;
if (i != j)
into_buf.setLength(j);
@ -271,10 +271,10 @@ class NNTPConnection {
byte b0 = b.byteAt(0);
byte b1 = b.byteAt(1);
byte b2 = b.byteAt(2);
if (b0 != '1' && b0 != '2' && b0 != '3')
if (b0 != (byte)'1' && b0 != (byte)'2' && b0 != (byte)'3')
throw new NNTPException("NNTP error: \"" + b + "\"");
return (((b0-'0') * 100) + ((b1-'0') * 10) + (b2-'0'));
return (((b0-(byte)'0') * 100) + ((b1-(byte)'0') * 10) + (b2-(byte)'0'));
}
@ -307,7 +307,7 @@ class NNTPConnection {
readLine(b);
if (b.equals("."))
break;
else if (b.byteAt(0) == '.')
else if (b.byteAt(0) == (byte)'.')
b.remove(0, 1);
if (b.equals("SETGET")) hasSetGetExtension = true;
else if (b.equals("OVER")) hasOverExtension = true;
@ -352,7 +352,7 @@ class NNTPConnection {
readLine(b);
if (b.equals("."))
break;
else if (b.byteAt(0) == '.')
else if (b.byteAt(0) == (byte)'.')
b.remove(0, 1);
if (b.regionMatches(true, 0, target, 0, tl)) {
@ -383,7 +383,7 @@ class NNTPConnection {
readLine(b);
if (b.equals("."))
break;
else if (b.byteAt(0) == '.')
else if (b.byteAt(0) == (byte)'.')
b.remove(0, 1);
v.addElement(b.toString());
@ -443,7 +443,7 @@ class NNTPConnection {
readLine(b);
if (b.equals(terminator))
break;
else if (b.byteAt(0) == '.')
else if (b.byteAt(0) == (byte)'.')
b.remove(0, 1);
h.addHeaderLine(b.toString());
}
@ -602,41 +602,41 @@ class NNTPConnection {
int i = start;
int j = i;
if (length > 0 && line[length-1] == '\n')
if (length > 0 && line[length-1] == (byte)'\n')
length--;
if (length > 0 && line[length-1] == '\r')
if (length > 0 && line[length-1] == (byte)'\r')
length--;
while (j < length && line[j] != '\t')
article = (article * 10) + line[j++] - '0';
while (j < length && line[j] != (byte)'\t')
article = (article * 10) + line[j++] - (byte)'0';
i = ++j;
while (j < length && line[j] != '\t') j++;
while (j < length && line[j] != (byte)'\t') j++;
subject = new String(line, i, j-i);
i = ++j;
while (j < length && line[j] != '\t') j++;
while (j < length && line[j] != (byte)'\t') j++;
from = new String(line, i, j-i);
i = ++j;
while (j < length && line[j] != '\t') j++;
while (j < length && line[j] != (byte)'\t') j++;
date = new String(line, i, j-i);
i = ++j;
while (j < length && line[j] != '\t') j++;
while (j < length && line[j] != (byte)'\t') j++;
id = new String(line, i, j-i);
i = ++j;
while (j < length && line[j] != '\t') j++;
while (j < length && line[j] != (byte)'\t') j++;
references = new String(line, i, j-i);
i = ++j;
while (j < length && line[j] != '\t')
bytes = (bytes * 10) + line[j++] - '0';
while (j < length && line[j] != (byte)'\t')
bytes = (bytes * 10) + line[j++] - (byte)'0';
i = ++j;
while (j < length && line[j] != '\t')
lines = (lines * 10) + line[j++] - '0';
while (j < length && line[j] != (byte)'\t')
lines = (lines * 10) + line[j++] - (byte)'0';
InternetHeaders h = new InternetHeaders();
h.addHeaderLine("Subject: " + subject + "\r\n");
@ -711,10 +711,10 @@ class NNTPDotTerminatedInputStream extends DotTerminatedInputStream {
String s = "NNTP/DOT #" + (debug_count++) + ": <== ";
int k = (i > 50 ? 50 : i);
for (int j = start; j < start+k; j++)
s += (buf[j] == '\r' ? "\\r" :
buf[j] == '\n' ? "\\n" :
buf[j] == '\t' ? "\\t" :
buf[j] == '\\' ? "\\\\" :
s += (buf[j] == (byte)'\r' ? "\\r" :
buf[j] == (byte)'\n' ? "\\n" :
buf[j] == (byte)'\t' ? "\\t" :
buf[j] == (byte)'\\' ? "\\\\" :
new String(buf, j, 1));
System.err.print(s + "\n");
}
@ -799,10 +799,10 @@ class XOVERMessagesEnumeration implements Enumeration {
String s = "NNTP/XOVER #" + (debug_count++) + ": <== ";
int k = (i > 50 ? 50 : i);
for (int j = 0; j < k; j++)
s += (buf[j] == '\r' ? "\\r" :
buf[j] == '\n' ? "\\n" :
buf[j] == '\t' ? "\\t" :
buf[j] == '\\' ? "\\\\" :
s += (buf[j] == (byte)'\r' ? "\\r" :
buf[j] == (byte)'\n' ? "\\n" :
buf[j] == (byte)'\t' ? "\\t" :
buf[j] == (byte)'\\' ? "\\\\" :
new String(buf, j, 1));
System.err.print(s + "\n");
}

Просмотреть файл

@ -173,30 +173,30 @@ public class NewsRC {
int length = line_buf.length();
boolean subscribed = false;
int i = 0;
while (i < length && line[i] <= ' ') i++; // skip whitespace
while (i < length && line[i] <= (byte)' ') i++; // skip whitespace
int start = i;
while (i < length && // skip non-whitespace, but
line[i] > ' ' && // not the two magic chars
line[i] != ':' &&
line[i] != '!')
line[i] > (byte)' ' && // not the two magic chars
line[i] != (byte)':' &&
line[i] != (byte)'!')
i++;
if (i == start) return null;
String group_name = new String(line, start, i);
while (i < length && line[i] <= ' ') i++; // skip whitespace
while (i < length && line[i] <= (byte)' ') i++; // skip whitespace
if (i < length && line[i] == ':')
if (i < length && line[i] == (byte)':')
subscribed = true;
else if (i < length && line[i] == '!')
else if (i < length && line[i] == (byte)'!')
subscribed = false;
else
return null;
i++;
while (i < length && line[i] <= ' ') i++; // skip whitespace
while (i < length && line[i] <= (byte)' ') i++; // skip whitespace
return new NewsRCLine(this, group_name, subscribed, line, i, length);
}
@ -231,9 +231,9 @@ public class NewsRC {
}
ByteBuf b = new ByteBuf();
final byte[] CR = { '\r' };
final byte[] LF = { '\n' };
final byte[] CRLF = { '\r', '\n' };
final byte[] CR = { (byte)'\r' };
final byte[] LF = { (byte)'\n' };
final byte[] CRLF = { (byte)'\r', (byte)'\n' };
byte linebreak[] = (Constants.ISUNIX ? LF : Constants.ISMAC ? CR : CRLF);
for (Enumeration e = lines.elements(); e.hasMoreElements(); ) {