Fixed PHP-1267: Windows Build Failure
Rename variable to be consistent with its friends
Reduce the size of the buffer, to_read*2 seems like a good fit

Also remove unnecessary MIN() checks