Click the reaction arrows in sequence to view the 3D models and animations respectively
Initially chlorination on the nucleophilic sulfur produces a chlorosulfonium salt. Deprotonation next to the positively charged sulfur leads to elimination of chloride producing a new sulfonium salt. Nucleophilic addition of chloride to the double bond completes the formation of the alpha-chloro sulfide.
The overall result is oxidation of the position next to sulfur and the use of (trifluoro)acetic anhydride on sulfoxides produces O,S-acetals by a similar mechanism.