From f1f20db42313032578ba256903d0004dd126a60a Mon Sep 17 00:00:00 2001 From: Daniel Brahneborg Date: Sun, 14 Apr 2002 12:03:02 +0000 Subject: More correct residual sis file truncation --- lib/sisfile.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/sisfile.cpp') diff --git a/lib/sisfile.cpp b/lib/sisfile.cpp index df60695..97fde1d 100644 --- a/lib/sisfile.cpp +++ b/lib/sisfile.cpp @@ -49,6 +49,7 @@ SISFile::compareApp(SISFile* other) SisRC SISFile::fillFrom(uint8_t* buf, off_t len) { + m_end = 0; int ix = 0; m_buf = buf; SisRC rc = m_header.fillFrom(buf, &ix, len); @@ -77,6 +78,7 @@ SISFile::fillFrom(uint8_t* buf, off_t len) return rc; } } + updateEnd(ix); // Read requisites. // @@ -94,11 +96,14 @@ SISFile::fillFrom(uint8_t* buf, off_t len) return rc; } } + updateEnd(ix); // Read component names, by language. // ix = m_header.m_componentPtr; - rc = m_componentRecord.fillFrom(buf, ix, len, this); + rc = m_componentRecord.fillFrom(buf, &ix, len, this); + updateEnd(ix); + updateEnd(m_componentRecord.getLastEnd()); if (rc != SIS_OK) { printf(_("Problem reading the name record, rc = %d.\n"), rc); @@ -125,6 +130,7 @@ SISFile::fillFrom(uint8_t* buf, off_t len) return rc; } } + updateEnd(ix); return SIS_OK; } @@ -165,3 +171,10 @@ SISFile::setLanguage(int lang) m_header.m_installationLanguage = lang; } +void +SISFile::updateEnd(uint32_t pos) +{ + if (m_end < pos) + m_end = pos; +} + -- cgit v1.2.3