Cleanup compress() method


- Use constexpr where possible.
- Use switch instead of if-else to make sure that all compression
  types are covered.
- Get rid of the outer do {} while(false); loop and refactor the
  logic of the algorithm to adjust to it.
- Adjust to Qt coding style

Fixes: QTBUG-139963
Change-Id: I4d376b303bea4fa9c94cc8786e762a5904edf0c4
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
commit352f8c10e298dcc3f26b7400b6e01e1bf8f2a352
parentfe79079257d36248a20e0c53b315d8f89bb71114
authorIvan Solovev <ivan.solovev@qt.io>
committerIvan Solovev <ivan.solovev@qt.io>
commit timeWed, 22 Oct 2025 16:59:39 +0200