Measurement of the branching ratios Γ(Ds*+→Ds+π0)/Γ(Ds*+→Ds+γ) and Γ(D*0→D0π0)/Γ(D*0→D0γ)