mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
Fixed warnings
This commit is contained in:
parent
b567e76c17
commit
5aa1e9456a
1 changed files with 16 additions and 9 deletions
|
@ -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,11 +158,13 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock
|
||||||
targetRequestFailed( e.getMessage(), null );
|
targetRequestFailed( e.getMessage(), null );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (block != null) {
|
||||||
fWordSize= block.getWordSize();
|
fWordSize= block.getWordSize();
|
||||||
fHaveWordSize= true;
|
fHaveWordSize= true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return fWordSize;
|
return fWordSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
if (bytes != null) {
|
||||||
fBytes = new MemoryByte[bytes.length];
|
fBytes = new MemoryByte[bytes.length];
|
||||||
for ( int i = 0; i < bytes.length; ++i ) {
|
for ( int i = 0; i < bytes.length; ++i ) {
|
||||||
fBytes[i] = createMemoryByte( bytes[i], getCDIBlock().getFlags( i ), hasChanged( getRealBlockAddress().add( BigInteger.valueOf( 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();
|
||||||
|
|
Loading…
Add table
Reference in a new issue