[fdo-commits] r169 - trunk/Providers/SHP/Src/ShpRead
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Mon Jan 29 13:46:29 EST 2007
Author: danstoica
Date: 2007-01-29 13:46:29 -0500 (Mon, 29 Jan 2007)
New Revision: 169
Modified:
trunk/Providers/SHP/Src/ShpRead/ShapeFileBase.cpp
Log:
Merged branch 3.2.x to trunk
Modified: trunk/Providers/SHP/Src/ShpRead/ShapeFileBase.cpp
===================================================================
--- trunk/Providers/SHP/Src/ShpRead/ShapeFileBase.cpp 2007-01-29 17:58:33 UTC (rev 168)
+++ trunk/Providers/SHP/Src/ShpRead/ShapeFileBase.cpp 2007-01-29 18:46:29 UTC (rev 169)
@@ -138,14 +138,26 @@
// Read the File Header details
if (!ReadFile (&shpHeader, SHPHeaderSize))
- throw FdoCommonFile::LastErrorToException (L"ShapeFileBase::GetFileHeaderDetails");
- // Check version
+ {
+ FdoException* ex = FdoCommonFile::LastErrorToException (L"ShapeFileBase::GetFileHeaderDetails");
+ if ( ex )
+ throw ex;
+ else
+ throw FdoException::Create (NlsMsgGet(SHP_READ_FILE_ERROR, "Error occured reading file '%1$ls'.", FileName() ));
+ }
+
+ // We need to swap the BigEndian values
+ m_nFileCode = shpHeader.nFileCode = SWAPLONG(shpHeader.nFileCode);
+
+ // Check file code
+ if ( m_nFileCode != nSHP_FILE_CODE )
+ throw FdoException::Create (NlsMsgGet(SHP_CONNECTION_FILE_INVALID_FILECODE, "The file '%1$ls' has an invalid File Code number (%2$d).", FileName (), m_nFileCode));
+
+ // Check version
m_nFileVersion = shpHeader.nFileVersion;
if(m_nFileVersion == nSHP_FILE_VERSION)
{
- // We need to swap the BigEndian values
- m_nFileCode = shpHeader.nFileCode = SWAPLONG(shpHeader.nFileCode);
m_nFileLength = shpHeader.nFileLength = SWAPLONG(shpHeader.nFileLength);
m_nFileShapeType = (eShapeTypes)shpHeader.nFileShapeType;
More information about the fdo-commits
mailing list