1
0
Эх сурвалжийг харах

libobs-d3d11,libobs-opengl,plugins: Remove unneeded cast in switches

Those casts were usually used to workaround switch warnings.
tytan652 3 жил өмнө
parent
commit
107b2a8f27

+ 1 - 1
libobs-d3d11/d3d11-subsystem.hpp

@@ -143,7 +143,7 @@ ConvertGSTextureFormatViewLinear(gs_color_format format)
 
 static inline gs_color_format ConvertDXGITextureFormat(DXGI_FORMAT format)
 {
-	switch ((unsigned long)format) {
+	switch (format) {
 	case DXGI_FORMAT_A8_UNORM:
 		return GS_A8;
 	case DXGI_FORMAT_R8_UNORM:

+ 3 - 3
libobs-opengl/gl-windows.c

@@ -39,7 +39,7 @@ struct gl_platform {
 /* For now, only support basic 32bit formats for graphics output. */
 static inline int get_color_format_bits(enum gs_color_format format)
 {
-	switch ((uint32_t)format) {
+	switch (format) {
 	case GS_RGBA:
 	case GS_BGRA:
 		return 32;
@@ -50,7 +50,7 @@ static inline int get_color_format_bits(enum gs_color_format format)
 
 static inline int get_depth_format_bits(enum gs_zstencil_format zsformat)
 {
-	switch ((uint32_t)zsformat) {
+	switch (zsformat) {
 	case GS_Z16:
 		return 16;
 	case GS_Z24_S8:
@@ -62,7 +62,7 @@ static inline int get_depth_format_bits(enum gs_zstencil_format zsformat)
 
 static inline int get_stencil_format_bits(enum gs_zstencil_format zsformat)
 {
-	switch ((uint32_t)zsformat) {
+	switch (zsformat) {
 	case GS_Z24_S8:
 		return 8;
 	default:

+ 1 - 1
plugins/obs-qsv11/common_directx9.cpp

@@ -186,7 +186,7 @@ mfxStatus dx9_simple_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
 	if (FAILED(hr))
 		return MFX_ERR_LOCK_MEMORY;
 
-	switch ((DWORD)desc.Format) {
+	switch (desc.Format) {
 	case D3DFMT_NV12:
 		ptr->Pitch = (mfxU16)locked.Pitch;
 		ptr->Y = (mfxU8 *)locked.pBits;

+ 1 - 1
plugins/win-capture/graphics-hook/d3d8-capture.cpp

@@ -35,7 +35,7 @@ static d3d8_data data = {};
 
 static DXGI_FORMAT d3d8_to_dxgi_format(D3DFORMAT format)
 {
-	switch ((unsigned long)format) {
+	switch (format) {
 	case D3DFMT_X1R5G5B5:
 	case D3DFMT_A1R5G5B5:
 		return DXGI_FORMAT_B5G5R5A1_UNORM;

+ 1 - 1
plugins/win-capture/graphics-hook/d3d9-capture.cpp

@@ -94,7 +94,7 @@ static void d3d9_free()
 
 static DXGI_FORMAT d3d9_to_dxgi_format(D3DFORMAT format)
 {
-	switch ((unsigned long)format) {
+	switch (format) {
 	case D3DFMT_A2B10G10R10:
 		return DXGI_FORMAT_R10G10B10A2_UNORM;
 	case D3DFMT_A8R8G8B8:

+ 2 - 2
plugins/win-capture/graphics-hook/dxgi-helpers.hpp

@@ -4,7 +4,7 @@
 
 static inline DXGI_FORMAT strip_dxgi_format_srgb(DXGI_FORMAT format)
 {
-	switch ((unsigned long)format) {
+	switch (format) {
 	case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
 		return DXGI_FORMAT_B8G8R8A8_UNORM;
 	case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
@@ -18,7 +18,7 @@ static inline DXGI_FORMAT apply_dxgi_format_typeless(DXGI_FORMAT format,
 						     bool allow_srgb_alias)
 {
 	if (allow_srgb_alias) {
-		switch ((unsigned long)format) {
+		switch (format) {
 		case DXGI_FORMAT_B8G8R8A8_UNORM:
 			return DXGI_FORMAT_B8G8R8A8_TYPELESS;
 		case DXGI_FORMAT_R8G8B8A8_UNORM: