Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refine int cast long #348

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void test62872() throws Exception {
cell = row.createCell(j - 1);

//make some noise
cell.setCellValue(new Date(i * TEN_MINUTES + (j * TEN_MINUTES) / COLUMN_COUNT));
cell.setCellValue(new Date((long) i * TEN_MINUTES + (j * TEN_MINUTES) / COLUMN_COUNT));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is test code - not worth changing

}
i++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
public final class Notes extends SheetContainer
{
private byte[] _header;
private static long _type = 1008l;
private static long _type = 1008L;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change the l to an L?


// Links to our more interesting children
private NotesAtom notesAtom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
public final class NotesAtom extends RecordAtom {

private byte[] _header;
private static long _type = 1009l;
private static long _type = 1009L;

private int slideID;
private boolean followMasterObjects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
public final class Slide extends SheetContainer
{
private byte[] _header;
private static long _type = 1006l;
private static long _type = 1006L;

// Links to our more interesting children
private SlideAtom slideAtom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final class SlideAtom extends RecordAtom {
// private static final int MASTER_SLIDE_ID = 0x00000000;

private byte[] _header;
private static long _type = 1007l;
private static long _type = 1007L;

private int masterID;
private int notesID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public final class SlidePersistAtom extends RecordAtom {
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 32;

private static final long _type = 1011l;
private static final long _type = 1011L;
private static final int HAS_SHAPES_OTHER_THAN_PLACEHOLDERS = 4;

private static final int[] FLAGS_MASKS = { HAS_SHAPES_OTHER_THAN_PLACEHOLDERS };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void record(Chunk chunk) {
// Work out what MAPIProperty this corresponds to
MAPIProperty prop = MAPIProperty.get(chunk.getChunkId());
if (prop == MAPIProperty.UNKNOWN) {
long id = (chunk.getChunkId() << 16) + (long)chunk.getType().getId();
long id = ((long) chunk.getChunkId() << 16) + (long)chunk.getType().getId();
prop = unknownProperties.get(id);
if (prop == null) {
prop = MAPIProperty.createCustom(chunk.getChunkId(), chunk.getType(), chunk.getEntryName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private long getStreamID(int propertyKind, int nameOffset, ClassID guid, int gui
Consumer<String> propertyNameSetter, Consumer<Long> propertyNameCRC32Setter) {
if (propertyKind == 0) {
// numerical named property
return 0x1000L + (nameOffset ^ (guidIndex << 1)) % 0x1F;
return 0x1000L + (nameOffset ^ ((long) guidIndex << 1)) % 0x1F;
}

// string named property
Expand All @@ -250,7 +250,7 @@ private long getStreamID(int propertyKind, int nameOffset, ClassID guid, int gui
propertyNameCRC32Setter.accept(propertyNameCRC32);
}
}
return 0x1000 + (propertyNameCRC32 ^ ((guidIndex << 1) | 1)) % 0x1F;
return 0x1000 + (propertyNameCRC32 ^ (((long) guidIndex << 1) | 1)) % 0x1F;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ public final class TestDocumentEncryptionAtom {
@Test
void recordType() throws IOException {
DocumentEncryptionAtom dea1 = new DocumentEncryptionAtom(data_a, 0, data_a.length);
assertEquals(12052l, dea1.getRecordType());
assertEquals(12052L, dea1.getRecordType());

DocumentEncryptionAtom dea2 = new DocumentEncryptionAtom(data_b, 0, data_b.length);
assertEquals(12052l, dea2.getRecordType());
assertEquals(12052L, dea2.getRecordType());

assertEquals(199, data_a.length);
assertEquals(198, data_b.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void testRealFile() throws Exception {
// Get the ExObjList
ExObjList exObjList = doc.getExObjList(false);
assertNotNull(exObjList);
assertEquals(1033l, exObjList.getRecordType());
assertEquals(1033L, exObjList.getRecordType());

// Check the atom
assertNotNull(exObjList.getExObjListAtom());
Expand Down