- if (Fd.IsOpen() == false)
- {
- Buffer = 0;
- Start = End = Buffer = 0;
- Done = true;
- iOffset = 0;
- return;
- }
-
- Buffer = new char[Size];
- Start = End = Buffer;
- Done = false;
- iOffset = 0;
- Fill();
+ /* The size is increased by 4 because if we start with the Size of the
+ filename we need to try to read 1 char more to see an EOF faster, 1
+ char the end-pointer can be on and maybe 2 newlines need to be added
+ to the end of the file -> 4 extra chars */
+ Size += 4;
+ d = new pkgTagFilePrivate(pFd, Size);
+
+ if (d->Fd.IsOpen() == false)
+ d->Start = d->End = d->Buffer = 0;
+ else
+ d->Buffer = (char*)malloc(sizeof(char) * Size);
+
+ if (d->Buffer == NULL)
+ d->Done = true;
+ else
+ d->Done = false;
+
+ d->Start = d->End = d->Buffer;
+ d->iOffset = 0;
+ if (d->Done == false)
+ Fill();