From 8778d0dcf263cdd0f40d05c83bed197d8dad5c33 Mon Sep 17 00:00:00 2001 From: ksherlock Date: Mon, 14 Mar 2011 23:15:37 +0000 Subject: [PATCH] git-svn-id: https://profuse.googlecode.com/svn/branches/v2@390 aa027e90-d47c-11dd-86d7-074df07e0730 --- Device/SDKImage.cpp | 21 +++++++++++---------- Makefile | 2 +- bin/profuse.cpp | 2 ++ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Device/SDKImage.cpp b/Device/SDKImage.cpp index ab6c662..17b726f 100644 --- a/Device/SDKImage.cpp +++ b/Device/SDKImage.cpp @@ -22,6 +22,7 @@ #include #include +#include using namespace Device; @@ -45,7 +46,7 @@ static record_thread FindDiskImageThread(NuArchive *archive) e = NuGetAttr(archive, kNuAttrNumRecords, &recordCount); if (e) { - throw NuFXException(__METHOD__ ": NuGetAttr", e); + throw NuFX::Exception(__METHOD__ ": NuGetAttr", e); } for (unsigned position = 0; position < recordCount; ++position) @@ -56,13 +57,13 @@ static record_thread FindDiskImageThread(NuArchive *archive) e = NuGetRecordIdxByPosition(archive, position, &rIndex); if (e) { - throw NuFXException(__METHOD__ ": NuGetRecordIdxByPosition", e); + throw NuFX::Exception(__METHOD__ ": NuGetRecordIdxByPosition", e); } e = NuGetRecord(archive, rIndex, &record); if (e) { - throw NuFXException(__METHOD__ ": NuGetRecord", e); + throw NuFX::Exception(__METHOD__ ": NuGetRecord", e); } for (unsigned i = 0; i < NuRecordGetNumThreads(record); ++i) @@ -78,7 +79,7 @@ static record_thread FindDiskImageThread(NuArchive *archive) } } - throw Exception(__METHOD__ ": not a disk image"); + throw ::Exception(__METHOD__ ": not a disk image"); } @@ -116,7 +117,7 @@ BlockDevicePointer SDKImage::Open(const char *name) e = NuOpenRO(name, &archive); if (e) { - throw NuFXException(__METHOD__ ": NuOpenRO", e); + throw NuFX::Exception(__METHOD__ ": NuOpenRO", e); } rt = FindDiskImageThread(archive); @@ -124,27 +125,27 @@ BlockDevicePointer SDKImage::Open(const char *name) fd = mkstemp(tmp); if (fd < 0) { - throw POSIXException(__METHOD__ ": mkstemp", errno); + throw POSIX::Exception(__METHOD__ ": mkstemp", errno); } fp = fdopen(fd, "w"); if (!fp) { ::close(fd); - throw POSIXException(__METHOD__ ": fdopen", errno); + throw POSIX::Exception(__METHOD__ ": fdopen", errno); } e = NuCreateDataSinkForFP(true, kNuConvertOff, fp, &sink); if (e) { - throw NuFXException(__METHOD__ ": NuCreateDataSinkForFP", e); + throw NuFX::Exception(__METHOD__ ": NuCreateDataSinkForFP", e); } e = NuExtractThread(archive, rt.thread_index, sink); if (e) { - throw NuFXException(__METHOD__ ": NuExtractThread", e); + throw NuFX::Exception(__METHOD__ ": NuExtractThread", e); } fprintf(stderr, "Extracted disk image to %s\n", tmp); @@ -210,7 +211,7 @@ bool SDKImage::Validate(MappedFile * f) #define __METHOD__ "SDKImage::Validate" if (!Validate(f, std::nothrow)) - throw Exception(__METHOD__ ": Invalid file format."); + throw ::Exception(__METHOD__ ": Invalid file format."); return true; } diff --git a/Makefile b/Makefile index 1fb3bbb..cc7ebc7 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ ifdef HAVE_NUFX DEVICE_OBJECTS += Device/SDKImage.o EXCEPTION_OBJECTS += NuFX/Exception.o LDFLAGS += -L/usr/local/lib/ - LIBS += -lnufx -lz + LIBS += -lnufx -lz -framework carbon CPPFLAGS += -DHAVE_NUFX=1 endif diff --git a/bin/profuse.cpp b/bin/profuse.cpp index 1c8675a..cf60cd1 100644 --- a/bin/profuse.cpp +++ b/bin/profuse.cpp @@ -128,7 +128,9 @@ static void usage() " --format=format specify the disk image format. Valid values are:\n" " dc42 DiskCopy 4.2 Image\n" " davex Davex Disk Image\n" +#ifdef HAVE_NUFX " sdk ShrinkIt Disk Image\n" +#endif " 2img Universal Disk Image\n" " do DOS Order Disk Image\n" " po ProDOS Order Disk Image (default)\n"