(1) If he has been discharged from custody on a criminal charge, and is afterwards committed for the same offense, by legal order or process.
(2) If, after a discharge for defect of proof, or for any defect of the process, warrant, or commitment in a criminal case, the prisoner is again arrested on sufficient proof and committed by legal process for the proceeding offense.