discord / lilliput

Resize images and animated GIFs in Go
https://discord.com/blog/how-discord-resizes-150-million-images-every-day-with-go-and-c
Other
1.96k stars 123 forks source link

fix: Move default color space assignment in avcodec.cpp #193

Closed skidder closed 1 month ago

skidder commented 1 month ago

When compiling with newer versions of Go, a compiler warning was generated due to unhandled enumeration values in a switch statement within avcodec.cpp:

avcodec.cpp:417:17: warning: 11 enumeration values not handled in switch: 'AVCOL_SPC_RGB', 'AVCOL_SPC_BT709', 'AVCOL_SPC_UNSPECIFIED'... [-Wswitch]

Solution

This pull request refactors the color space assignment logic in avcodec.cpp. Instead of initializing the colorspace variable to a default value before the switch statement, we now assign the default value in the default case of the switch. This change resolves the compiler warning and improves the clarity of our color space handling logic.

Note, this change does not alter the functional behavior of the color space conversion logic.