1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

Fixed warnings

This commit is contained in:
John Cortell 2010-01-13 17:18:58 +00:00
parent b567e76c17
commit 5aa1e9456a

View file

@ -13,6 +13,8 @@ package org.eclipse.cdt.debug.internal.core.model;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISession; import org.eclipse.cdt.debug.core.cdi.ICDISession;
@ -66,7 +68,7 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock
*/ */
private MemoryByte[] fBytes = null; private MemoryByte[] fBytes = null;
private HashSet fChanges = new HashSet(); private Set<BigInteger> fChanges = new HashSet<BigInteger>();
/** /**
* is fWordSize available? * is fWordSize available?
@ -156,8 +158,10 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock
targetRequestFailed( e.getMessage(), null ); targetRequestFailed( e.getMessage(), null );
} }
} }
fWordSize= block.getWordSize(); if (block != null) {
fHaveWordSize= true; fWordSize= block.getWordSize();
fHaveWordSize= true;
}
} }
} }
} }
@ -216,14 +220,16 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock
catch( CDIException e ) { catch( CDIException e ) {
targetRequestFailed( e.getMessage(), null ); targetRequestFailed( e.getMessage(), null );
} }
fBytes = new MemoryByte[bytes.length]; if (bytes != null) {
for ( int i = 0; i < bytes.length; ++i ) { fBytes = new MemoryByte[bytes.length];
fBytes[i] = createMemoryByte( bytes[i], getCDIBlock().getFlags( i ), hasChanged( getRealBlockAddress().add( BigInteger.valueOf( i ) ) ) ); for ( int i = 0; i < bytes.length; ++i ) {
fBytes[i] = createMemoryByte( bytes[i], getCDIBlock().getFlags( i ), hasChanged( getRealBlockAddress().add( BigInteger.valueOf( i ) ) ) );
}
} }
} }
} }
MemoryByte[] result = new MemoryByte[0]; MemoryByte[] result = new MemoryByte[0];
if ( fBytes != null ) { if ( fBytes != null && cdiBlock != null ) {
int offset = address.subtract( getRealBlockAddress() ).intValue(); int offset = address.subtract( getRealBlockAddress() ).intValue();
int offsetInBytes = offset * cdiBlock.getWordSize(); int offsetInBytes = offset * cdiBlock.getWordSize();
long lengthInBytes = length * cdiBlock.getWordSize(); long lengthInBytes = length * cdiBlock.getWordSize();
@ -381,7 +387,7 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock
private void handleChangedEvent( ICDIMemoryChangedEvent event ) { private void handleChangedEvent( ICDIMemoryChangedEvent event ) {
ICDIMemoryBlock block = getCDIBlock(); ICDIMemoryBlock block = getCDIBlock();
if ( block != null && fBytes != null ) { if ( block != null && fBytes != null ) {
MemoryByte[] memBytes = (MemoryByte[])fBytes.clone(); MemoryByte[] memBytes = fBytes.clone();
try { try {
BigInteger start = getRealBlockAddress(); BigInteger start = getRealBlockAddress();
long length = block.getLength(); long length = block.getLength();
@ -419,7 +425,7 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock
private void resetChanges() { private void resetChanges() {
if ( fBytes != null ) { if ( fBytes != null ) {
BigInteger[] changes = (BigInteger[])fChanges.toArray( new BigInteger[fChanges.size()] ); BigInteger[] changes = fChanges.toArray( new BigInteger[fChanges.size()] );
for ( int i = 0; i < changes.length; ++i ) { for ( int i = 0; i < changes.length; ++i ) {
BigInteger real = getRealBlockAddress(); BigInteger real = getRealBlockAddress();
if ( real.compareTo( changes[i] ) <= 0 && real.add( BigInteger.valueOf( getBlockSize() ) ).compareTo( changes[i] ) > 0 ) { if ( real.compareTo( changes[i] ) <= 0 && real.add( BigInteger.valueOf( getBlockSize() ) ).compareTo( changes[i] ) > 0 ) {
@ -487,6 +493,7 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/ */
@SuppressWarnings("rawtypes")
public Object getAdapter( Class adapter ) { public Object getAdapter( Class adapter ) {
if ( IMemoryBlockRetrieval.class.equals( adapter ) ) if ( IMemoryBlockRetrieval.class.equals( adapter ) )
return getMemoryBlockRetrieval(); return getMemoryBlockRetrieval();