Skip to content

Commit

Permalink
Use uppercase for long literal suffix.
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Sep 20, 2020
1 parent cf2f6c6 commit 0628668
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 35 deletions.
Expand Up @@ -476,7 +476,7 @@ private Archive readHeaders(final byte[] password) throws IOException {

private Archive tryToLocateEndHeader(final byte[] password) throws IOException {
final ByteBuffer nidBuf = ByteBuffer.allocate(1);
final long searchLimit = 1024l * 1024 * 1;
final long searchLimit = 1024L * 1024 * 1;
// Main header, plus bytes that readStartHeader would read
final long previousDataSize = channel.position() + 20;
final long minPos;
Expand Down
Expand Up @@ -167,7 +167,7 @@ public class TarArchiveEntry implements ArchiveEntry, TarConstants {
* mode an the archive contains illegal fields.
* @since 1.19
*/
public static final long UNKNOWN = -1l;
public static final long UNKNOWN = -1L;

/** The entry's name. */
private String name = "";
Expand Down
Expand Up @@ -51,7 +51,7 @@ public BinaryTree(final int depth) {
throw new IllegalArgumentException("depth must be bigger than 0 and not bigger than 30"
+ " but is " + depth);
}
tree = new int[(int) ((1l << (depth + 1)) - 1)];
tree = new int[(int) ((1L << (depth + 1)) - 1)];
Arrays.fill(tree, UNDEFINED);
}

Expand Down
Expand Up @@ -79,7 +79,7 @@ private void readFileBiggerThan8GByte(final String name) throws Exception {
tin = new TarArchiveInputStream(gzin);
final TarArchiveEntry e = tin.getNextTarEntry();
assertNotNull(e);
assertEquals(8200l * 1024 * 1024, e.getSize());
assertEquals(8200L * 1024 * 1024, e.getSize());

long read = 0;
final Random r = new Random(System.currentTimeMillis());
Expand All @@ -94,7 +94,7 @@ private void readFileBiggerThan8GByte(final String name) throws Exception {
}
read += readNow;
}
assertEquals(8200l * 1024 * 1024, read);
assertEquals(8200L * 1024 * 1024, read);
assertNull(tin.getNextTarEntry());
} finally {
if (tin != null) {
Expand Down
Expand Up @@ -263,7 +263,7 @@ public void shouldReadBigGid() throws Exception {
final TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
TarArchiveEntry t = new TarArchiveEntry("name");
t.setGroupId(4294967294l);
t.setGroupId(4294967294L);
t.setSize(1);
tos.putArchiveEntry(t);
tos.write(30);
Expand All @@ -274,7 +274,7 @@ public void shouldReadBigGid() throws Exception {
final TarArchiveInputStream tis =
new TarArchiveInputStream(bis);
t = tis.getNextTarEntry();
assertEquals(4294967294l, t.getLongGroupId());
assertEquals(4294967294L, t.getLongGroupId());
tis.close();
}

Expand Down
Expand Up @@ -165,8 +165,8 @@ private void testRoundTripOctalOrBinary(final int length) {
checkRoundTripOctalOrBinary(1, length);
checkRoundTripOctalOrBinary(TarConstants.MAXSIZE, length); // will need binary format
checkRoundTripOctalOrBinary(-1, length); // will need binary format
checkRoundTripOctalOrBinary(0xffffffffffffffl, length);
checkRoundTripOctalOrBinary(-0xffffffffffffffl, length);
checkRoundTripOctalOrBinary(0xffffffffffffffL, length);
checkRoundTripOctalOrBinary(-0xffffffffffffffL, length);
}

// Check correct trailing bytes are generated
Expand Down Expand Up @@ -235,7 +235,7 @@ public void testReadNegativeBinary8Byte() {
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xf1, (byte) 0xef,
};
assertEquals(-3601l, TarUtils.parseOctalOrBinary(b, 0, 8));
assertEquals(-3601L, TarUtils.parseOctalOrBinary(b, 0, 8));
}

@Test
Expand All @@ -245,7 +245,7 @@ public void testReadNegativeBinary12Byte() {
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xf1, (byte) 0xef,
};
assertEquals(-3601l, TarUtils.parseOctalOrBinary(b, 0, 12));
assertEquals(-3601L, TarUtils.parseOctalOrBinary(b, 0, 12));
}


Expand All @@ -255,7 +255,7 @@ public void testWriteNegativeBinary8Byte() {
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xf1, (byte) 0xef,
};
assertEquals(-3601l, TarUtils.parseOctalOrBinary(b, 0, 8));
assertEquals(-3601L, TarUtils.parseOctalOrBinary(b, 0, 8));
}

// https://issues.apache.org/jira/browse/COMPRESS-191
Expand Down
Expand Up @@ -30,14 +30,14 @@ public void simpleRountrip() throws Exception {
final X000A_NTFS xf = new X000A_NTFS();
xf.setModifyJavaTime(new Date(0));
// one second past midnight
xf.setAccessJavaTime(new Date(-11644473601000l));
xf.setAccessJavaTime(new Date(-11644473601000L));
xf.setCreateJavaTime(null);
final byte[] b = xf.getLocalFileDataData();

final X000A_NTFS xf2 = new X000A_NTFS();
xf2.parseFromLocalFileData(b, 0, b.length);
assertEquals(new Date(0), xf2.getModifyJavaTime());
assertEquals(new Date(-11644473601000l), xf2.getAccessJavaTime());
assertEquals(new Date(-11644473601000L), xf2.getAccessJavaTime());
assertEquals(null, xf2.getCreateJavaTime());
}
}
Expand Up @@ -32,7 +32,7 @@ public class Zip64ExtendedInformationExtraFieldTest {
private static final ZipEightByteInteger CSIZE =
new ZipEightByteInteger(0x9ABCDEF);
private static final ZipEightByteInteger OFF =
new ZipEightByteInteger(BigInteger.valueOf(0xABCDEF091234567l)
new ZipEightByteInteger(BigInteger.valueOf(0xABCDEF091234567L)
.shiftLeft(4)
.setBit(3));
private static final ZipLong DISK = new ZipLong(0x12);
Expand Down
Expand Up @@ -45,7 +45,7 @@

public class Zip64SupportIT {

private static final long FIVE_BILLION = 5000000000l;
private static final long FIVE_BILLION = 5000000000L;
private static final int ONE_MILLION = 1000000;
private static final int ONE_HUNDRED_THOUSAND = 100000;

Expand Down
Expand Up @@ -35,7 +35,7 @@ public class ZipEightByteIntegerTest {
*/
@Test
public void testLongToBytes() {
final ZipEightByteInteger zl = new ZipEightByteInteger(0xAB12345678l);
final ZipEightByteInteger zl = new ZipEightByteInteger(0xAB12345678L);
final byte[] result = zl.getBytes();
assertEquals("length getBytes", 8, result.length);
assertEquals("first byte getBytes", 0x78, result[0]);
Expand All @@ -55,7 +55,7 @@ public void testLongToBytes() {
public void testLongFromBytes() {
final byte[] val = new byte[] {0x78, 0x56, 0x34, 0x12, (byte) 0xAB, 0x00, 0x00, 0x00};
final ZipEightByteInteger zl = new ZipEightByteInteger(val);
assertEquals("longValue from bytes", 0xAB12345678l, zl.getLongValue());
assertEquals("longValue from bytes", 0xAB12345678L, zl.getLongValue());
}

/**
Expand Down
Expand Up @@ -187,7 +187,7 @@ public void testReadingOfStoredEntry() throws Exception {
ZipArchiveEntry ze = new ZipArchiveEntry("foo");
ze.setMethod(ZipEntry.STORED);
ze.setSize(4);
ze.setCrc(0xb63cfbcdl);
ze.setCrc(0xb63cfbcdL);
zo.putArchiveEntry(ze);
zo.write(new byte[] { 1, 2, 3, 4 });
zo.closeArchiveEntry();
Expand Down Expand Up @@ -800,7 +800,7 @@ public void testSelfExtractingZipUsingUnzipsfx() throws IOException, Interrupted
ZipArchiveEntry ze = new ZipArchiveEntry(testEntryName);
ze.setMethod(ZipEntry.STORED);
ze.setSize(4);
ze.setCrc(0xb63cfbcdl);
ze.setCrc(0xb63cfbcdL);
zo.putArchiveEntry(ze);
zo.write(testData);
zo.closeArchiveEntry();
Expand Down
Expand Up @@ -91,11 +91,11 @@ public void testEquals() {
@Test
public void testSign() {
ZipLong zl = new ZipLong(new byte[] {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF});
assertEquals(0x00000000FFFFFFFFl, zl.getValue());
assertEquals(0x00000000FFFFFFFFL, zl.getValue());
assertEquals(-1,zl.getIntValue());

zl = new ZipLong(0xFFFF_FFFFL);
assertEquals(0x00000000FFFFFFFFl, zl.getValue());
assertEquals(0x00000000FFFFFFFFL, zl.getValue());
zl = new ZipLong(0xFFFF_FFFF);
assertEquals(0xFFFF_FFFF_FFFF_FFFFL, zl.getValue());

Expand Down
Expand Up @@ -142,8 +142,8 @@ public void testUnskippableChunk() {

@Test
public void testChecksumUnmasking() {
testChecksumUnmasking(0xc757l);
testChecksumUnmasking(0xffffc757l);
testChecksumUnmasking(0xc757L);
testChecksumUnmasking(0xffffc757L);
}

@Test
Expand Down
Expand Up @@ -138,7 +138,7 @@ public void littleEndianWithOverflow() throws Exception {
try (final BitInputStream bin = new BitInputStream(in, ByteOrder.LITTLE_ENDIAN)) {
assertEquals(23, // 10111
bin.readBits(5));
assertEquals(714595605644185962l, // 0001-00111101-01011000-00011101-01011010-00001111-01000010-00101101-010
assertEquals(714595605644185962L, // 0001-00111101-01011000-00011101-01011010-00001111-01000010-00101101-010
bin.readBits(63));
assertEquals(1186, // 01001010-0010
bin.readBits(12));
Expand All @@ -163,7 +163,7 @@ public void bigEndianWithOverflow() throws Exception {
try (final BitInputStream bin = new BitInputStream(in, ByteOrder.BIG_ENDIAN)) {
assertEquals(10, // 01010
bin.readBits(5));
assertEquals(8274274654740644818l, //111-00101101-01000010-00001111-01011010-00011101-01011000-00111101-0010
assertEquals(8274274654740644818L, //111-00101101-01000010-00001111-01011010-00011101-01011000-00111101-0010
bin.readBits(63));
assertEquals(330, // 0001-01001010
bin.readBits(12));
Expand Down
Expand Up @@ -44,7 +44,7 @@ public void fromLittleEndianFromArrayOneArg() {
@Test
public void fromLittleEndianFromArrayOneArgUnsignedInt32() {
final byte[] b = new byte[] { 2, 3, 4, (byte) 128 };
assertEquals(2 + 3 * 256 + 4 * 256 * 256 + 128l * 256 * 256 * 256, fromLittleEndian(b));
assertEquals(2 + 3 * 256 + 4 * 256 * 256 + 128L * 256 * 256 * 256, fromLittleEndian(b));
}

@Test(expected = IllegalArgumentException.class)
Expand All @@ -61,7 +61,7 @@ public void fromLittleEndianFromArray() {
@Test
public void fromLittleEndianFromArrayUnsignedInt32() {
final byte[] b = new byte[] { 1, 2, 3, 4, (byte) 128 };
assertEquals(2 + 3 * 256 + 4 * 256 * 256 + 128l * 256 * 256 * 256, fromLittleEndian(b, 1, 4));
assertEquals(2 + 3 * 256 + 4 * 256 * 256 + 128L * 256 * 256 * 256, fromLittleEndian(b, 1, 4));
}

@Test(expected = IllegalArgumentException.class)
Expand All @@ -78,7 +78,7 @@ public void fromLittleEndianFromStream() throws IOException {
@Test
public void fromLittleEndianFromStreamUnsignedInt32() throws IOException {
final ByteArrayInputStream bin = new ByteArrayInputStream(new byte[] { 2, 3, 4, (byte) 128 });
assertEquals(2 + 3 * 256 + 4 * 256 * 256 + 128l * 256 * 256 * 256, fromLittleEndian(bin, 4));
assertEquals(2 + 3 * 256 + 4 * 256 * 256 + 128L * 256 * 256 * 256, fromLittleEndian(bin, 4));
}

@Test(expected = IllegalArgumentException.class)
Expand All @@ -101,7 +101,7 @@ public void fromLittleEndianFromSupplier() throws IOException {
@Test
public void fromLittleEndianFromSupplierUnsignedInt32() throws IOException {
final ByteArrayInputStream bin = new ByteArrayInputStream(new byte[] { 2, 3, 4, (byte) 128 });
assertEquals(2 + 3 * 256 + 4 * 256 * 256 + 128l * 256 * 256 * 256,
assertEquals(2 + 3 * 256 + 4 * 256 * 256 + 128L * 256 * 256 * 256,
fromLittleEndian(new InputStreamByteSupplier(bin), 4));
}

Expand All @@ -125,7 +125,7 @@ public void fromLittleEndianFromDataInput() throws IOException {
@Test
public void fromLittleEndianFromDataInputUnsignedInt32() throws IOException {
final DataInput din = new DataInputStream(new ByteArrayInputStream(new byte[] { 2, 3, 4, (byte) 128 }));
assertEquals(2 + 3 * 256 + 4 * 256 * 256 + 128l * 256 * 256 * 256, fromLittleEndian(din, 4));
assertEquals(2 + 3 * 256 + 4 * 256 * 256 + 128L * 256 * 256 * 256, fromLittleEndian(din, 4));
}

@Test(expected = IllegalArgumentException.class)
Expand All @@ -151,7 +151,7 @@ public void toLittleEndianToStream() throws IOException {
@Test
public void toLittleEndianToStreamUnsignedInt32() throws IOException {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
toLittleEndian(bos, 2 + 3 * 256 + 4 * 256 * 256 + 128l * 256 * 256 * 256, 4);
toLittleEndian(bos, 2 + 3 * 256 + 4 * 256 * 256 + 128L * 256 * 256 * 256, 4);
bos.close();
assertArrayEquals(new byte[] { 2, 3, 4, (byte) 128 }, bos.toByteArray());
}
Expand All @@ -167,7 +167,7 @@ public void toLittleEndianToConsumer() throws IOException {
@Test
public void toLittleEndianToConsumerUnsignedInt32() throws IOException {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
toLittleEndian(new OutputStreamByteConsumer(bos), 2 + 3 * 256 + 4 * 256 * 256 + 128l * 256 * 256 * 256, 4);
toLittleEndian(new OutputStreamByteConsumer(bos), 2 + 3 * 256 + 4 * 256 * 256 + 128L * 256 * 256 * 256, 4);
bos.close();
assertArrayEquals(new byte[] { 2, 3, 4, (byte) 128 }, bos.toByteArray());
}
Expand All @@ -185,7 +185,7 @@ public void toLittleEndianToDataOutput() throws IOException {
public void toLittleEndianToDataOutputUnsignedInt32() throws IOException {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final DataOutput dos = new DataOutputStream(bos);
toLittleEndian(dos, 2 + 3 * 256 + 4 * 256 * 256 + 128l * 256 * 256 * 256, 4);
toLittleEndian(dos, 2 + 3 * 256 + 4 * 256 * 256 + 128L * 256 * 256 * 256, 4);
bos.close();
assertArrayEquals(new byte[] { 2, 3, 4, (byte) 128 }, bos.toByteArray());
}
Expand All @@ -201,7 +201,7 @@ public void toLittleEndianToByteArray() throws IOException {
@Test
public void toLittleEndianToByteArrayUnsignedInt32() throws IOException {
final byte[] b = new byte[4];
toLittleEndian(b, 2 + 3 * 256 + 4 * 256 * 256 + 128l * 256 * 256 * 256, 0, 4);
toLittleEndian(b, 2 + 3 * 256 + 4 * 256 * 256 + 128L * 256 * 256 * 256, 0, 4);
assertArrayEquals(new byte[] { 2, 3, 4, (byte) 128 }, b);
}
}

0 comments on commit 0628668

Please sign in to comment.