Merge pull request #3236 from Carbenium/wformat

LocalCamera: Fix some format warnings reported by clang
This commit is contained in:
Isaac Connor 2021-05-17 16:12:15 -04:00 committed by GitHub
commit f52d4c261c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 16 deletions

View File

@ -381,7 +381,11 @@ LocalCamera::LocalCamera(
} else { } else {
if ( capture ) { if ( capture ) {
Info("Selected capture palette: %s (0x%02hhx%02hhx%02hhx%02hhx)", Info("Selected capture palette: %s (0x%02hhx%02hhx%02hhx%02hhx)",
palette_desc, (palette>>24)&0xff, (palette>>16)&0xff, (palette>>8)&0xff, (palette)&0xff); palette_desc,
static_cast<uint8>((palette >> 24) & 0xff),
static_cast<uint8>((palette >> 16) & 0xff),
static_cast<uint8>((palette >> 8) & 0xff),
static_cast<uint8>((palette) & 0xff));
} }
} }
} }
@ -438,8 +442,10 @@ LocalCamera::LocalCamera(
} else { } else {
if ( capture ) { if ( capture ) {
#if HAVE_LIBSWSCALE #if HAVE_LIBSWSCALE
Info("No direct match for the selected palette (0x%02hhx%02hhx%02hhx%02hhx) and target colorspace (%02u). Format conversion is required, performance penalty expected", Info(
(capturePixFormat>>24)&0xff,((capturePixFormat>>16)&0xff),((capturePixFormat>>8)&0xff),((capturePixFormat)&0xff), colours); "No direct match for the selected palette (%d) and target colorspace (%02u). Format conversion is required, performance penalty expected",
capturePixFormat,
colours);
#else #else
Info("No direct match for the selected palette and target colorspace. Format conversion is required, performance penalty expected"); Info("No direct match for the selected palette and target colorspace. Format conversion is required, performance penalty expected");
#endif #endif
@ -463,13 +469,11 @@ LocalCamera::LocalCamera(
if ( capture ) { if ( capture ) {
#if LIBSWSCALE_VERSION_CHECK(0, 8, 0, 8, 0) #if LIBSWSCALE_VERSION_CHECK(0, 8, 0, 8, 0)
if ( !sws_isSupportedInput(capturePixFormat) ) { if ( !sws_isSupportedInput(capturePixFormat) ) {
Error("swscale does not support the used capture format: 0x%02hhx%02hhx%02hhx%02hhx", Error("swscale does not support the used capture format: %d", capturePixFormat);
(capturePixFormat>>24)&0xff,((capturePixFormat>>16)&0xff),((capturePixFormat>>8)&0xff),((capturePixFormat)&0xff));
conversion_type = 2; /* Try ZM format conversions */ conversion_type = 2; /* Try ZM format conversions */
} }
if ( !sws_isSupportedOutput(imagePixFormat) ) { if ( !sws_isSupportedOutput(imagePixFormat) ) {
Error("swscale does not support the target format: 0x%02hhx%02hhx%02hhx%02hhx", Error("swscale does not support the target format: 0x%d", imagePixFormat);
(imagePixFormat>>24)&0xff,((imagePixFormat>>16)&0xff),((imagePixFormat>>8)&0xff),((imagePixFormat)&0xff));
conversion_type = 2; /* Try ZM format conversions */ conversion_type = 2; /* Try ZM format conversions */
} }
#endif #endif
@ -1212,14 +1216,14 @@ uint32_t LocalCamera::AutoSelectFormat(int p_colours) {
/* Got a format. Copy it to the array */ /* Got a format. Copy it to the array */
strcpy(fmt_desc[nIndex], (const char*)(fmtinfo.description)); strcpy(fmt_desc[nIndex], (const char*)(fmtinfo.description));
fmt_fcc[nIndex] = fmtinfo.pixelformat; fmt_fcc[nIndex] = fmtinfo.pixelformat;
Debug(3, "Got format: %s (0x%02hhx%02hhx%02hhx%02hhx) at index %d", Debug(3, "Got format: %s (0x%02hhx%02hhx%02hhx%02hhx) at index %d",
fmt_desc[nIndex], fmt_desc[nIndex],
(fmt_fcc[nIndex]>>24)&0xff, static_cast<uint8>((fmt_fcc[nIndex] >> 24) & 0xff),
(fmt_fcc[nIndex]>>16)&0xff, static_cast<uint8>((fmt_fcc[nIndex] >> 16) & 0xff),
(fmt_fcc[nIndex]>>8)&0xff, static_cast<uint8>((fmt_fcc[nIndex] >> 8) & 0xff),
(fmt_fcc[nIndex])&0xff, static_cast<uint8>((fmt_fcc[nIndex]) & 0xff),
nIndex); nIndex);
/* Proceed to the next index */ /* Proceed to the next index */
memset(&fmtinfo, 0, sizeof(fmtinfo)); memset(&fmtinfo, 0, sizeof(fmtinfo));
@ -1248,13 +1252,23 @@ uint32_t LocalCamera::AutoSelectFormat(int p_colours) {
for ( unsigned int j=0; j < nIndex; j++ ) { for ( unsigned int j=0; j < nIndex; j++ ) {
if ( preferedformats[i] == fmt_fcc[j] ) { if ( preferedformats[i] == fmt_fcc[j] ) {
Debug(6, "Choosing format: %s (0x%02hhx%02hhx%02hhx%02hhx) at index %u", Debug(6, "Choosing format: %s (0x%02hhx%02hhx%02hhx%02hhx) at index %u",
fmt_desc[j],fmt_fcc[j]&0xff, (fmt_fcc[j]>>8)&0xff, (fmt_fcc[j]>>16)&0xff, (fmt_fcc[j]>>24)&0xff ,j); fmt_desc[j],
static_cast<uint8>(fmt_fcc[j] & 0xff),
static_cast<uint8>((fmt_fcc[j] >> 8) & 0xff),
static_cast<uint8>((fmt_fcc[j] >> 16) & 0xff),
static_cast<uint8>((fmt_fcc[j] >> 24) & 0xff),
j);
/* Found a format! */ /* Found a format! */
nIndexUsed = j; nIndexUsed = j;
break; break;
} else { } else {
Debug(6, "No match for format: %s (0x%02hhx%02hhx%02hhx%02hhx) at index %u", Debug(6, "No match for format: %s (0x%02hhx%02hhx%02hhx%02hhx) at index %u",
fmt_desc[j],fmt_fcc[j]&0xff, (fmt_fcc[j]>>8)&0xff, (fmt_fcc[j]>>16)&0xff, (fmt_fcc[j]>>24)&0xff ,j); fmt_desc[j],
static_cast<uint8>(fmt_fcc[j] & 0xff),
static_cast<uint8>((fmt_fcc[j] >> 8) & 0xff),
static_cast<uint8>((fmt_fcc[j] >> 16) & 0xff),
static_cast<uint8>((fmt_fcc[j] >> 24) & 0xff),
j);
} }
} }
} }