From e69a1ea87c7798c55254e42d64acc4495abe438e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 31 Jan 2003 22:56:49 +0000 Subject: [PATCH] compilation fix for HP-UX CC git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/wfstream.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/common/wfstream.cpp b/src/common/wfstream.cpp index 56743fd214..d460dd61ab 100644 --- a/src/common/wfstream.cpp +++ b/src/common/wfstream.cpp @@ -71,19 +71,23 @@ size_t wxFileInputStream::OnSysRead(void *buffer, size_t size) { off_t ret = m_file->Read(buffer, size); - switch ( ret ) + // NB: we can't use a switch here because HP-UX CC doesn't allow + // switching over long long (which off_t is in 64bit mode) + + if ( !ret ) { - case 0: - m_lasterror = wxSTREAM_EOF; - break; - - case wxInvalidOffset: - m_lasterror = wxSTREAM_READ_ERROR; - ret = 0; - break; - - default: - m_lasterror = wxSTREAM_NO_ERROR; + // nothing read, so nothing more to read + m_lasterror = wxSTREAM_EOF; + } + else if ( ret == wxInvalidOffset ) + { + m_lasterror = wxSTREAM_READ_ERROR; + ret = 0; + } + else + { + // normal case + m_lasterror = wxSTREAM_NO_ERROR; } return ret;