mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Corrected javadoc errors/warnings
This commit is contained in:
parent
3e0117a1e9
commit
bae897b0c1
14 changed files with 917 additions and 52 deletions
|
@ -195,7 +195,7 @@ public class GhidraState {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the current selection and fire a {@link kProgramSelectionPluginEvent}.
|
||||
* Set the current selection and fire a {@link ProgramSelectionPluginEvent}.
|
||||
*
|
||||
* @param selection the selection
|
||||
*/
|
||||
|
|
|
@ -157,7 +157,7 @@ public interface ElfConstants {
|
|||
|
||||
/**No machine*/
|
||||
public static final short EM_NONE = 0;
|
||||
/** AT&T WE 32100 */
|
||||
/** AT&T WE 32100 */
|
||||
public static final short EM_M32 = 1;
|
||||
/**SUN SPARC */
|
||||
public static final short EM_SPARC = 2;
|
||||
|
|
|
@ -52,7 +52,7 @@ public abstract class AbstractDemangledFunctionDefinitionDataType extends Demang
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the string for this type of reference (e.g., * or &)
|
||||
* Returns the string for this type of reference (e.g., * or &)
|
||||
* @return the string
|
||||
*/
|
||||
abstract protected String getTypeString();
|
||||
|
|
|
@ -187,12 +187,12 @@ public class Pattern extends DittedBitSequence {
|
|||
/**
|
||||
* Read just the post patterns from the <patternpair> tags
|
||||
* @param file is the file to read from
|
||||
* @param patternlist collects the resulting Pattern objects
|
||||
* @param patternList collects the resulting Pattern objects
|
||||
* @param pfactory is the factory for constructing postrules and matchactions
|
||||
* @throws IOException
|
||||
* @throws SAXException
|
||||
*/
|
||||
public static void readPostPatterns(File file, ArrayList<Pattern> patlist,
|
||||
public static void readPostPatterns(File file, ArrayList<Pattern> patternList,
|
||||
PatternFactory pfactory) throws SAXException, IOException {
|
||||
ErrorHandler handler = new ErrorHandler() {
|
||||
@Override
|
||||
|
@ -217,7 +217,7 @@ public class Pattern extends DittedBitSequence {
|
|||
if (el.getName().equals("patternpairs")) {
|
||||
PatternPairSet pairset = new PatternPairSet();
|
||||
pairset.restoreXml(parser, pfactory);
|
||||
pairset.extractPostPatterns(patlist);
|
||||
pairset.extractPostPatterns(patternList);
|
||||
}
|
||||
else {
|
||||
parser.next();
|
||||
|
|
|
@ -0,0 +1,842 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ghidra.program.model.data;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MyBitfieldTest extends AbstractCompositeImplBitFieldTest {
|
||||
|
||||
private static DataTypeManager dataMgr;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
dataMgr = getDataTypeManager();
|
||||
}
|
||||
|
||||
protected class MyDataTypeManager extends StandAloneDataTypeManager {
|
||||
MyDataTypeManager(String name, DataOrganization dataOrg) {
|
||||
super(name);
|
||||
this.dataOrganization = dataOrg;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DataTypeManager getDataTypeManager() {
|
||||
synchronized (MyBitfieldTest.class) {
|
||||
if (dataMgr == null) {
|
||||
DataOrganizationImpl dataOrg = DataOrganizationImpl.getDefaultOrganization(null);
|
||||
DataOrganizationTestUtils.initDataOrganizationWindows64BitX86(dataOrg);
|
||||
dataMgr = new MyDataTypeManager("test", dataOrg);
|
||||
}
|
||||
return dataMgr;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBitField() throws InvalidDataTypeException {
|
||||
|
||||
// NOTE: Exercise Enum bitfield
|
||||
|
||||
getDataTypeManager().startTransaction("TEST");
|
||||
|
||||
EnumDataType myEnum = new EnumDataType("myEnum", 4);
|
||||
|
||||
Structure s = new StructureDataType("Foo", 0);
|
||||
s.setInternallyAligned(true);
|
||||
s.addBitField(myEnum, 2, "b1", null);
|
||||
s.addBitField(myEnum, 3, "b2", null);
|
||||
|
||||
Structure s2 = (Structure) getDataTypeManager().resolve(s, null);
|
||||
|
||||
System.out.println(CompositeTestUtils.dump(s2, false).trim());
|
||||
|
||||
assertTrue(s2.isEquivalent(s));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsA1() {
|
||||
Structure struct = getStructure("A1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/A1\n" +
|
||||
"Aligned\n" +
|
||||
"Structure A1 {\n" +
|
||||
" 0 char[5] 5 a \"\"\n" +
|
||||
" 8 int:3(0) 1 b \"\"\n" +
|
||||
" 8 int:8(3) 2 c \"\"\n" +
|
||||
" 9 int:8(3) 2 d \"\"\n" +
|
||||
" 10 int:6(3) 2 e \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 12 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsA2() {
|
||||
Structure struct = getStructure("A2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/A2\n" +
|
||||
"Aligned\n" +
|
||||
"Structure A2 {\n" +
|
||||
" 0 oddStruct 5 a \"\"\n" +
|
||||
" 8 int:3(0) 1 b \"\"\n" +
|
||||
" 8 int:8(3) 2 c \"\"\n" +
|
||||
" 9 int:8(3) 2 d \"\"\n" +
|
||||
" 10 int:6(3) 2 e \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 12 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsB1() {
|
||||
Structure struct = getStructure("B1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/B1\n" +
|
||||
"Aligned\n" +
|
||||
"Structure B1 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 short:4(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 12 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsB1Flex() {
|
||||
Structure struct = getStructure("B1flex");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/B1flex\n" +
|
||||
"Aligned\n" +
|
||||
"Structure B1flex {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 short:4(0) 1 d \"\"\n" +
|
||||
" long[0] 0 flex \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 12 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsB2() {
|
||||
Structure struct = getStructure("B2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/B2\n" +
|
||||
"Aligned\n" +
|
||||
"Structure B2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 5 int:4(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 8 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsB3() {
|
||||
Structure struct = getStructure("B3");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/B3\n" +
|
||||
"Aligned\n" +
|
||||
"Structure B3 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 char 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 12 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ1() {
|
||||
Structure struct = getStructure("Z1");
|
||||
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z1\n" +
|
||||
"Aligned\n" +
|
||||
"Structure Z1 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 int:0(0) 1 \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 short:4(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 12 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ2() {
|
||||
Structure struct = getStructure("Z2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z2\n" +
|
||||
"Aligned\n" +
|
||||
"Structure Z2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 int:0(0) 1 \"\"\n" +
|
||||
" 8 short:4(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 12 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ3() {
|
||||
Structure struct = getStructure("Z3");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z3\n" +
|
||||
"Aligned\n" +
|
||||
"Structure Z3 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 5 int:4(0) 1 d \"\"\n" +
|
||||
" 7 longlong:0(0) 1 \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 8 Actual Alignment = 8", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ4() {
|
||||
Structure struct = getStructure("Z4");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z4\n" +
|
||||
"Aligned\n" +
|
||||
"Structure Z4 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 longlong:0(0) 1 \"\"\n" +
|
||||
" 8 char 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 16 Actual Alignment = 8", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ5() {
|
||||
Structure struct = getStructure("Z5");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z5\n" +
|
||||
"Aligned\n" +
|
||||
"Structure Z5 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 8 int:0(0) 1 \"\"\n" +
|
||||
" 8 longlong:6(0) 1 b \"\"\n" +
|
||||
" 16 int:8(0) 1 c \"\"\n" +
|
||||
" 20 char 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 24 Actual Alignment = 8", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ6() {
|
||||
Structure struct = getStructure("Z6");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z6\n" +
|
||||
"Aligned\n" +
|
||||
"Structure Z6 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 8 int:0(0) 1 \"\"\n" +
|
||||
" 8 longlong:6(0) 1 b \"\"\n" +
|
||||
" 16 int:8(0) 1 c \"\"\n" +
|
||||
" 20 char 1 d \"\"\n" +
|
||||
" 24 longlong:6(0) 1 e \"\"\n" +
|
||||
" 32 int:8(0) 1 f \"\"\n" +
|
||||
" 36 char 1 g \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 40 Actual Alignment = 8", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsB1p1() {
|
||||
Structure struct = getStructure("B1p1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/B1p1\n" +
|
||||
"Aligned pack(1)\n" +
|
||||
"Structure B1p1 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 1 ushort:6(0) 1 b \"\"\n" +
|
||||
" 3 int:8(0) 1 c \"\"\n" +
|
||||
" 7 short:4(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 9 Actual Alignment = 1", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsB2p1() {
|
||||
Structure struct = getStructure("B2p1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/B2p1\n" +
|
||||
"Aligned pack(1)\n" +
|
||||
"Structure B2p1 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 1 ushort:6(0) 1 b \"\"\n" +
|
||||
" 3 int:8(0) 1 c \"\"\n" +
|
||||
" 4 int:4(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 7 Actual Alignment = 1", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsB3p1() {
|
||||
Structure struct = getStructure("B3p1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/B3p1\n" +
|
||||
"Aligned pack(1)\n" +
|
||||
"Structure B3p1 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 1 ushort:6(0) 1 b \"\"\n" +
|
||||
" 3 int:8(0) 1 c \"\"\n" +
|
||||
" 7 char 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 8 Actual Alignment = 1", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ1p1() {
|
||||
Structure struct = getStructure("Z1p1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z1p1\n" +
|
||||
"Aligned pack(1)\n" +
|
||||
"Structure Z1p1 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 1 int:0(0) 1 \"\"\n" +
|
||||
" 1 ushort:6(0) 1 b \"\"\n" +
|
||||
" 3 int:8(0) 1 c \"\"\n" +
|
||||
" 7 short:4(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 9 Actual Alignment = 1", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ2p1() {
|
||||
Structure struct = getStructure("Z2p1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z2p1\n" +
|
||||
"Aligned pack(1)\n" +
|
||||
"Structure Z2p1 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 1 ushort:6(0) 1 b \"\"\n" +
|
||||
" 3 int:8(0) 1 c \"\"\n" +
|
||||
" 7 int:0(0) 1 \"\"\n" +
|
||||
" 7 short:4(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 9 Actual Alignment = 1", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ3p1() {
|
||||
Structure struct = getStructure("Z3p1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z3p1\n" +
|
||||
"Aligned pack(1)\n" +
|
||||
"Structure Z3p1 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 1 ushort:6(0) 1 b \"\"\n" +
|
||||
" 3 int:8(0) 1 c \"\"\n" +
|
||||
" 4 int:4(0) 1 d \"\"\n" +
|
||||
" 6 longlong:0(0) 1 \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 7 Actual Alignment = 1", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ3p1T() {
|
||||
Structure struct = getStructure("Z3p1T");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z3p1T\n" +
|
||||
"Aligned\n" +
|
||||
"Structure Z3p1T {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 1 Z3p1 7 z3p1 \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 8 Actual Alignment = 1", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ4p1() {
|
||||
Structure struct = getStructure("Z4p1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z4p1\n" +
|
||||
"Aligned pack(1)\n" +
|
||||
"Structure Z4p1 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 1 ushort:6(0) 1 b \"\"\n" +
|
||||
" 3 int:8(0) 1 c \"\"\n" +
|
||||
" 7 longlong:0(0) 1 \"\"\n" +
|
||||
" 7 char 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 8 Actual Alignment = 1", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsB1p2() {
|
||||
Structure struct = getStructure("B1p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/B1p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure B1p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 short:4(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 10 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsB2p2() {
|
||||
Structure struct = getStructure("B2p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/B2p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure B2p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 5 int:4(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 8 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsB3p2() {
|
||||
Structure struct = getStructure("B3p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/B3p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure B3p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 char 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 10 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsB4p2() {
|
||||
Structure struct = getStructure("B4p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/B4p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure B4p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 longlong 8 d \"\"\n" +
|
||||
" 16 int:4(0) 1 e \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 20 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ1p2() {
|
||||
Structure struct = getStructure("Z1p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z1p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure Z1p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 int:0(0) 1 \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 short:4(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 10 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ1p2x() {
|
||||
Structure struct = getStructure("Z1p2x");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z1p2x\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure Z1p2x {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 int:0(0) 1 \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 short:4(0) 1 d \"\"\n" +
|
||||
" 8 short:4(4) 1 d1 \"\"\n" +
|
||||
" 9 short:4(0) 1 d2 \"\"\n" +
|
||||
" 9 short:4(4) 1 d3 \"\"\n" +
|
||||
" 10 short:4(0) 1 d4 \"\"\n" +
|
||||
" 10 short:4(4) 1 d5 \"\"\n" +
|
||||
" 11 short:4(0) 1 d6 \"\"\n" +
|
||||
" 11 short:4(4) 1 d7 \"\"\n" +
|
||||
" 12 short:0(0) 1 \"\"\n" +
|
||||
" 12 ushort:6(0) 1 _b \"\"\n" +
|
||||
" 14 int:8(0) 1 _c \"\"\n" +
|
||||
" 18 short:4(0) 1 _d \"\"\n" +
|
||||
" 18 short:4(4) 1 _d1 \"\"\n" +
|
||||
" 19 short:4(0) 1 _d2 \"\"\n" +
|
||||
" 19 short:4(4) 1 _d3 \"\"\n" +
|
||||
" 20 short:4(0) 1 _d4 \"\"\n" +
|
||||
" 20 short:4(4) 1 _d5 \"\"\n" +
|
||||
" 21 short:4(0) 1 _d6 \"\"\n" +
|
||||
" 21 short:4(4) 1 _d7 \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 22 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ2p2() {
|
||||
Structure struct = getStructure("Z2p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z2p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure Z2p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 int:0(0) 1 \"\"\n" +
|
||||
" 8 short:4(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 10 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ3p2() {
|
||||
Structure struct = getStructure("Z3p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z3p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure Z3p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 5 int:4(0) 1 d \"\"\n" +
|
||||
" 7 longlong:0(0) 1 \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 8 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ4p2() {
|
||||
Structure struct = getStructure("Z4p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z4p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure Z4p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:6(0) 1 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 longlong:0(0) 1 \"\"\n" +
|
||||
" 8 char 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 10 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ5p2() {
|
||||
Structure struct = getStructure("Z5p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z5p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure Z5p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:12(0) 2 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 longlong:0(0) 1 \"\"\n" +
|
||||
" 8 char 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 10 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFields_x1p2() {
|
||||
Structure struct = getStructure("x1p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/x1p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure x1p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 1 Actual Alignment = 1", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFields_x2p2() {
|
||||
Structure struct = getStructure("x2p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/x2p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure x2p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 int:27(0) 4 b \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 6 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFields_x3p2() {
|
||||
Structure struct = getStructure("x3p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/x3p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure x3p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 short:0(0) 1 \"\"\n" +
|
||||
" 2 int:27(0) 4 b \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 6 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFields_x4p2() {
|
||||
Structure struct = getStructure("x4p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/x4p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure x4p2 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 int:27(0) 4 b \"\"\n" +
|
||||
" 5 longlong:0(0) 1 \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 6 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsZ5p4() {
|
||||
Structure struct = getStructure("Z5p4");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/Z5p4\n" +
|
||||
"Aligned pack(4)\n" +
|
||||
"Structure Z5p4 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 2 ushort:12(0) 2 b \"\"\n" +
|
||||
" 4 int:8(0) 1 c \"\"\n" +
|
||||
" 8 longlong:0(0) 1 \"\"\n" +
|
||||
" 8 char 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 12 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFields_x1p4() {
|
||||
Structure struct = getStructure("x1p4");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/x1p4\n" +
|
||||
"Aligned pack(4)\n" +
|
||||
"Structure x1p4 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 1 Actual Alignment = 1", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFields_x2p4() {
|
||||
Structure struct = getStructure("x2p4");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/x2p4\n" +
|
||||
"Aligned pack(4)\n" +
|
||||
"Structure x2p4 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 4 int:27(0) 4 b \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 8 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFields_x3p4() {
|
||||
Structure struct = getStructure("x3p4");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/x3p4\n" +
|
||||
"Aligned pack(4)\n" +
|
||||
"Structure x3p4 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 4 short:0(0) 1 \"\"\n" +
|
||||
" 4 int:27(0) 4 b \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 8 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFields_x4p4() {
|
||||
Structure struct = getStructure("x4p4");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/x4p4\n" +
|
||||
"Aligned pack(4)\n" +
|
||||
"Structure x4p4 {\n" +
|
||||
" 0 char 1 a \"\"\n" +
|
||||
" 4 int:27(0) 4 b \"\"\n" +
|
||||
" 7 longlong:0(0) 1 \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 8 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsT1() {
|
||||
Structure struct = getStructure("T1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/T1\n" +
|
||||
"Aligned\n" +
|
||||
"Structure T1 {\n" +
|
||||
" 0 charTypedef 1 a \"\"\n" +
|
||||
" 4 myEnum:3(0) 1 b \"\"\n" +
|
||||
" 4 enumTypedef:3(3) 1 c \"\"\n" +
|
||||
" 8 charTypedef:7(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 12 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsT2() {
|
||||
Structure struct = getStructure("T2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/T2\n" +
|
||||
"Aligned\n" +
|
||||
"Structure T2 {\n" +
|
||||
" 0 charTypedef 1 a \"\"\n" +
|
||||
" 4 intTypedef:17(0) 3 b \"\"\n" +
|
||||
" 6 enumTypedef:3(1) 1 c \"\"\n" +
|
||||
" 8 charTypedef:3(0) 1 d \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 12 Actual Alignment = 4", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsS1() {
|
||||
Structure struct = getStructure("S1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/S1\n" +
|
||||
"Aligned\n" +
|
||||
"Structure S1 {\n" +
|
||||
" 0 B1 12 b1 \"\"\n" +
|
||||
" 12 B2 8 b2 \"\"\n" +
|
||||
" 20 Z1 12 z1 \"\"\n" +
|
||||
" 32 Z2 12 z2 \"\"\n" +
|
||||
" 48 Z3 8 z3 \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 56 Actual Alignment = 8", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsS1p1() {
|
||||
Structure struct = getStructure("S1p1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/S1p1\n" +
|
||||
"Aligned pack(1)\n" +
|
||||
"Structure S1p1 {\n" +
|
||||
" 0 B1 12 b1 \"\"\n" +
|
||||
" 12 B2 8 b2 \"\"\n" +
|
||||
" 20 Z1 12 z1 \"\"\n" +
|
||||
" 32 Z2 12 z2 \"\"\n" +
|
||||
" 44 Z3 8 z3 \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 52 Actual Alignment = 1", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsS2p1() {
|
||||
Structure struct = getStructure("S2p1");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/S2p1\n" +
|
||||
"Aligned pack(1)\n" +
|
||||
"Structure S2p1 {\n" +
|
||||
" 0 B1p1 9 b1p1 \"\"\n" +
|
||||
" 9 B2p1 7 b2p1 \"\"\n" +
|
||||
" 16 Z1p1 9 z1p1 \"\"\n" +
|
||||
" 25 Z2p1 9 z2p1 \"\"\n" +
|
||||
" 34 Z3p1 7 z3p1 \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 41 Actual Alignment = 1", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsS1p2() {
|
||||
Structure struct = getStructure("S1p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/S1p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure S1p2 {\n" +
|
||||
" 0 B1 12 b1 \"\"\n" +
|
||||
" 12 B2 8 b2 \"\"\n" +
|
||||
" 20 Z1 12 z1 \"\"\n" +
|
||||
" 32 Z2 12 z2 \"\"\n" +
|
||||
" 44 Z3 8 z3 \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 52 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStructureBitFieldsS2p2() {
|
||||
Structure struct = getStructure("S2p2");
|
||||
//@formatter:off
|
||||
CompositeTestUtils.assertExpectedComposite(this, "/S2p2\n" +
|
||||
"Aligned pack(2)\n" +
|
||||
"Structure S2p2 {\n" +
|
||||
" 0 B1p2 10 b1p2 \"\"\n" +
|
||||
" 10 B2p2 8 b2p2 \"\"\n" +
|
||||
" 18 Z1p2 10 z1p2 \"\"\n" +
|
||||
" 28 Z2p2 10 z2p2 \"\"\n" +
|
||||
" 38 Z3p2 8 z3p2 \"\"\n" +
|
||||
"}\n" +
|
||||
"Size = 46 Actual Alignment = 2", struct);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
}
|
|
@ -54,6 +54,7 @@ public class DBHandle {
|
|||
/**
|
||||
* Construct a temporary database handle.
|
||||
* The saveAs method must be used to save the database.
|
||||
* @throws IOException if a IO error occurs
|
||||
*/
|
||||
public DBHandle() throws IOException {
|
||||
this(BufferMgr.DEFAULT_BUFFER_SIZE, BufferMgr.DEFAULT_CACHE_SIZE);
|
||||
|
@ -62,18 +63,23 @@ public class DBHandle {
|
|||
/**
|
||||
* Construct a temporary database handle.
|
||||
* The saveAs method must be used to save the database.
|
||||
* @param requestedBufferSize requested buffer size. Actual buffer size may vary.
|
||||
* @throws IOException if a IO error occurs
|
||||
*/
|
||||
public DBHandle(int requestBufferSize) throws IOException {
|
||||
this(requestBufferSize, BufferMgr.DEFAULT_CACHE_SIZE);
|
||||
public DBHandle(int requestedBufferSize) throws IOException {
|
||||
this(requestedBufferSize, BufferMgr.DEFAULT_CACHE_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a temporary database handle.
|
||||
* The saveAs method must be used to save the database.
|
||||
* @param requestedBufferSize requested buffer size. Actual buffer size may vary.
|
||||
* @param approxCacheSize approximate size of cache in Bytes.
|
||||
* @throws IOException if a IO error occurs
|
||||
*/
|
||||
public DBHandle(int requestBufferSize, long approxCacheSize) throws IOException {
|
||||
public DBHandle(int requestedBufferSize, long approxCacheSize) throws IOException {
|
||||
bufferMgr =
|
||||
new BufferMgr(requestBufferSize, approxCacheSize, BufferMgr.DEFAULT_CHECKPOINT_COUNT);
|
||||
new BufferMgr(requestedBufferSize, approxCacheSize, BufferMgr.DEFAULT_CHECKPOINT_COUNT);
|
||||
dbParms = new DBParms(bufferMgr, true);
|
||||
dbParms.set(DBParms.MASTER_TABLE_ROOT_BUFFER_ID_PARM, -1);
|
||||
masterTable = new MasterTable(this);
|
||||
|
@ -108,7 +114,7 @@ public class DBHandle {
|
|||
* @param recover if true an attempt will be made to recover unsaved data if the file is open for update
|
||||
* @param monitor recovery monitor
|
||||
* @throws IOException if IO error occurs
|
||||
* @throws CancelledException
|
||||
* @throws CancelledException if buffer file recovery is cancelled
|
||||
*/
|
||||
public DBHandle(BufferFile bufferFile, boolean recover, TaskMonitor monitor)
|
||||
throws IOException, CancelledException {
|
||||
|
@ -137,7 +143,7 @@ public class DBHandle {
|
|||
* for non-update use. This method is provided primarily
|
||||
* for testing.
|
||||
* @param file buffer file
|
||||
* @throws IOException
|
||||
* @throws IOException if IO error occurs
|
||||
*/
|
||||
public DBHandle(File file) throws IOException {
|
||||
BufferFile bfile = new LocalBufferFile(file, true);
|
||||
|
@ -159,8 +165,9 @@ public class DBHandle {
|
|||
|
||||
/**
|
||||
* Check the consistency of this database.
|
||||
* @param monitor task monitor
|
||||
* @return true if consistency check passed, else false
|
||||
* @throws CancelledException
|
||||
* @throws CancelledException if consistency check is cancelled
|
||||
*/
|
||||
public boolean isConsistent(TaskMonitor monitor) throws CancelledException {
|
||||
int consistentCount = 0;
|
||||
|
@ -182,8 +189,9 @@ public class DBHandle {
|
|||
* Rebuild database tables to resolve certain consistency problems. Use of this
|
||||
* method does not recover lost data which may have occurred during original
|
||||
* database corruption.
|
||||
* @param monitor task monitor
|
||||
* @return true if rebuild succeeded, else false
|
||||
* @throws CancelledException
|
||||
* @throws CancelledException if rebuild is cancelled
|
||||
*/
|
||||
public boolean rebuild(TaskMonitor monitor) throws CancelledException {
|
||||
for (Table table : getTables()) {
|
||||
|
@ -205,8 +213,8 @@ public class DBHandle {
|
|||
* WARNING! Use with extreme caution since this modifies
|
||||
* the original file and could destroy data if used
|
||||
* improperly.
|
||||
* @param file
|
||||
* @throws IOException
|
||||
* @param file database buffer file to be updated
|
||||
* @throws IOException if IO error occurs
|
||||
*/
|
||||
public static void resetDatabaseId(File file) throws IOException {
|
||||
long databaseId = UniversalIdGenerator.nextID().getValue();
|
||||
|
@ -226,7 +234,7 @@ public class DBHandle {
|
|||
|
||||
/**
|
||||
* Read current databaseId
|
||||
* @throws IOException
|
||||
* @throws IOException if IO error occurs
|
||||
*/
|
||||
private void readDatabaseId() throws IOException {
|
||||
try {
|
||||
|
@ -239,7 +247,7 @@ public class DBHandle {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns unique database ID or 0 if this is an older read-only database.
|
||||
* @return unique database ID or 0 if this is an older read-only database.
|
||||
*/
|
||||
public long getDatabaseId() {
|
||||
return databaseId;
|
||||
|
@ -249,7 +257,8 @@ public class DBHandle {
|
|||
* Returns the recovery changeSet data file for reading or null if one is not available.
|
||||
* The caller must dispose of the returned file before peforming generating any new
|
||||
* recovery snapshots.
|
||||
* @throws IOException
|
||||
* @return recovery changeSet data file for reading or null if one is not available.
|
||||
* @throws IOException if IO error occurs
|
||||
*/
|
||||
public LocalBufferFile getRecoveryChangeSetFile() throws IOException {
|
||||
return bufferMgr.getRecoveryChangeSetFile();
|
||||
|
@ -262,7 +271,7 @@ public class DBHandle {
|
|||
* @param monitor task monitor
|
||||
* @return true if snapshot successful or not needed, false if an active transaction prevented snapshot
|
||||
* @throws CancelledException if cancelled by monitor
|
||||
* @throws IOException
|
||||
* @throws IOException if IO error occurs
|
||||
*/
|
||||
public boolean takeRecoverySnapshot(DBChangeSet changeSet, TaskMonitor monitor)
|
||||
throws CancelledException, IOException {
|
||||
|
@ -292,7 +301,8 @@ public class DBHandle {
|
|||
* Returns a shared temporary database handle.
|
||||
* This temporary handle will remain open unitl either this
|
||||
* handle is closed or closeScratchPad is invoked.
|
||||
* @throws IOException
|
||||
* @return shared temporary database handle.
|
||||
* @throws IOException if IO error occurs
|
||||
*/
|
||||
public DBHandle getScratchPad() throws IOException {
|
||||
if (scratchPad == null) {
|
||||
|
@ -314,7 +324,7 @@ public class DBHandle {
|
|||
|
||||
/**
|
||||
* Add Database listener
|
||||
* @param listener
|
||||
* @param listener database listener
|
||||
*/
|
||||
public void addListener(DBListener listener) {
|
||||
listenerList.add(listener);
|
||||
|
@ -388,7 +398,7 @@ public class DBHandle {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if transaction is currently active
|
||||
* @return true if transaction is currently active
|
||||
*/
|
||||
public boolean isTransactionActive() {
|
||||
return txStarted;
|
||||
|
@ -414,7 +424,7 @@ public class DBHandle {
|
|||
* @param commit if true a new checkpoint will be established, if
|
||||
* false all changes since the previous checkpoint will be discarded.
|
||||
* @return true if new checkpoint established.
|
||||
* @throws IOException
|
||||
* @throws IOException if IO error occurs
|
||||
*/
|
||||
public synchronized boolean endTransaction(long id, boolean commit) throws IOException {
|
||||
if (id != lastTransactionID) {
|
||||
|
@ -467,7 +477,7 @@ public class DBHandle {
|
|||
* All upper-levels must clear table-based cached data prior to
|
||||
* invoking this method.
|
||||
* @return true if an undo was successful
|
||||
* @throws IOException
|
||||
* @throws IOException if IO error occurs
|
||||
*/
|
||||
public synchronized boolean undo() throws IOException {
|
||||
if (canUndo() && bufferMgr.undo(true)) {
|
||||
|
@ -479,14 +489,14 @@ public class DBHandle {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns number of undo-able transactions
|
||||
* @return number of undo-able transactions
|
||||
*/
|
||||
public int getAvailableUndoCount() {
|
||||
return bufferMgr != null ? bufferMgr.getAvailableUndoCount() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of redo-able transactions
|
||||
* @return the number of redo-able transactions
|
||||
*/
|
||||
public int getAvailableRedoCount() {
|
||||
return bufferMgr != null ? bufferMgr.getAvailableRedoCount() : 0;
|
||||
|
@ -506,7 +516,7 @@ public class DBHandle {
|
|||
* All upper-levels must clear table-based cached data prior to
|
||||
* invoking this method.
|
||||
* @return boolean
|
||||
* @throws IOException
|
||||
* @throws IOException if IO error occurs
|
||||
*/
|
||||
public synchronized boolean redo() throws IOException {
|
||||
if (canRedo() && bufferMgr.redo()) {
|
||||
|
@ -565,7 +575,8 @@ public class DBHandle {
|
|||
|
||||
/**
|
||||
* Close the database and dispose of the underlying buffer manager.
|
||||
* @param keepRecoveryData
|
||||
* @param keepRecoveryData true if existing recovery data should be retained or false to remove
|
||||
* any recovery data
|
||||
*/
|
||||
public synchronized void close(boolean keepRecoveryData) {
|
||||
closeScratchPad();
|
||||
|
@ -577,14 +588,14 @@ public class DBHandle {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if unsaved changes have been made.
|
||||
* @return true if unsaved changes have been made.
|
||||
*/
|
||||
public synchronized boolean isChanged() {
|
||||
return bufferMgr != null && bufferMgr.isChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this database handle has been closed.
|
||||
* @return true if this database handle has been closed.
|
||||
*/
|
||||
public boolean isClosed() {
|
||||
return bufferMgr == null;
|
||||
|
@ -628,7 +639,6 @@ public class DBHandle {
|
|||
* will be written and set as read-only. The caller is responsbile for disposing the outFile if
|
||||
* this parameter is false.
|
||||
* @param monitor progress monitor
|
||||
* @param associateWithNewFile if true this handle will be associated with the new file
|
||||
* @throws IOException if IO error occurs
|
||||
* @throws CancelledException if monitor cancels operation
|
||||
*/
|
||||
|
@ -860,6 +870,8 @@ public class DBHandle {
|
|||
/**
|
||||
* Returns the Table that was created with the given name or null if
|
||||
* no such table exists.
|
||||
* @param name of requested table
|
||||
* @return table instance or null if not found
|
||||
*/
|
||||
public Table getTable(String name) {
|
||||
return tables.get(name);
|
||||
|
@ -881,7 +893,11 @@ public class DBHandle {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new table with the given name, version and type.
|
||||
* Creates a new non-indexed table with the given name, version and type.
|
||||
* @param name name of new table
|
||||
* @param schema table schema to be applied
|
||||
* @return new table instance
|
||||
* @throws IOException if IO error occurs
|
||||
*/
|
||||
public synchronized Table createTable(String name, Schema schema) throws IOException {
|
||||
|
||||
|
@ -897,6 +913,11 @@ public class DBHandle {
|
|||
/**
|
||||
* Creates a new table with the given name, version and type.
|
||||
* Create secondary indexes as specified by the array of column indexes.
|
||||
* @param name name of new table
|
||||
* @param schema table schema to be applied
|
||||
* @param indexedColumns array of column indices which should have an index associated with them
|
||||
* @return new table instance
|
||||
* @throws IOException if IO error occurs
|
||||
*/
|
||||
public synchronized Table createTable(String name, Schema schema, int[] indexedColumns)
|
||||
throws IOException {
|
||||
|
@ -992,6 +1013,7 @@ public class DBHandle {
|
|||
* buffer size. This value may be used to instatiate a
|
||||
* new BufferFile which is compatible with this database
|
||||
* when using the saveAs method.
|
||||
* @return buffer size utilized by this database
|
||||
*/
|
||||
public int getBufferSize() {
|
||||
return bufferMgr.getBufferSize();
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
* in the current tree view (collapsed). Of course, that decision would need to be balanced
|
||||
* against the extra time to reload the nodes in the event that a filter is applied. Also, if
|
||||
* some external event occurs that changes the set of children for a GTreeLazyNode, you can call
|
||||
* {@link #reload()} to refresh the node's children.
|
||||
* {@link #unloadChildren()} to clear any previously loaded children.
|
||||
*/
|
||||
public abstract class GTreeLazyNode extends GTreeNode {
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class RestrictedValueSortedMap<K, V> implements ValueSortedMap<K, V> {
|
|||
/**
|
||||
* Construct an iterator starting at a given index of the <em>sub</em> list.
|
||||
*
|
||||
* @param start
|
||||
* @param start initial iterator position
|
||||
*/
|
||||
public RestrictedEntryListIterator(int start) {
|
||||
this.wit = wrapped.entrySet().listIterator(getLowestIndex() + start);
|
||||
|
@ -125,7 +125,7 @@ public class RestrictedValueSortedMap<K, V> implements ValueSortedMap<K, V> {
|
|||
/**
|
||||
* Construct an iterator starting at a given index of the <em>sub</em> list.
|
||||
*
|
||||
* @param start
|
||||
* @param start initial iterator position
|
||||
*/
|
||||
public RestrictedKeyListIterator(int start) {
|
||||
this.wit = new RestrictedEntryListIterator(start);
|
||||
|
@ -186,8 +186,6 @@ public class RestrictedValueSortedMap<K, V> implements ValueSortedMap<K, V> {
|
|||
|
||||
/**
|
||||
* Construct an iterator
|
||||
*
|
||||
* @param start
|
||||
*/
|
||||
public RestrictedValueListIterator() {
|
||||
this(0);
|
||||
|
@ -196,7 +194,7 @@ public class RestrictedValueSortedMap<K, V> implements ValueSortedMap<K, V> {
|
|||
/**
|
||||
* Construct an iterator starting at a given index of the <em>sub</em> list.
|
||||
*
|
||||
* @param start
|
||||
* @param start initial iterator position
|
||||
*/
|
||||
public RestrictedValueListIterator(int start) {
|
||||
this.wit = new RestrictedEntryListIterator(start);
|
||||
|
|
|
@ -24,8 +24,8 @@ import java.util.*;
|
|||
* This is an extension of {@link Map} where entries are sorted by value, rather than by key. Such a
|
||||
* map may be useful as a priority queue where the cost of an entry may change over time. As such,
|
||||
* the collections returned by {@link #entrySet()}, {@link #keySet()}, and {@link #values()} all
|
||||
* extend {@link Deque}. The order of the entries will be updated on any call to {@link #put(Object,
|
||||
* Object))}, or a call to {@link Collection#add(Object)} on the entry set. Additionally, if the
|
||||
* extend {@link Deque}. The order of the entries will be updated on any call to {@link Map#put(Object, Object)},
|
||||
* or a call to {@link Collection#add(Object)} on the entry set. Additionally, if the
|
||||
* values are mutable objects, whose order may change, there is an {@link #update(Object)} method,
|
||||
* which notifies the map that the given key may need to be repositioned. The associated collections
|
||||
* also extend the {@link List} interface, providing fairly efficient implementations of
|
||||
|
|
|
@ -39,7 +39,7 @@ import sun.security.x509.*;
|
|||
* suffice.
|
||||
* <p>
|
||||
* <b>NOTE:</b> This class makes direct use of classes within the
|
||||
* {@link sun.security.x509} package thus breaking portability. While this is
|
||||
* <code>sun.security.x509</code> package thus breaking portability. While this is
|
||||
* not preferred, the ability to generate X.509 certificates and keystores
|
||||
* appears to be absent from the standard java/javax packages.
|
||||
*/
|
||||
|
|
|
@ -31,7 +31,7 @@ public class LittleEndianDataConverter implements DataConverter {
|
|||
|
||||
/**
|
||||
* Don't use this constructor to create new instances of this class. Use the static {@link #INSTANCE} instead
|
||||
* or {@link DataConverter#getInstance(Endian)}
|
||||
* or {@link DataConverter#getInstance(boolean)}
|
||||
*/
|
||||
public LittleEndianDataConverter() {
|
||||
// empty
|
||||
|
|
|
@ -71,7 +71,6 @@ public class FVSlider extends JSlider
|
|||
* @param scrollPane
|
||||
* @param table
|
||||
* @param viewportUtility
|
||||
* @param eventListener
|
||||
* @param model
|
||||
* @param reader
|
||||
* @param eventListener
|
||||
|
|
|
@ -51,27 +51,27 @@ public interface AddressSetView extends Iterable<AddressRange> {
|
|||
public boolean contains(AddressSetView rangeSet);
|
||||
|
||||
/**
|
||||
* Returns true if this set is empty.
|
||||
* @return true if this set is empty.
|
||||
*/
|
||||
public boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Return the minimum address for this set. Returns null if the set is empty.
|
||||
* @return the minimum address for this set. Returns null if the set is empty.
|
||||
*/
|
||||
public Address getMinAddress();
|
||||
|
||||
/**
|
||||
* Return the maximum address for this set. Returns null if the set is empty.
|
||||
* @return the maximum address for this set. Returns null if the set is empty.
|
||||
*/
|
||||
public Address getMaxAddress();
|
||||
|
||||
/**
|
||||
* Return the number of address ranges in this set.
|
||||
* @return the number of address ranges in this set.
|
||||
*/
|
||||
public int getNumAddressRanges();
|
||||
|
||||
/**
|
||||
* Returns an iterator over the address ranges in this address set.
|
||||
* @return an iterator over the address ranges in this address set.
|
||||
*/
|
||||
public AddressRangeIterator getAddressRanges();
|
||||
|
||||
|
@ -120,7 +120,7 @@ public interface AddressSetView extends Iterable<AddressRange> {
|
|||
public Iterator<AddressRange> iterator(Address start, boolean forward);
|
||||
|
||||
/**
|
||||
* Returns the number of addresses in this set.
|
||||
* @return the number of addresses in this set.
|
||||
*/
|
||||
public long getNumAddresses();
|
||||
|
||||
|
@ -128,6 +128,7 @@ public interface AddressSetView extends Iterable<AddressRange> {
|
|||
* Returns an iterator over all addresses in this set.
|
||||
* @param forward if true the address are return in increasing order, otherwise in
|
||||
* decreasing order.
|
||||
* @return an iterator over all addresses in this set.
|
||||
*/
|
||||
public AddressIterator getAddresses(boolean forward);
|
||||
|
||||
|
@ -136,6 +137,8 @@ public interface AddressSetView extends Iterable<AddressRange> {
|
|||
* starting at the start address
|
||||
* @param start address to start iterating at in the address set
|
||||
* @param forward if true address are return from lowest to highest, else from highest to lowest
|
||||
* @return an iterator over the addresses in this address set
|
||||
* starting at the start address
|
||||
*/
|
||||
public AddressIterator getAddresses(Address start, boolean forward);
|
||||
|
||||
|
@ -143,6 +146,7 @@ public interface AddressSetView extends Iterable<AddressRange> {
|
|||
* Determine if this address set intersects with the specified address set.
|
||||
*
|
||||
* @param addrSet address set to check intersection with.
|
||||
* @return true if this set intersects the specified addrSet else false
|
||||
*/
|
||||
public boolean intersects(AddressSetView addrSet);
|
||||
|
||||
|
@ -196,7 +200,7 @@ public interface AddressSetView extends Iterable<AddressRange> {
|
|||
/**
|
||||
* Computes the exclusive-or of this address set with the given set. This
|
||||
* method does not modify this address set.
|
||||
* @param addrSet
|
||||
* @param addrSet address set to exclusive-or with.
|
||||
* @return AddressSet a new address set containing all addresses that are in
|
||||
* either this set or the given set, but not in both sets
|
||||
*/
|
||||
|
|
|
@ -30,7 +30,7 @@ import ghidra.util.GhidraDataConverter;
|
|||
* the overhead of various error checks. This implementation will not wrap
|
||||
* if the end of the memory space is encountered.
|
||||
*
|
||||
* The {@link #getByte(int), #getBytes(byte[], int)} methods can cause the bytes in the
|
||||
* The {@link #getByte(int)}, {@link #getBytes(byte[], int)} methods can cause the bytes in the
|
||||
* buffer cache if the request is outside of the current cached bytes.
|
||||
*
|
||||
* WARNING: The underlying MemBuffer should not change its base address. Using a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue