+ free(d->Buffer);
+ delete d;
+}
+ /*}}}*/
+// TagFile::Offset - Return the current offset in the buffer /*{{{*/
+APT_PURE unsigned long pkgTagFile::Offset()
+{
+ return d->iOffset;
+}
+ /*}}}*/
+// TagFile::Resize - Resize the internal buffer /*{{{*/
+// ---------------------------------------------------------------------
+/* Resize the internal buffer (double it in size). Fail if a maximum size
+ * size is reached.
+ */
+bool pkgTagFile::Resize()
+{
+ // fail is the buffer grows too big
+ if(d->Size > 1024*1024+1)
+ return false;
+
+ return Resize(d->Size * 2);
+}
+bool pkgTagFile::Resize(unsigned long long const newSize)
+{
+ unsigned long long const EndSize = d->End - d->Start;
+
+ // get new buffer and use it
+ char* newBuffer = (char*)realloc(d->Buffer, sizeof(char) * newSize);
+ if (newBuffer == NULL)
+ return false;
+ d->Buffer = newBuffer;
+ d->Size = newSize;
+
+ // update the start/end pointers to the new buffer
+ d->Start = d->Buffer;
+ d->End = d->Start + EndSize;
+ return true;