Combine line counting and encoding failure check
This elimanates one of three loops through the entire data buffer on first read. The ultimate goal is one pass. This will help with kdiff3's cronic speed issues.