Index: /issm/trunk-jpl/src/wrappers/ShpRead/ShpRead.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/ShpRead/ShpRead.cpp	(revision 16413)
+++ /issm/trunk-jpl/src/wrappers/ShpRead/ShpRead.cpp	(revision 16414)
@@ -39,17 +39,9 @@
 
 	/*checks on arguments on the matlab side: */
-	if(nlhs > NLHS){
-		ShpReadUsage(); _error_("ShpRead usage error");
-	}
-	if(nrhs != NRHS){
-		ShpReadUsage(); _error_("ShpRead usage error");
-	}
+	if(nlhs != NLHS){ShpReadUsage(); _error_("ShpRead usage error");}
+	if(nrhs != NRHS){ShpReadUsage(); _error_("ShpRead usage error");}
 
 	/*Input datasets: */
 	FetchData(&filename,SHP_IN);
-
-	/*Intermediaries*/
-	int         nShapeType,nEntities;
-	IssmPDouble adfMinBound[4], adfMaxBound[4];
 
 	/*Open shapefile*/
@@ -58,12 +50,15 @@
 
 	/*read header and print out file bounds*/
+	int         nShapeType,nEntities;
+	IssmPDouble adfMinBound[4], adfMaxBound[4];
 	SHPGetInfo( hSHP, &nEntities, &nShapeType, adfMinBound, adfMaxBound );
 	_printf_("Shapefile Type: "<<SHPTypeName(nShapeType)<<"   number of Shapes: "<< nEntities<<"\n\n");
 
 	/*Initialize output*/
-	Contours* contours=new Contours();
+	Contours* contours = new Contours();
 
 	/*Read all objects*/
 	for(int i=0; i<nEntities;i++ ){
+
 		SHPObject* psShape = SHPReadObject(hSHP,i);
 		_printf_( "Shape #"<<i<<" ("<<SHPTypeName(psShape->nSHPType)<<") nVertices="<<psShape->nVertices<<", nParts="<<psShape->nParts<<"\n");
@@ -71,17 +66,19 @@
 		Contour<double> *contour = NULL;
 
-		if(psShape->nSHPType==SHPT_ARC){
-			contour=new Contour<double>(0,psShape->nVertices,psShape->padfX,psShape->padfY,false);
+		switch(psShape->nSHPType){
+			case SHPT_ARC:
+				contour=new Contour<double>(0,psShape->nVertices,psShape->padfX,psShape->padfY,false);
+				break;
+			default:
+				_printf_("Shape type "<<SHPTypeName(psShape->nSHPType)<<"not supported yet, skipping...\n");
 		}
 
-		/*Add to contours*/
+		/*Add to contours and clean up*/
 		if(contour) contours->AddObject(contour);
-
-		/*Destroy current shape*/
-		SHPDestroyObject( psShape );
+		SHPDestroyObject(psShape);
 	}
 
 	/*Write output*/
-	//ExpWrite(contours,filexp);
+	WriteData(SHP_OUT,contours);
 
 	/*Clean-up*/
