Bug 1005323: In nsTemporaryFileInputStream::ReadSegments, call writer correctly. r=roc

 - Respect the byte count that writer returns; don't assume it always accepts the full amount.
 - If writer returns an error, return NS_OK with a partial write count; don't continue writing data.
 - Simplify counters slightly.