diff -ruN sp-orig/src/surfaceArea.c sp/src/surfaceArea.c
--- sp-orig/src/surfaceArea.c	2011-08-16 14:54:42.000000000 +0900
+++ sp/src/surfaceArea.c	2011-08-16 14:55:24.000000000 +0900
@@ -63,12 +63,15 @@
   }else{
     cellI=0; /* saves us computing 2-d array indices */
   }
-  for(int j=1;j<(*ny-1);j++){
-    for(int i=1;i<(*nx-1);i++){
+  int j;
+  int i;
+  int tri;
+  for(j=1;j<(*ny-1);j++){
+    for(i=1;i<(*nx-1);i++){
       z1 = height(heights,nx,i,j);
       cellArea=0;
       if(!ISNA(z1)){
-	for(int tri=0;tri<8;tri++){
+	for(tri=0;tri<8;tri++){
 	  z2=height(heights,nx,i+dxv[tri],j+dyv[tri]);
 	  /* replace missing adjacent values with the current cell value */
 	  if(ISNA(z2))z2=z1;