Fixed a few signed/unsigned comparison warnings, removed repeated calls to strlen, and fixed ambiguous indentation.

Submitted as a single commit because the code in both files is almost identical.
Merge pull request #27 from nealp9084/master

Modified some code that caused warnings, was ambiguous, and was inefficient