Fix previous format problem more correctly.
Thanks Ingo, Oliver and Ithamar for the hint.
This commit is contained in:
@@ -184,9 +184,7 @@ MemoryView::Draw(BRect rect)
|
|||||||
for (int32 j = 0; j < currentBlocksPerLine; j++) {
|
for (int32 j = 0; j < currentBlocksPerLine; j++) {
|
||||||
const char* blockAddress = currentAddress + (j
|
const char* blockAddress = currentAddress + (j
|
||||||
* blockByteSize);
|
* blockByteSize);
|
||||||
_GetNextHexBlock(buffer,
|
_GetNextHexBlock(buffer, sizeof(buffer), blockAddress);
|
||||||
std::min((size_t)hexBlockSize, sizeof(buffer)),
|
|
||||||
blockAddress);
|
|
||||||
DrawString(buffer, drawPoint);
|
DrawString(buffer, drawPoint);
|
||||||
if (targetAddress >= blockAddress && targetAddress <
|
if (targetAddress >= blockAddress && targetAddress <
|
||||||
blockAddress + blockByteSize) {
|
blockAddress + blockByteSize) {
|
||||||
@@ -581,7 +579,8 @@ MemoryView::_GetNextHexBlock(char* buffer, int32 bufferSize,
|
|||||||
switch(fHexMode) {
|
switch(fHexMode) {
|
||||||
case HexMode8BitInt:
|
case HexMode8BitInt:
|
||||||
{
|
{
|
||||||
snprintf(buffer, bufferSize, "%02" B_PRIx8, *address);
|
snprintf(buffer, bufferSize, "%02" B_PRIx8,
|
||||||
|
*((const uint8*)address));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HexMode16BitInt:
|
case HexMode16BitInt:
|
||||||
@@ -802,8 +801,7 @@ MemoryView::_GetSelectedText(BString& text)
|
|||||||
|
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
_GetNextHexBlock(buffer, std::min(_GetHexDigitsPerBlock() + 1,
|
_GetNextHexBlock(buffer, sizeof(buffer), data);
|
||||||
(int32)32), data);
|
|
||||||
data += blockSize;
|
data += blockSize;
|
||||||
text << buffer;
|
text << buffer;
|
||||||
if (i < count - 1)
|
if (i < count - 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user