Skip to content

Commit

Permalink
Fix MSVC warning about assignment in condition
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Dec 8, 2024
1 parent f1911cf commit 07ea15f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions apps/gdalwarp_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4714,16 +4714,18 @@ static GDALDatasetH GDALWarpCreateOutput(
aosCreateOptions.SetNameValue("PHOTOMETRIC", "RGB");

// Preserve potential ALPHA=PREMULTIPLIED from source alpha band
const char *pszAlpha;
if (aosCreateOptions.FetchNameValue("ALPHA") == nullptr &&
apeColorInterpretations.size() == 4 &&
apeColorInterpretations[3] == GCI_AlphaBand &&
GDALGetRasterCount(pahSrcDS[0]) == 4 &&
(pszAlpha =
GDALGetMetadataItem(GDALGetRasterBand(pahSrcDS[0], 4),
"ALPHA", "IMAGE_STRUCTURE")))
GDALGetRasterCount(pahSrcDS[0]) == 4)
{
aosCreateOptions.SetNameValue("ALPHA", pszAlpha);
const char *pszAlpha =
GDALGetMetadataItem(GDALGetRasterBand(pahSrcDS[0], 4),
"ALPHA", "IMAGE_STRUCTURE");
if (pszAlpha)
{
aosCreateOptions.SetNameValue("ALPHA", pszAlpha);
}
}
}

Expand Down

0 comments on commit 07ea15f

Please sign in to comment.