* If only a part of the data could be read, the part that couldn't been read
is now cleared - this changes the behaviour of bug #603, but doesn't fix it (as this is no DiskProbe bug). * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17621 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2005, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2004-2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -939,6 +939,11 @@ DataEditor::Update()
|
|||||||
if (bytesRead < B_OK)
|
if (bytesRead < B_OK)
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
|
|
||||||
|
if ((size_t)bytesRead < fRealViewSize) {
|
||||||
|
// make sure the rest of data is cleared
|
||||||
|
memset(fView + bytesRead, 0, fRealViewSize - bytesRead);
|
||||||
|
}
|
||||||
|
|
||||||
ApplyChanges();
|
ApplyChanges();
|
||||||
fNeedsUpdate = false;
|
fNeedsUpdate = false;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2004-2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ DataView::MessageReceived(BMessage *message)
|
|||||||
fOffset = offset;
|
fOffset = offset;
|
||||||
SetSelection(0, 0);
|
SetSelection(0, 0);
|
||||||
MakeVisible(0);
|
MakeVisible(0);
|
||||||
}
|
}
|
||||||
if (message->FindInt32("view_size", &viewSize) == B_OK) {
|
if (message->FindInt32("view_size", &viewSize) == B_OK) {
|
||||||
fDataSize = viewSize;
|
fDataSize = viewSize;
|
||||||
fData = (uint8 *)realloc(fData, fDataSize);
|
fData = (uint8 *)realloc(fData, fDataSize);
|
||||||
@@ -318,7 +318,7 @@ DataView::ConvertLine(char *line, off_t offset, const uint8 *buffer, size_t size
|
|||||||
}
|
}
|
||||||
|
|
||||||
line += sprintf(line, fBase == kHexBase ? "%0*Lx: " : "%0*Ld: ",
|
line += sprintf(line, fBase == kHexBase ? "%0*Lx: " : "%0*Ld: ",
|
||||||
(int)fPositionLength, offset);
|
(int)fPositionLength, offset);
|
||||||
|
|
||||||
for (uint32 i = 0; i < kBlockSize; i++) {
|
for (uint32 i = 0; i < kBlockSize; i++) {
|
||||||
if (i >= size) {
|
if (i >= size) {
|
||||||
@@ -359,7 +359,7 @@ DataView::Draw(BRect updateRect)
|
|||||||
BPoint location(kHorizontalSpace, kVerticalSpace + fAscent);
|
BPoint location(kHorizontalSpace, kVerticalSpace + fAscent);
|
||||||
|
|
||||||
for (uint32 i = 0; i < fSizeInView; i += kBlockSize) {
|
for (uint32 i = 0; i < fSizeInView; i += kBlockSize) {
|
||||||
ConvertLine(line, /*fOffset + */i, fData + i, fSizeInView - i);
|
ConvertLine(line, i, fData + i, fSizeInView - i);
|
||||||
DrawString(line, location);
|
DrawString(line, location);
|
||||||
|
|
||||||
location.y += fFontHeight;
|
location.y += fFontHeight;
|
||||||
|
|||||||
Reference in New Issue
Block a user