From 6ede639c090aa80ba5e9b6be631b87727d741fbe Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sun, 26 Nov 2006 00:44:26 +0000 Subject: Serializers are in debug mode, beware. --- src/serializerbinary.cpp | 7 +++++-- src/serializertext.cpp | 2 +- src/serializertext.h | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/serializerbinary.cpp b/src/serializerbinary.cpp index bfe3cc9..cb3c8bf 100644 --- a/src/serializerbinary.cpp +++ b/src/serializerbinary.cpp @@ -43,12 +43,15 @@ void SerializerBinary::close() void SerializerBinary::write(const void * pData, int32_t nSize) { - fwrite(pData, nSize, 1, fhFile); + uint32_t nWrite = fwrite(pData, nSize, 1, fhFile); + printf("fwrite( 0x%08X, %d, 1, fhFile ) = %u;\n", pData, nSize, nWrite ); } void SerializerBinary::read(void * pData, int32_t nSize) { - if( fread(pData, nSize, 1, fhFile) < 1 ) + uint32_t nRead = fread(pData, nSize, 1, fhFile); + printf("fread( 0x%08X, %d, 1, fhFile ) = %u;\n", pData, nSize, nRead ); + if( nRead < 1 ) { throw FileException( excodeEOF, "End of file read"); } diff --git a/src/serializertext.cpp b/src/serializertext.cpp index f758bf8..9cf4394 100644 --- a/src/serializertext.cpp +++ b/src/serializertext.cpp @@ -7,7 +7,7 @@ SerializerText::SerializerText(FILE *fhFile, bool bLoading): { } -SerializerText::SerializerText(char *sFileName, bool bLoading): +SerializerText::SerializerText(const char *sFileName, bool bLoading): Serializer(bLoading), bCloseFile(true) { diff --git a/src/serializertext.h b/src/serializertext.h index 46be421..01b7f7b 100644 --- a/src/serializertext.h +++ b/src/serializertext.h @@ -8,7 +8,7 @@ class SerializerText : public Serializer { public: SerializerText(FILE *fhFile, bool bLoading); - SerializerText(char *sFileName, bool bLoading); + SerializerText(const char *sFileName, bool bLoading); virtual ~SerializerText(); virtual void close(); -- cgit v1.2.3