From 185394f1ca0b2bf9c39e22b376bb69d577ffa225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Boisvert?= Date: Thu, 7 Nov 2013 14:31:14 -0500 Subject: [PATCH] files: add method to check if a file is valid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Boisvert --- RayPlatform/core/ComputeCore.cpp | 6 ++++-- RayPlatform/files/FileReader.cpp | 4 ++++ RayPlatform/files/FileReader.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/RayPlatform/core/ComputeCore.cpp b/RayPlatform/core/ComputeCore.cpp index 8d11e271..bcb0f813 100644 --- a/RayPlatform/core/ComputeCore.cpp +++ b/RayPlatform/core/ComputeCore.cpp @@ -1209,8 +1209,10 @@ void ComputeCore::configureEngine() { headerSize += ( 1 * sizeof(uint32_t) * sizeof(char) ); */ +/* cout << "DEBUG MAXIMUM_MESSAGE_SIZE_IN_BYTES " << MAXIMUM_MESSAGE_SIZE_IN_BYTES; cout << " headerSize " << headerSize << endl; + */ // align this on 8 bytes because there is still something in the code // that is incorrect apparently. @@ -1234,12 +1236,12 @@ void ComputeCore::configureEngine() { headerSize += toAdd; } - cout << " headerSize (with padding) " << headerSize << endl; + //cout << " headerSize (with padding) " << headerSize << endl; maximumMessageSizeInBytes += headerSize; } - cout << "DEBUG maximumMessageSizeInBytes " << maximumMessageSizeInBytes << endl; + //cout << "DEBUG maximumMessageSizeInBytes " << maximumMessageSizeInBytes << endl; #ifdef CONFIG_ASSERT assert(maximumMessageSizeInBytes >= MAXIMUM_MESSAGE_SIZE_IN_BYTES); diff --git a/RayPlatform/files/FileReader.cpp b/RayPlatform/files/FileReader.cpp index 055189fe..5428f300 100644 --- a/RayPlatform/files/FileReader.cpp +++ b/RayPlatform/files/FileReader.cpp @@ -177,3 +177,7 @@ bool FileReader::eof() { //return m_reader.eof(); } +bool FileReader::isValid() { + + return m_reader.good(); +} diff --git a/RayPlatform/files/FileReader.h b/RayPlatform/files/FileReader.h index 1a668cc0..d6643ed8 100644 --- a/RayPlatform/files/FileReader.h +++ b/RayPlatform/files/FileReader.h @@ -55,6 +55,7 @@ class FileReader { void getline(char * buffer, int size); void close(); bool eof(); + bool isValid(); }; #endif