corrected small bug in parsing ply files of polylines and added better error reporting

This commit is contained in:
Paolo Cignoni 2011-12-12 23:25:39 +00:00
parent fbee572ad2
commit e77ebb6cd0
2 changed files with 5 additions and 3 deletions

View File

@ -311,6 +311,7 @@ static const char *ErrorMsg(int error)
ply_error_msg[PlyInfo::E_SHORTFILE ]="Unespected eof";
ply_error_msg[PlyInfo::E_NO_3VERTINFACE ]="Face with more than 3 vertices";
ply_error_msg[PlyInfo::E_BAD_VERT_INDEX ]="Bad vertex index in face";
ply_error_msg[PlyInfo::E_BAD_VERT_INDEX_EDGE ]="Bad vertex index in edge";
ply_error_msg[PlyInfo::E_NO_6TCOORD ]="Face with no 6 texture coordinates";
ply_error_msg[PlyInfo::E_DIFFER_COLORS ]="Number of color differ from vertices";
}
@ -709,9 +710,9 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
pi.status = PlyInfo::E_SHORTFILE;
return pi.status;
}
if( ea.v1<0 || ea.v2<0 || ea.v1>=m.en || ea.v2>=m.en)
if( ea.v1<0 || ea.v2<0 || ea.v1>=m.vn || ea.v2>=m.vn)
{
pi.status = PlyInfo::E_BAD_VERT_INDEX;
pi.status = PlyInfo::E_BAD_VERT_INDEX_EDGE;
return pi.status;
}
(*ei).V(0) = index[ ea.v1 ];

View File

@ -104,7 +104,8 @@ enum Error
E_BAD_VERT_INDEX = ply::E_MAXPLYERRORS+5, // 18
E_NO_6TCOORD = ply::E_MAXPLYERRORS+6, // 19
E_DIFFER_COLORS = ply::E_MAXPLYERRORS+7,
E_MAXPLYINFOERRORS= ply::E_MAXPLYERRORS+8// 20
E_BAD_VERT_INDEX_EDGE = ply::E_MAXPLYERRORS+8, // 18
E_MAXPLYINFOERRORS= ply::E_MAXPLYERRORS+9// 20
};
}; // end class