// Compare the received checksum, and the calculated checksum. //If they are completely equal, return true. Otherwise return false. boolean dGPS::Compare(){ char s[3]; char *recCheck=Checks(); // received checksum long int x= Checked(); // Computed checksum from the incoming $GPRMC string char *ccomCheck=itoa(x,s,16); // convert long int to hexadecimal string char comCheck[strlen(ccomCheck)]; for (int i=0;i<=strlen(ccomCheck);i++){ // convert ToUpper case, each character of hexadecimal string comCheck[i]= toupper(ccomCheck[i]);} boolean flag; // for each character in hexadecimal string, check if it matches with the received checksum value for (int i=0;i<min(strlen(recCheck),strlen(comCheck));i++){ if (recCheck[i]==comCheck[i]) { flag=true; } // if characters in checksum match else { flag=false; } // if characters in checksum do not match } return flag; // if all the characters in checksum match, then 'true' is returned. Otherwise, 'false' is returned. }
/*--------------------------------------------------------------------- ConstructHull adds the vertices to the hull one at a time. The hull vertices are those in the list marked as onhull. ---------------------------------------------------------------------*/ void ConstructHull( void ) { tVertex v, vnext; v = vertices; do { vnext = v->next; if ( !v->mark ) { v->mark = PROCESSED; AddOne( v ); CleanUp( &vnext ); /* Pass down vnext in case it gets deleted. */ if ( check ) { fprintf(stderr,"ConstructHull: After Add of %d & Cleanup:\n", v->vnum); Checks(); } if ( debug ) PrintOut( v ); } v = vnext; } while ( v != vertices ); }