Fixed bug decoding spool file.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2636 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Pfeiffer 2003-02-05 17:43:15 +00:00
parent 657004ba9b
commit 3c79f2fe4f

View File

@ -12,27 +12,21 @@
PictureData::PictureData(BFile *file) PictureData::PictureData(BFile *file)
{ {
off_t offset;
uchar dummy[40];
DBGMSG(("construct PictureData\n")); DBGMSG(("construct PictureData\n"));
DBGMSG(("1: current seek position = 0x%x\n", (int)file->Position())); DBGMSG(("1: current seek position = 0x%x\n", (int)file->Position()));
file->Read(&offset, sizeof(offset));
file->Read(dummy, sizeof(dummy));
file->Read(&point, sizeof(BPoint)); file->Read(&point, sizeof(BPoint));
file->Read(&rect, sizeof(BRect)); file->Read(&rect, sizeof(BRect));
picture = new BPicture(); picture = new BPicture();
DBGMSG(("next picture position = 0x%x\n", (int)offset));
DBGMSG(("picture_data::point = %f, %f\n", point.x, point.y)); DBGMSG(("picture_data::point = %f, %f\n", point.x, point.y));
DBGMSG(("picture_data::rect = %f, %f, %f, %f\n", DBGMSG(("picture_data::rect = %f, %f, %f, %f\n",
rect.left, rect.top, rect.right, rect.bottom)); rect.left, rect.top, rect.right, rect.bottom));
DBGMSG(("2: current seek position = 0x%x\n", (int)file->Position())); DBGMSG(("2: current seek position = 0x%x\n", (int)file->Position()));
picture->Unflatten(file); picture->Unflatten(file);
DBGMSG(("3: current seek position = 0x%x\n", (int)file->Position())); DBGMSG(("3: current seek position = 0x%x\n", (int)file->Position()));
} }
@ -62,15 +56,17 @@ PageData::PageData(BFile *file, bool reverse)
DBGMSG(("picture_count = %d\n", (int)__picture_count)); DBGMSG(("picture_count = %d\n", (int)__picture_count));
__offset = __file->Position(); __offset = __file->Position();
off_t o = __offset; off_t o = __offset;
for (long i = 0; i < __picture_count; i++) { // seek to start of next page
__file->Read(&o, sizeof(o)); __file->Read(&o, sizeof(o));
__file->Seek(o, SEEK_SET); __file->Seek(o, SEEK_SET);
}
} }
} }
bool PageData::startEnum() bool PageData::startEnum()
{ {
off_t offset;
uchar dummy[40];
if (__hollow) if (__hollow)
return false; return false;
@ -81,6 +77,8 @@ bool PageData::startEnum()
} else { } else {
__file->Seek(__offset, SEEK_SET); __file->Seek(__offset, SEEK_SET);
} }
// skip page header
__file->Seek(sizeof(offset) + sizeof(dummy), SEEK_CUR);
__rest = __picture_count; __rest = __picture_count;
return __picture_count > 0; return __picture_count > 0;