Browse Source

Don't have `default:` in switches where all cases need to be handled.

Also added assert for cases which shouldn't be reached.
pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
930c9f2a5d
  1. 16
      src/AbstractImage.cpp
  2. 4
      src/Context.cpp

16
src/AbstractImage.cpp

@ -14,6 +14,9 @@
*/
#include "AbstractImage.h"
#include <Utility/Debug.h>
#include "TypeTraits.h"
using namespace std;
@ -71,6 +74,8 @@ size_t AbstractImage::pixelSize(Components format, ComponentType type) {
switch(format) {
#ifndef MAGNUM_TARGET_GLES
case Components::Red:
case Components::Green:
case Components::Blue:
return 1*size;
case Components::RedGreen:
return 2*size;
@ -85,9 +90,16 @@ size_t AbstractImage::pixelSize(Components format, ComponentType type) {
case Components::BGRA:
#endif
return 4*size;
default:
return 0;
#ifndef MAGNUM_TARGET_GLES
case Components::Depth:
case Components::StencilIndex:
case Components::DepthStencil:
CORRADE_ASSERT(false, "AbstractImage::pixelSize(): unhandled depth/stencil type", 0);
#endif
}
return 0;
}
}

4
src/Context.cpp

@ -129,6 +129,7 @@ const std::vector<Extension>& Extension::extensions(Version version) {
switch(version) {
case Version::None: return extensions;
case Version::GL210: return empty;
case Version::GL300: return extensions300;
case Version::GL310: return extensions310;
case Version::GL320: return extensions320;
@ -137,8 +138,9 @@ const std::vector<Extension>& Extension::extensions(Version version) {
case Version::GL410: return extensions410;
case Version::GL420: return extensions420;
case Version::GL430: return extensions430;
default: return empty;
}
return empty;
}
Context* Context::_current = nullptr;

Loading…
Cancel
Save