diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-09-26 13:13:56 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2018-09-27 18:34:30 +0200 |
commit | 7b081a7fc8011c5ce7194fc0eabb8768e0f9d4c6 (patch) | |
tree | bff9c5d115f0ad90f6529d8578d71a04d7457248 /modules/etc/image_etc.cpp | |
parent | 4cf5bb027678717263476e676cd23f881eef1ca1 (diff) | |
download | redot-engine-7b081a7fc8011c5ce7194fc0eabb8768e0f9d4c6.tar.gz |
Fix warnings about unhandled enum value in switch [-Wswitch]
Fixes GCC 5 warnings of the form:
core/io/http_client.cpp:288:9: warning: enumeration value 'STATUS_SSL_HANDSHAKE_ERROR' not handled in switch [-Wswitch]
core/io/marshalls.cpp:806:9: warning: enumeration value 'AABB' not handled in switch [-Wswitch]
Those can be trivial cases where adding a default fallback is the solution,
or more complex issues/hidden bugs where missed values are actually meant
to be handled.
Diffstat (limited to 'modules/etc/image_etc.cpp')
-rw-r--r-- | modules/etc/image_etc.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp index fd17c7b81f..57f5b68c61 100644 --- a/modules/etc/image_etc.cpp +++ b/modules/etc/image_etc.cpp @@ -47,13 +47,14 @@ static Image::Format _get_etc2_mode(Image::DetectChannels format) { case Image::DETECTED_RGB: return Image::FORMAT_ETC2_RGB8; - default: + case Image::DETECTED_RGBA: return Image::FORMAT_ETC2_RGBA8; - // TODO: would be nice if we could use FORMAT_ETC2_RGB8A1 for FORMAT_RGBA5551 + // TODO: would be nice if we could use FORMAT_ETC2_RGB8A1 for FORMAT_RGBA5551 + default: + // TODO: Kept for compatibility, but should be investigated whether it's correct or if it should error out + return Image::FORMAT_ETC2_RGBA8; } - - ERR_FAIL_COND_V(true, Image::FORMAT_MAX); } static Etc::Image::Format _image_format_to_etc2comp_format(Image::Format format) { @@ -81,9 +82,10 @@ static Etc::Image::Format _image_format_to_etc2comp_format(Image::Format format) case Image::FORMAT_ETC2_RGB8A1: return Etc::Image::Format::RGB8A1; - } - ERR_FAIL_COND_V(true, Etc::Image::Format::UNKNOWN); + default: + ERR_FAIL_V(Etc::Image::Format::UNKNOWN); + } } static void _decompress_etc1(Image *p_img) { |