aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Brahneborg <basic@chello.se>2002-03-19 13:34:53 +0000
committerDaniel Brahneborg <basic@chello.se>2002-03-19 13:34:53 +0000
commit89a3d9a86c9f948829ab173b811709f74685bfe6 (patch)
treebeb4e5806d47b4f4c7d4335deecaf205b4e9634a /lib
parenta7f48478e5126a8cd4b729109ab7aacabc615c66 (diff)
downloadplptools-89a3d9a86c9f948829ab173b811709f74685bfe6.tar.gz
plptools-89a3d9a86c9f948829ab173b811709f74685bfe6.tar.bz2
plptools-89a3d9a86c9f948829ab173b811709f74685bfe6.zip
Remove the previous version (unconditionally) before installing the new
version.
Diffstat (limited to 'lib')
-rw-r--r--lib/sisfile.cpp13
-rw-r--r--lib/sisfile.h13
-rw-r--r--lib/sisfilerecord.cpp8
-rw-r--r--lib/sisfilerecord.h16
4 files changed, 50 insertions, 0 deletions
diff --git a/lib/sisfile.cpp b/lib/sisfile.cpp
index c5d7139..62a2ce1 100644
--- a/lib/sisfile.cpp
+++ b/lib/sisfile.cpp
@@ -28,6 +28,18 @@
#include <stdio.h>
+SISFile::SISFile()
+{
+ m_buf = 0;
+ m_ownBuffer = false;
+}
+
+SISFile::~SISFile()
+{
+ if (m_ownBuffer)
+ delete[] m_buf;
+}
+
SisRC
SISFile::compareApp(SISFile* other)
{
@@ -38,6 +50,7 @@ SisRC
SISFile::fillFrom(uint8_t* buf, off_t len)
{
int ix = 0;
+ m_buf = buf;
SisRC rc = m_header.fillFrom(buf, &ix, len);
if (rc != SIS_OK)
{
diff --git a/lib/sisfile.h b/lib/sisfile.h
index 2bfcea5..d74cc1c 100644
--- a/lib/sisfile.h
+++ b/lib/sisfile.h
@@ -39,6 +39,10 @@ class SISFile
{
public:
+ SISFile();
+
+ virtual ~SISFile();
+
/**
* Compare uid and version number of this file, with another.
*
@@ -70,6 +74,11 @@ public:
*/
uint8_t* getName();
+ void ownBuffer()
+ {
+ m_ownBuffer = true;
+ }
+
/**
* Is this the same application?
*/
@@ -99,6 +108,10 @@ private:
SISComponentNameRecord m_componentRecord;
+ bool m_ownBuffer;
+
+ uint8_t* m_buf;
+
};
#endif
diff --git a/lib/sisfilerecord.cpp b/lib/sisfilerecord.cpp
index 24650da..95e75ed 100644
--- a/lib/sisfilerecord.cpp
+++ b/lib/sisfilerecord.cpp
@@ -32,6 +32,7 @@ SISFileRecord::fillFrom(uint8_t* buf, int* base, off_t len, SISFile* sisFile)
if (*base + 28 + 4 * 2 > len)
return SIS_TRUNCATED;
+ m_buf = buf;
uint8_t* p = buf + *base;
int size = 0;
m_flags = read32(p);
@@ -124,3 +125,10 @@ SISFileRecord::fillFrom(uint8_t* buf, int* base, off_t len, SISFile* sisFile)
return SIS_OK;
}
+void
+SISFileRecord::setMainDrive(char drive)
+{
+ if (m_buf[m_destPtr] == '!')
+ m_buf[m_destPtr] = drive;
+}
+
diff --git a/lib/sisfilerecord.h b/lib/sisfilerecord.h
index dbbbc49..d0ccced 100644
--- a/lib/sisfilerecord.h
+++ b/lib/sisfilerecord.h
@@ -48,6 +48,13 @@ public:
*/
SisRC fillFrom(uint8_t* buf, int* base, off_t len, SISFile* sisFile);
+ uint8_t* getDestPtr()
+ {
+ return &m_buf[m_destPtr];
+ }
+
+ void setMainDrive(char drive);
+
/**
* 1 if multiple language versions, otherwise 0.
*/
@@ -86,6 +93,15 @@ public:
uint32_t m_destPtr;
uint32_t* m_fileLengths;
uint32_t* m_filePtrs;
+
+private:
+
+ /**
+ * The buffer we belong to.
+ * Used for updating the destination file name.
+ */
+ uint8_t* m_buf;
+
};
#endif