7143629: JDK jar/zip code should use unsigned library support
Reviewed-by: sherman
This commit is contained in:
parent
b37db2a9db
commit
d8c00fda7b
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -135,7 +135,7 @@ class JarOutputStream extends ZipOutputStream {
|
|||||||
* The bytes are assumed to be in Intel (little-endian) byte order.
|
* The bytes are assumed to be in Intel (little-endian) byte order.
|
||||||
*/
|
*/
|
||||||
private static int get16(byte[] b, int off) {
|
private static int get16(byte[] b, int off) {
|
||||||
return (b[off] & 0xff) | ((b[off+1] & 0xff) << 8);
|
return Byte.toUnsignedInt(b[off]) | ( Byte.toUnsignedInt(b[off+1]) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -339,7 +339,7 @@ public class Manifest implements Cloneable {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buf[pos++] & 0xff;
|
return Byte.toUnsignedInt(buf[pos++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int read(byte[] b, int off, int len) throws IOException {
|
public int read(byte[] b, int off, int len) throws IOException {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -119,7 +119,7 @@ class InflaterInputStream extends FilterInputStream {
|
|||||||
*/
|
*/
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
return read(singleByteBuf, 0, 1) == -1 ? -1 : singleByteBuf[0] & 0xff;
|
return read(singleByteBuf, 0, 1) == -1 ? -1 : Byte.toUnsignedInt(singleByteBuf[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -435,7 +435,7 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
|
|||||||
* The bytes are assumed to be in Intel (little-endian) byte order.
|
* The bytes are assumed to be in Intel (little-endian) byte order.
|
||||||
*/
|
*/
|
||||||
private static final int get16(byte b[], int off) {
|
private static final int get16(byte b[], int off) {
|
||||||
return (b[off] & 0xff) | ((b[off+1] & 0xff) << 8);
|
return Byte.toUnsignedInt(b[off]) | (Byte.toUnsignedInt(b[off+1]) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -185,11 +185,11 @@ class ZipConstants {
|
|||||||
*/
|
*/
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
static final int CH(byte[] b, int n) {
|
static final int CH(byte[] b, int n) {
|
||||||
return b[n] & 0xff;
|
return Byte.toUnsignedInt(b[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static final int SH(byte[] b, int n) {
|
static final int SH(byte[] b, int n) {
|
||||||
return (b[n] & 0xff) | ((b[n + 1] & 0xff) << 8);
|
return Byte.toUnsignedInt(b[n]) | (Byte.toUnsignedInt(b[n + 1]) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static final long LG(byte[] b, int n) {
|
static final long LG(byte[] b, int n) {
|
||||||
|
Loading…
Reference in New Issue
Block a user