From 6ba112fdfe832586370f5cefe9a1e7c2db53d99b Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Wed, 7 Jan 2015 14:55:21 -0800 Subject: [PATCH] Include file/line info without DEBUG_MSGS For some reason the __FILE__ and __LINE__ stuff was disabled when DEBUG_MSGS wasn't enabled. It's now enabled. --- nufxlib/NufxLibPriv.h | 28 ++++++++++++++-------------- nufxlib/samples/ImgConv.c | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/nufxlib/NufxLibPriv.h b/nufxlib/NufxLibPriv.h index dd3df95..c18a4b7 100644 --- a/nufxlib/NufxLibPriv.h +++ b/nufxlib/NufxLibPriv.h @@ -429,25 +429,25 @@ union NuDataSink { * the first arguments to Nu_ReportError, so we don't have to type them * in every time we use the function. It would've been much easier to * use a gcc-style varargs macro, but not everybody uses gcc. + * + * TODO: Visual C++ has vararg macros now; time to replace this. */ -#ifdef DEBUG_MSGS - #ifdef HAS__FUNCTION__ - #define _FUNCTION_ __FUNCTION__ - #else - #define _FUNCTION_ "" - #endif +#ifdef HAS__FUNCTION__ +# define _FUNCTION_ __FUNCTION__ +#else +# define _FUNCTION_ "" +#endif - #define NU_BLOB pArchive, __FILE__, __LINE__, _FUNCTION_, false - #define NU_BLOB_DEBUG pArchive, __FILE__, __LINE__, _FUNCTION_, true - #define NU_NILBLOB NULL, __FILE__, __LINE__, _FUNCTION_, false - #define DebugShowError(err) \ +#define NU_BLOB pArchive, __FILE__, __LINE__, _FUNCTION_, false +#define NU_BLOB_DEBUG pArchive, __FILE__, __LINE__, _FUNCTION_, true +#define NU_NILBLOB NULL, __FILE__, __LINE__, _FUNCTION_, false + +#ifdef DEBUG_MSGS +# define DebugShowError(err) \ Nu_ReportError(pArchive, __FILE__, __LINE__, _FUNCTION_, \ true, err, "(DEBUG)"); #else - #define NU_BLOB pArchive, "", 0, "", false - #define NU_BLOB_DEBUG pArchive, "", 0, "", true - #define NU_NILBLOB NULL, "", 0, "", false - #define DebugShowError(err) ((void)0) +# define DebugShowError(err) ((void)0) #endif /* diff --git a/nufxlib/samples/ImgConv.c b/nufxlib/samples/ImgConv.c index 620b827..9eae3a7 100644 --- a/nufxlib/samples/ImgConv.c +++ b/nufxlib/samples/ImgConv.c @@ -277,7 +277,7 @@ NuError CreateDosSource(const ImgHeader* pHeader, FILE* fp, * reversible transformation, i.e. if you do this twice you're back * to ProDOS ordering. */ - for (offset = 0; offset < pHeader->dataLen; offset += 4096) { + for (offset = 0; offset < (long) pHeader->dataLen; offset += 4096) { size_t ignored; ignored = fread(diskBuffer + offset + 0x0000, 256, 1, fp); ignored = fread(diskBuffer + offset + 0x0e00, 256, 1, fp);