Removed no longer used code (was only there for testing purposes of the DataEditor).

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6564 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-02-12 02:57:30 +00:00
parent 9e7c0e5d01
commit bc2c92cd36
+1 -128
View File
@@ -51,65 +51,7 @@ class DiskProbe : public BApplication {
};
#define DUMPED_BLOCK_SIZE 16
void
dumpBlock(const uint8 *buffer, int size, const char *prefix)
{
int i;
for (i = 0; i < size;) {
int start = i;
printf(prefix);
for (; i < start+DUMPED_BLOCK_SIZE; i++) {
if (!(i % 4))
printf(" ");
if (i >= size)
printf(" ");
else
printf("%02x", *(unsigned char *)(buffer + i));
}
printf(" ");
for (i = start; i < start + DUMPED_BLOCK_SIZE; i++) {
if (i < size) {
char c = buffer[i];
if (c < 30)
printf(".");
else
printf("%c", c);
} else
break;
}
printf("\n");
}
}
status_t
printBlock(DataEditor &editor, const char *text)
{
puts(text);
const uint8 *buffer;
status_t status = editor.GetViewBuffer(&buffer);
if (status < B_OK) {
fprintf(stderr, "Could not get block: %s\n", strerror(status));
return status;
}
dumpBlock(buffer, editor.FileSize() > editor.ViewOffset() + editor.ViewSize() ?
editor.ViewSize() : editor.FileSize() - editor.ViewOffset(),
"\t");
return B_OK;
}
// #pragma mark -
//-----------------
DiskProbe::DiskProbe()
@@ -121,75 +63,6 @@ DiskProbe::DiskProbe()
fFilePanel = new BFilePanel();
// ToDo: maintain the window position on disk
/*
DataEditor editor;
status_t status = editor.SetTo("/boot/beos/apps/DiskProbe");
if (status < B_OK) {
fprintf(stderr, "Could not set editor: %s\n", strerror(status));
return;
}
editor.SetBlockSize(512);
editor.SetViewOffset(0);
editor.SetViewSize(32);
BAutolock locker(editor.Locker());
if (printBlock(editor, "before (location 0):") < B_OK)
return;
editor.Replace(5, (const uint8 *)"*REPLACED*", 10);
if (printBlock(editor, "after (location 0):") < B_OK)
return;
editor.SetViewOffset(700);
if (printBlock(editor, "before (location 700):") < B_OK)
return;
editor.Replace(713, (const uint8 *)"**REPLACED**", 12);
if (printBlock(editor, "after (location 700):") < B_OK)
return;
status = editor.Undo();
if (status < B_OK)
fprintf(stderr, "Could not undo: %s\n", strerror(status));
if (printBlock(editor, "undo (location 700):") < B_OK)
return;
editor.SetViewOffset(0);
if (printBlock(editor, "after (location 0):") < B_OK)
return;
status = editor.Undo();
if (status < B_OK)
fprintf(stderr, "Could not undo: %s\n", strerror(status));
if (printBlock(editor, "undo (location 0):") < B_OK)
return;
status = editor.Redo();
if (status < B_OK)
fprintf(stderr, "Could not redo: %s\n", strerror(status));
if (printBlock(editor, "redo (location 0):") < B_OK)
return;
status = editor.Redo();
editor.SetViewOffset(700);
if (status < B_OK)
fprintf(stderr, "Could not redo: %s\n", strerror(status));
if (printBlock(editor, "redo (location 700):") < B_OK)
return;
status = editor.Redo();
if (status == B_OK)
fprintf(stderr, "Could apply redo (non-expected behaviour)!\n");
status = editor.Undo();
if (status < B_OK)
fprintf(stderr, "Could not undo: %s\n", strerror(status));
if (printBlock(editor, "undo (location 700):") < B_OK)
return;
*/
}