8286378: Address possibly lossy conversions in java.base

Reviewed-by: naoto, xuelei, bpb, alanb
This commit is contained in:
Roger Riggs 2022-05-12 16:50:36 +00:00
parent 0a6832b24c
commit 17c52789b7
32 changed files with 68 additions and 71 deletions

View file

@ -436,7 +436,7 @@ public class BufferedInputStream extends FilterInputStream {
}
long skipped = (avail < n) ? avail : n;
pos += skipped;
pos += (int)skipped;
return skipped;
}

View file

@ -475,7 +475,7 @@ public class BufferedReader extends Reader {
}
long d = nChars - nextChar;
if (r <= d) {
nextChar += r;
nextChar += (int)r;
r = 0;
break;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -228,7 +228,7 @@ public class ByteArrayInputStream extends InputStream {
k = n < 0 ? 0 : n;
}
pos += k;
pos += (int) k;
return k;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -196,7 +196,7 @@ public class CharArrayReader extends Reader {
if (n < 0) {
return 0;
}
pos += n;
pos += (int) n;
return n;
}
}

View file

@ -323,7 +323,7 @@ public class PushbackInputStream extends FilterInputStream {
if (n < pskip) {
pskip = n;
}
pos += pskip;
pos += (int) pskip;
n -= pskip;
}
if (n > 0) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -251,7 +251,7 @@ public class PushbackReader extends FilterReader {
int avail = buf.length - pos;
if (avail > 0) {
if (n <= avail) {
pos += n;
pos += (int)n;
return n;
} else {
pos = buf.length;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -145,7 +145,7 @@ public class StringBufferInputStream extends InputStream {
if (n > count - pos) {
n = count - pos;
}
pos += n;
pos += (int) n;
return n;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -136,7 +136,7 @@ public class StringReader extends Reader {
// Bound skip by beginning and end of the source
long r = Math.min(length - next, n);
r = Math.max(-next, r);
next += r;
next += (int)r;
return r;
}
}