mirror of
https://github.com/fadden/ciderpress.git
synced 2024-11-29 20:49:27 +00:00
Minor cleanup
This commit is contained in:
parent
0d5bfa593f
commit
84ba460957
@ -212,9 +212,7 @@ int AcuEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
|
|||||||
SET_PROGRESS_BEGIN();
|
SET_PROGRESS_BEGIN();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generally speaking, anything in a BNY file is going to be small. The
|
* Generally speaking, anything in an ACU file is going to be small.
|
||||||
* major exception is a BXY file, which could be huge. However, the
|
|
||||||
* SHK embedded in a BXY is never squeezed.
|
|
||||||
*
|
*
|
||||||
* To make life easy, we either unsqueeze the entire thing into a buffer
|
* To make life easy, we either unsqueeze the entire thing into a buffer
|
||||||
* and then write that, or we do a file-to-file copy of the specified
|
* and then write that, or we do a file-to-file copy of the specified
|
||||||
@ -383,7 +381,7 @@ GenericArchive::OpenResult AcuArchive::Open(const WCHAR* filename,
|
|||||||
{
|
{
|
||||||
CString errMsg;
|
CString errMsg;
|
||||||
|
|
||||||
fIsReadOnly = true; // ignore "readOnly"
|
//fIsReadOnly = true; // ignore "readOnly"
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
fFp = _wfopen(filename, L"rb");
|
fFp = _wfopen(filename, L"rb");
|
||||||
@ -740,6 +738,9 @@ void AcuArchive::AcuConvertDateTime(uint16_t prodosDate,
|
|||||||
|
|
||||||
bool AcuArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
|
bool AcuArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
|
||||||
{
|
{
|
||||||
|
// TODO: this is essentially copy & paste from NufxArchive::TestSelection().
|
||||||
|
// We can move the implementation to GenericArchive and just have an
|
||||||
|
// archive-specific TestEntry() function.
|
||||||
NuError nerr;
|
NuError nerr;
|
||||||
AcuEntry* pEntry;
|
AcuEntry* pEntry;
|
||||||
CString errMsg;
|
CString errMsg;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See the file LICENSE for distribution terms.
|
* See the file LICENSE for distribution terms.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* AppleLink Compression Utility archive support.
|
* AppleLink Compression Utility archive support (read-only).
|
||||||
*/
|
*/
|
||||||
#ifndef APP_ACUARCHIVE_H
|
#ifndef APP_ACUARCHIVE_H
|
||||||
#define APP_ACUARCHIVE_H
|
#define APP_ACUARCHIVE_H
|
||||||
@ -33,11 +33,14 @@ public:
|
|||||||
virtual long GetSelectionSerial(void) const override { return -1; }
|
virtual long GetSelectionSerial(void) const override { return -1; }
|
||||||
|
|
||||||
virtual bool GetFeatureFlag(Feature feature) const override {
|
virtual bool GetFeatureFlag(Feature feature) const override {
|
||||||
if (feature == kFeaturePascalTypes || feature == kFeatureDOSTypes ||
|
if (feature == kFeatureHasFullAccess ||
|
||||||
feature == kFeatureHasSimpleAccess)
|
feature == kFeatureCanChangeType ||
|
||||||
return false;
|
feature == kFeatureHasInvisibleFlag)
|
||||||
else
|
{
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -60,7 +63,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
NuError CopyData(FILE* outfp, ConvertEOL conv, ConvertHighASCII convHA,
|
NuError CopyData(FILE* outfp, ConvertEOL conv, ConvertHighASCII convHA,
|
||||||
CString* pMsg) const;
|
CString* pMsg) const;
|
||||||
//NuError BNYUnSqueeze(ExpandBuffer* outExp) const;
|
|
||||||
|
|
||||||
AcuArchive* fpArchive; // holds FILE* for archive
|
AcuArchive* fpArchive; // holds FILE* for archive
|
||||||
bool fIsSqueezed;
|
bool fIsSqueezed;
|
||||||
@ -73,8 +75,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
class AcuArchive : public GenericArchive {
|
class AcuArchive : public GenericArchive {
|
||||||
public:
|
public:
|
||||||
AcuArchive(void) : fIsReadOnly(false), fFp(NULL)
|
AcuArchive(void) : fFp(NULL) {}
|
||||||
{}
|
|
||||||
virtual ~AcuArchive(void) { (void) Close(); }
|
virtual ~AcuArchive(void) { (void) Close(); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -102,7 +103,7 @@ public:
|
|||||||
virtual CString Flush(void) override { return ""; }
|
virtual CString Flush(void) override { return ""; }
|
||||||
|
|
||||||
virtual CString Reload(void) override;
|
virtual CString Reload(void) override;
|
||||||
virtual bool IsReadOnly(void) const override { return fIsReadOnly; };
|
virtual bool IsReadOnly(void) const override { return true; };
|
||||||
virtual bool IsModified(void) const override { return false; }
|
virtual bool IsModified(void) const override { return false; }
|
||||||
virtual void GetDescription(CString* pStr) const override
|
virtual void GetDescription(CString* pStr) const override
|
||||||
{ *pStr = "AppleLink ACU"; }
|
{ *pStr = "AppleLink ACU"; }
|
||||||
@ -158,7 +159,7 @@ private:
|
|||||||
fclose(fFp);
|
fclose(fFp);
|
||||||
fFp = NULL;
|
fFp = NULL;
|
||||||
}
|
}
|
||||||
return "";
|
return L"";
|
||||||
}
|
}
|
||||||
virtual void XferPrepare(const XferFileOptions* pXferOpts) override
|
virtual void XferPrepare(const XferFileOptions* pXferOpts) override
|
||||||
{ ASSERT(false); }
|
{ ASSERT(false); }
|
||||||
@ -185,12 +186,12 @@ private:
|
|||||||
/*
|
/*
|
||||||
* The header at the front of an ACU archive.
|
* The header at the front of an ACU archive.
|
||||||
*/
|
*/
|
||||||
typedef struct AcuMasterHeader {
|
struct AcuMasterHeader {
|
||||||
uint16_t fileCount;
|
uint16_t fileCount;
|
||||||
uint16_t unknown1; // 0x01 00 -- might be "version 1?"
|
uint16_t unknown1; // 0x01 00 -- might be "version 1?"
|
||||||
uint8_t fZink[6]; // "fZink", low ASCII
|
uint8_t fZink[6]; // "fZink", low ASCII
|
||||||
uint8_t unknown2[11]; // 0x01 36 00 00 00 00 00 00 00 00 dd
|
uint8_t unknown2[11]; // 0x01 36 00 00 00 00 00 00 00 00 dd
|
||||||
} AcuMasterHeader;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An entry in an ACU archive. Each archive is essentially a stream
|
* An entry in an ACU archive. Each archive is essentially a stream
|
||||||
@ -200,9 +201,9 @@ private:
|
|||||||
* We read this from the archive and then unpack the interesting parts
|
* We read this from the archive and then unpack the interesting parts
|
||||||
* into GenericEntry fields in an AcuEntry.
|
* into GenericEntry fields in an AcuEntry.
|
||||||
*/
|
*/
|
||||||
struct AcuFileEntry;
|
//struct AcuFileEntry;
|
||||||
friend struct AcuFileEntry;
|
//friend struct AcuFileEntry;
|
||||||
typedef struct AcuFileEntry {
|
struct AcuFileEntry {
|
||||||
uint8_t compressionType;
|
uint8_t compressionType;
|
||||||
uint16_t dataChecksum; // ??
|
uint16_t dataChecksum; // ??
|
||||||
uint16_t blockCount; // total blocks req'd to hold file
|
uint16_t blockCount; // total blocks req'd to hold file
|
||||||
@ -225,7 +226,7 @@ private:
|
|||||||
// possibilities for mystery fields:
|
// possibilities for mystery fields:
|
||||||
// - OS type (note ProDOS is $00)
|
// - OS type (note ProDOS is $00)
|
||||||
// - forked file support
|
// - forked file support
|
||||||
} AcuFileEntry;
|
};
|
||||||
|
|
||||||
/* known compression types */
|
/* known compression types */
|
||||||
enum CompressionType {
|
enum CompressionType {
|
||||||
@ -291,7 +292,7 @@ private:
|
|||||||
uint16_t prodosTime, NuDateTime* pWhen);
|
uint16_t prodosTime, NuDateTime* pWhen);
|
||||||
|
|
||||||
FILE* fFp;
|
FILE* fFp;
|
||||||
bool fIsReadOnly;
|
//bool fIsReadOnly;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*APP_ACUARCHIVE_H*/
|
#endif /*APP_ACUARCHIVE_H*/
|
||||||
|
@ -39,13 +39,13 @@ const int kFileTypeBAS = 0xfc;
|
|||||||
/*
|
/*
|
||||||
* Set of data allowed in file property "set file info" calls.
|
* Set of data allowed in file property "set file info" calls.
|
||||||
*/
|
*/
|
||||||
typedef struct FileProps {
|
struct FileProps {
|
||||||
uint32_t fileType;
|
uint32_t fileType;
|
||||||
uint32_t auxType;
|
uint32_t auxType;
|
||||||
uint32_t access;
|
uint32_t access;
|
||||||
time_t createWhen;
|
time_t createWhen;
|
||||||
time_t modWhen;
|
time_t modWhen;
|
||||||
} FileProps;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Options for converting between file archives and disk archives.
|
* Options for converting between file archives and disk archives.
|
||||||
@ -117,16 +117,16 @@ public:
|
|||||||
kAllowDamaged = 0x80,
|
kAllowDamaged = 0x80,
|
||||||
};
|
};
|
||||||
/* EOL conversion mode for threads being extracted */
|
/* EOL conversion mode for threads being extracted */
|
||||||
typedef enum ConvertEOL {
|
enum ConvertEOL {
|
||||||
kConvertUnknown = 0, kConvertEOLOff, kConvertEOLOn, kConvertEOLAuto
|
kConvertUnknown = 0, kConvertEOLOff, kConvertEOLOn, kConvertEOLAuto
|
||||||
} ConvertEOL;
|
};
|
||||||
typedef enum EOLType {
|
enum EOLType {
|
||||||
kEOLUnknown = 0, kEOLCR, kEOLLF, kEOLCRLF
|
kEOLUnknown = 0, kEOLCR, kEOLLF, kEOLCRLF
|
||||||
};
|
};
|
||||||
/* high ASCII conversion mode for threads being extracted */
|
/* high ASCII conversion mode for threads being extracted */
|
||||||
typedef enum ConvertHighASCII {
|
enum ConvertHighASCII {
|
||||||
kConvertHAUnknown = 0, kConvertHAOff, kConvertHAOn, kConvertHAAuto
|
kConvertHAUnknown = 0, kConvertHAOff, kConvertHAOn, kConvertHAAuto
|
||||||
} ConvertHighASCII;
|
};
|
||||||
|
|
||||||
/* ProDOS access flags, used for all filesystems */
|
/* ProDOS access flags, used for all filesystems */
|
||||||
enum {
|
enum {
|
||||||
@ -138,8 +138,12 @@ public:
|
|||||||
kAccessDelete = 0x80
|
kAccessDelete = 0x80
|
||||||
};
|
};
|
||||||
|
|
||||||
/* features supported by underlying archive */
|
/*
|
||||||
typedef enum Feature {
|
* Features supported by underlying archive. Primarily of interest
|
||||||
|
* to EditPropsDialog, which needs to know what sort of attributes can
|
||||||
|
* be altered in the file type and access flags.
|
||||||
|
*/
|
||||||
|
enum Feature {
|
||||||
kFeatureCanChangeType,
|
kFeatureCanChangeType,
|
||||||
kFeaturePascalTypes,
|
kFeaturePascalTypes,
|
||||||
kFeatureDOSTypes,
|
kFeatureDOSTypes,
|
||||||
@ -147,7 +151,7 @@ public:
|
|||||||
kFeatureHasFullAccess,
|
kFeatureHasFullAccess,
|
||||||
kFeatureHasSimpleAccess, // mutually exclusive with FullAccess
|
kFeatureHasSimpleAccess, // mutually exclusive with FullAccess
|
||||||
kFeatureHasInvisibleFlag,
|
kFeatureHasInvisibleFlag,
|
||||||
} Feature;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extract data from an archive (NuFX, disk image, etc).
|
* Extract data from an archive (NuFX, disk image, etc).
|
||||||
@ -384,13 +388,13 @@ public:
|
|||||||
return fNumEntries;
|
return fNumEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef enum {
|
enum OpenResult {
|
||||||
kResultUnknown = 0,
|
kResultUnknown = 0,
|
||||||
kResultSuccess, // open succeeded
|
kResultSuccess, // open succeeded
|
||||||
kResultFailure, // open failed
|
kResultFailure, // open failed
|
||||||
kResultCancel, // open was cancelled by user
|
kResultCancel, // open was cancelled by user
|
||||||
kResultFileArchive, // found a file archive rather than disk image
|
kResultFileArchive, // found a file archive rather than disk image
|
||||||
} OpenResult;
|
};
|
||||||
|
|
||||||
// Open an archive and do fun things with the innards.
|
// Open an archive and do fun things with the innards.
|
||||||
virtual OpenResult Open(const WCHAR* filename, bool readOnly,
|
virtual OpenResult Open(const WCHAR* filename, bool readOnly,
|
||||||
@ -410,13 +414,13 @@ public:
|
|||||||
virtual void ClearReloadFlag(void) { fReloadFlag = false; }
|
virtual void ClearReloadFlag(void) { fReloadFlag = false; }
|
||||||
|
|
||||||
// One of these for every sub-class.
|
// One of these for every sub-class.
|
||||||
typedef enum {
|
enum ArchiveKind {
|
||||||
kArchiveUnknown = 0,
|
kArchiveUnknown = 0,
|
||||||
kArchiveNuFX,
|
kArchiveNuFX,
|
||||||
kArchiveBNY,
|
kArchiveBNY,
|
||||||
kArchiveACU,
|
kArchiveACU,
|
||||||
kArchiveDiskImage,
|
kArchiveDiskImage,
|
||||||
} ArchiveKind;
|
};
|
||||||
|
|
||||||
// Returns the kind of archive this is (disk image, NuFX, BNY, etc).
|
// Returns the kind of archive this is (disk image, NuFX, BNY, etc).
|
||||||
virtual ArchiveKind GetArchiveKind(void) = 0;
|
virtual ArchiveKind GetArchiveKind(void) = 0;
|
||||||
@ -465,9 +469,9 @@ public:
|
|||||||
const RecompressOptionsDialog* pRecompOpts) = 0;
|
const RecompressOptionsDialog* pRecompOpts) = 0;
|
||||||
|
|
||||||
// return result from XferSelection()
|
// return result from XferSelection()
|
||||||
typedef enum {
|
enum XferStatus {
|
||||||
kXferOK = 0, kXferFailed = 1, kXferCancelled = 2, kXferOutOfSpace = 3
|
kXferOK = 0, kXferFailed = 1, kXferCancelled = 2, kXferOutOfSpace = 3
|
||||||
} XferStatus;
|
};
|
||||||
|
|
||||||
// Transfer selected files out of this archive and into another.
|
// Transfer selected files out of this archive and into another.
|
||||||
virtual XferStatus XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
|
virtual XferStatus XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
|
||||||
@ -495,7 +499,7 @@ public:
|
|||||||
|
|
||||||
// Determine an archive's capabilities. This is specific to the object
|
// Determine an archive's capabilities. This is specific to the object
|
||||||
// instance, so this must not be made a static function.
|
// instance, so this must not be made a static function.
|
||||||
typedef enum {
|
enum Capability {
|
||||||
kCapUnknown = 0,
|
kCapUnknown = 0,
|
||||||
|
|
||||||
kCapCanTest, // NuFX, BNY
|
kCapCanTest, // NuFX, BNY
|
||||||
@ -506,7 +510,7 @@ public:
|
|||||||
kCapCanConvEOLOnAdd, // Disk
|
kCapCanConvEOLOnAdd, // Disk
|
||||||
kCapCanCreateSubdir, // Disk
|
kCapCanCreateSubdir, // Disk
|
||||||
kCapCanRenameVolume, // Disk
|
kCapCanRenameVolume, // Disk
|
||||||
} Capability;
|
};
|
||||||
virtual long GetCapability(Capability cap) = 0;
|
virtual long GetCapability(Capability cap) = 0;
|
||||||
|
|
||||||
// Get the pathname of the file we opened.
|
// Get the pathname of the file we opened.
|
||||||
|
@ -35,10 +35,12 @@ public:
|
|||||||
virtual bool GetFeatureFlag(Feature feature) const override {
|
virtual bool GetFeatureFlag(Feature feature) const override {
|
||||||
if (feature == kFeaturePascalTypes || feature == kFeatureDOSTypes ||
|
if (feature == kFeaturePascalTypes || feature == kFeatureDOSTypes ||
|
||||||
feature == kFeatureHasSimpleAccess)
|
feature == kFeatureHasSimpleAccess)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
else
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Analyzes the contents of a record to determine if it's a disk, file,
|
* Analyzes the contents of a record to determine if it's a disk, file,
|
||||||
|
Loading…
Reference in New Issue
Block a user