mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8203328: Rename EFS in java.util.zip internals to something meaningful
Reviewed-by: sherman
This commit is contained in:
parent
e1bffce5a3
commit
42f7e3f69e
13 changed files with 41 additions and 41 deletions
|
@ -377,7 +377,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
ensureOpen();
|
||||
if (Objects.equals(lastEntryName, entry.name)) {
|
||||
pos = lastEntryPos;
|
||||
} else if (!zc.isUTF8() && (entry.flag & EFS) != 0) {
|
||||
} else if (!zc.isUTF8() && (entry.flag & USE_UTF8) != 0) {
|
||||
pos = zsrc.getEntryPos(zc.getBytesUTF8(entry.name), false);
|
||||
} else {
|
||||
pos = zsrc.getEntryPos(zc.getBytes(entry.name), false);
|
||||
|
@ -519,7 +519,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T next() {
|
||||
public T next() {
|
||||
synchronized (ZipFile.this) {
|
||||
ensureOpen();
|
||||
if (!hasNext()) {
|
||||
|
@ -605,7 +605,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
private String getEntryName(int pos) {
|
||||
byte[] cen = res.zsrc.cen;
|
||||
int nlen = CENNAM(cen, pos);
|
||||
if (!zc.isUTF8() && (CENFLG(cen, pos) & EFS) != 0) {
|
||||
if (!zc.isUTF8() && (CENFLG(cen, pos) & USE_UTF8) != 0) {
|
||||
return zc.toStringUTF8(cen, pos + CENHDR, nlen);
|
||||
} else {
|
||||
return zc.toString(cen, pos + CENHDR, nlen);
|
||||
|
@ -665,7 +665,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
// (1) null, invoked from iterator, or
|
||||
// (2) not equal to the name stored, a slash is appended during
|
||||
// getEntryPos() search.
|
||||
if (!zc.isUTF8() && (flag & EFS) != 0) {
|
||||
if (!zc.isUTF8() && (flag & USE_UTF8) != 0) {
|
||||
name = zc.toStringUTF8(cen, pos + CENHDR, nlen);
|
||||
} else {
|
||||
name = zc.toString(cen, pos + CENHDR, nlen);
|
||||
|
@ -684,7 +684,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
}
|
||||
if (clen != 0) {
|
||||
int start = pos + CENHDR + nlen + elen;
|
||||
if (!zc.isUTF8() && (flag & EFS) != 0) {
|
||||
if (!zc.isUTF8() && (flag & USE_UTF8) != 0) {
|
||||
e.comment = zc.toStringUTF8(cen, start, clen);
|
||||
} else {
|
||||
e.comment = zc.toString(cen, start, clen);
|
||||
|
@ -790,7 +790,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
for (InputStream is : copy) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
if (ioe == null) ioe = e;
|
||||
else ioe.addSuppressed(e);
|
||||
}
|
||||
|
@ -805,9 +805,9 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
try {
|
||||
Source.release(zsrc);
|
||||
zsrc = null;
|
||||
} catch (IOException e) {
|
||||
if (ioe == null) ioe = e;
|
||||
else ioe.addSuppressed(e);
|
||||
} catch (IOException e) {
|
||||
if (ioe == null) ioe = e;
|
||||
else ioe.addSuppressed(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -928,7 +928,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
* Inner class implementing the input stream used to read a
|
||||
* (possibly compressed) zip file entry.
|
||||
*/
|
||||
private class ZipFileInputStream extends InputStream {
|
||||
private class ZipFileInputStream extends InputStream {
|
||||
private volatile boolean closeRequested;
|
||||
private long pos; // current position within entry data
|
||||
protected long rem; // number of remaining bytes within entry
|
||||
|
@ -947,7 +947,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
pos = - (pos + ZipFile.this.res.zsrc.locpos);
|
||||
}
|
||||
|
||||
private void checkZIP64(byte[] cen, int cenpos) {
|
||||
private void checkZIP64(byte[] cen, int cenpos) {
|
||||
int off = cenpos + CENHDR + CENNAM(cen, cenpos);
|
||||
int end = off + CENEXT(cen, cenpos);
|
||||
while (off + 4 < end) {
|
||||
|
@ -984,11 +984,12 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
}
|
||||
}
|
||||
|
||||
/* The Zip file spec explicitly allows the LOC extra data size to
|
||||
* be different from the CEN extra data size. Since we cannot trust
|
||||
* the CEN extra data size, we need to read the LOC to determine
|
||||
* the entry data offset.
|
||||
*/
|
||||
/*
|
||||
* The Zip file spec explicitly allows the LOC extra data size to
|
||||
* be different from the CEN extra data size. Since we cannot trust
|
||||
* the CEN extra data size, we need to read the LOC to determine
|
||||
* the entry data offset.
|
||||
*/
|
||||
private long initDataOffset() throws IOException {
|
||||
if (pos <= 0) {
|
||||
byte[] loc = new byte[LOCHDR];
|
||||
|
@ -1205,7 +1206,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
}
|
||||
Object fk = attrs.fileKey();
|
||||
if (fk != null) {
|
||||
return fk.equals(key.attrs.fileKey());
|
||||
return fk.equals(key.attrs.fileKey());
|
||||
} else {
|
||||
return file.equals(key.file);
|
||||
}
|
||||
|
@ -1289,7 +1290,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
private final int readFullyAt(byte[] buf, int off, int len, long pos)
|
||||
throws IOException
|
||||
{
|
||||
synchronized(zfile) {
|
||||
synchronized (zfile) {
|
||||
zfile.seek(pos);
|
||||
int N = len;
|
||||
while (N > 0) {
|
||||
|
@ -1305,7 +1306,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
private final int readAt(byte[] buf, int off, int len, long pos)
|
||||
throws IOException
|
||||
{
|
||||
synchronized(zfile) {
|
||||
synchronized (zfile) {
|
||||
zfile.seek(pos);
|
||||
return zfile.read(buf, off, len);
|
||||
}
|
||||
|
@ -1476,7 +1477,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
int hsh = 0;
|
||||
int pos = 0;
|
||||
int limit = cen.length - ENDHDR;
|
||||
while (pos + CENHDR <= limit) {
|
||||
while (pos + CENHDR <= limit) {
|
||||
if (i >= total) {
|
||||
// This will only happen if the zip file has an incorrect
|
||||
// ENDTOT field, which usually means it contains more than
|
||||
|
@ -1544,7 +1545,7 @@ class ZipFile implements ZipConstants, Closeable {
|
|||
* array has enough room at the end to try again with a
|
||||
* slash appended if the first table lookup does not succeed.
|
||||
*/
|
||||
while(true) {
|
||||
while (true) {
|
||||
/*
|
||||
* Search down the target hash chain for a entry whose
|
||||
* 32 bit hash matches the hashed name.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue