mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Cosmetics.
This commit is contained in:
parent
ca4098caac
commit
2c5f599327
3 changed files with 17 additions and 17 deletions
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Ferguson (Symbian) - Initial implementation
|
* Andrew Ferguson (Symbian) - Initial implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.pdom.tests;
|
package org.eclipse.cdt.internal.pdom.tests;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sanity check the DBProperties class
|
* Tests for the {@link DBProperties} class.
|
||||||
*/
|
*/
|
||||||
public class DBPropertiesTests extends BaseTestCase {
|
public class DBPropertiesTests extends BaseTestCase {
|
||||||
File dbLoc;
|
File dbLoc;
|
||||||
|
@ -50,19 +50,19 @@ public class DBPropertiesTests extends BaseTestCase {
|
||||||
public void testBasic() throws CoreException {
|
public void testBasic() throws CoreException {
|
||||||
DBProperties properties = new DBProperties(db);
|
DBProperties properties = new DBProperties(db);
|
||||||
Properties expected = System.getProperties();
|
Properties expected = System.getProperties();
|
||||||
for(Iterator i = expected.keySet().iterator(); i.hasNext(); ) {
|
for (Iterator i = expected.keySet().iterator(); i.hasNext(); ) {
|
||||||
String key = (String) i.next();
|
String key = (String) i.next();
|
||||||
String value = expected.getProperty(key);
|
String value = expected.getProperty(key);
|
||||||
if(value!=null) {
|
if (value != null) {
|
||||||
properties.setProperty(key, value);
|
properties.setProperty(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(Iterator i = expected.keySet().iterator(); i.hasNext(); ) {
|
for (Iterator i = expected.keySet().iterator(); i.hasNext(); ) {
|
||||||
String key = (String) i.next();
|
String key = (String) i.next();
|
||||||
String aValue = properties.getProperty(key);
|
String aValue = properties.getProperty(key);
|
||||||
assertEquals(expected.getProperty(key), aValue);
|
assertEquals(expected.getProperty(key), aValue);
|
||||||
}
|
}
|
||||||
for(Iterator i = expected.keySet().iterator(); i.hasNext(); ) {
|
for (Iterator i = expected.keySet().iterator(); i.hasNext(); ) {
|
||||||
String key = (String) i.next();
|
String key = (String) i.next();
|
||||||
properties.removeProperty(key);
|
properties.removeProperty(key);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ public class DBPropertiesTests extends BaseTestCase {
|
||||||
DBProperties ps = new DBProperties(db);
|
DBProperties ps = new DBProperties(db);
|
||||||
|
|
||||||
StringBuffer largeValue = new StringBuffer();
|
StringBuffer largeValue = new StringBuffer();
|
||||||
for(int i=0; i<Database.CHUNK_SIZE*2; i+=64) {
|
for (int i= 0; i < Database.CHUNK_SIZE * 2; i += 64) {
|
||||||
largeValue.append("********");
|
largeValue.append("********");
|
||||||
ps.setProperty("key", largeValue.toString());
|
ps.setProperty("key", largeValue.toString());
|
||||||
ps.setProperty(largeValue.toString(), "value");
|
ps.setProperty(largeValue.toString(), "value");
|
||||||
|
|
|
@ -102,9 +102,9 @@ final class Chunk {
|
||||||
|
|
||||||
static final int getInt(final byte[] buffer, int idx) {
|
static final int getInt(final byte[] buffer, int idx) {
|
||||||
return ((buffer[idx] & 0xff) << 24) |
|
return ((buffer[idx] & 0xff) << 24) |
|
||||||
((buffer[++idx] & 0xff) << 16) |
|
((buffer[++idx] & 0xff) << 16) |
|
||||||
((buffer[++idx] & 0xff) << 8) |
|
((buffer[++idx] & 0xff) << 8) |
|
||||||
((buffer[++idx] & 0xff) << 0);
|
((buffer[++idx] & 0xff) << 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,7 +130,7 @@ final class Chunk {
|
||||||
* have an unsigned 32-bit value as a long. This gives us one more useful bit in the
|
* have an unsigned 32-bit value as a long. This gives us one more useful bit in the
|
||||||
* stored record pointers.
|
* stored record pointers.
|
||||||
*/
|
*/
|
||||||
long address = value & (((long) 1 << Integer.SIZE) - 1);
|
long address = value & 0xFFFFFFFFL;
|
||||||
return address << Database.BLOCK_SIZE_DELTA_BITS;
|
return address << Database.BLOCK_SIZE_DELTA_BITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,8 +198,8 @@ final class Chunk {
|
||||||
public int get3ByteUnsignedInt(final long offset) {
|
public int get3ByteUnsignedInt(final long offset) {
|
||||||
int idx= recPtrToIndex(offset);
|
int idx= recPtrToIndex(offset);
|
||||||
return ((fBuffer[idx] & 0xff) << 16) |
|
return ((fBuffer[idx] & 0xff) << 16) |
|
||||||
((fBuffer[++idx] & 0xff) << 8) |
|
((fBuffer[++idx] & 0xff) << 8) |
|
||||||
((fBuffer[++idx] & 0xff) << 0);
|
((fBuffer[++idx] & 0xff) << 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void putShort(final long offset, final short value) {
|
public void putShort(final long offset, final short value) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ import com.ibm.icu.text.MessageFormat;
|
||||||
* INT_SIZE * m (1) | pointer to head of linked list of blocks of size (m + MIN_BLOCK_DELTAS) * BLOCK_SIZE_DELTA
|
* INT_SIZE * m (1) | pointer to head of linked list of blocks of size (m + MIN_BLOCK_DELTAS) * BLOCK_SIZE_DELTA
|
||||||
* DATA_AREA | undefined (PDOM stores its own house-keeping data in this area)
|
* DATA_AREA | undefined (PDOM stores its own house-keeping data in this area)
|
||||||
*
|
*
|
||||||
* (1) where 2 <= m <= CHUNK_SIZE/BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS + 1
|
* (1) where 2 <= m <= CHUNK_SIZE / BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS + 1
|
||||||
*
|
*
|
||||||
* ===== block structure
|
* ===== block structure
|
||||||
*
|
*
|
||||||
|
@ -406,12 +406,12 @@ public class Database {
|
||||||
|
|
||||||
private long getFirstBlock(int blocksize) throws CoreException {
|
private long getFirstBlock(int blocksize) throws CoreException {
|
||||||
assert fLocked;
|
assert fLocked;
|
||||||
return fHeaderChunk.getFreeRecPtr((blocksize/BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS + 1) * INT_SIZE);
|
return fHeaderChunk.getFreeRecPtr((blocksize / BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS + 1) * INT_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setFirstBlock(int blocksize, long block) throws CoreException {
|
private void setFirstBlock(int blocksize, long block) throws CoreException {
|
||||||
assert fExclusiveLock;
|
assert fExclusiveLock;
|
||||||
fHeaderChunk.putFreeRecPtr((blocksize/BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS + 1) * INT_SIZE, block);
|
fHeaderChunk.putFreeRecPtr((blocksize / BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS + 1) * INT_SIZE, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeBlock(Chunk chunk, int blocksize, long block) throws CoreException {
|
private void removeBlock(Chunk chunk, int blocksize, long block) throws CoreException {
|
||||||
|
|
Loading…
Add table
Reference in a new issue