Skip to content

Commit 518ec57

Browse files
committed
Replace GDT_Byte use by GDT_UInt8
1 parent 296b599 commit 518ec57

File tree

319 files changed

+1609
-1569
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

319 files changed

+1609
-1569
lines changed

alg/gdalcutline.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,9 @@ CPLErr GDALWarpCutlineMaskerEx(void *pMaskFuncArg, int /* nBandCount */,
338338
GByte *pabyPolyMask = static_cast<GByte *>(CPLCalloc(nXSize, nYSize));
339339

340340
auto poMEMDS =
341-
MEMDataset::Create("warp_temp", nXSize, nYSize, 0, GDT_Byte, nullptr);
341+
MEMDataset::Create("warp_temp", nXSize, nYSize, 0, GDT_UInt8, nullptr);
342342
GDALRasterBandH hMEMBand =
343-
MEMCreateRasterBandEx(poMEMDS, 1, pabyPolyMask, GDT_Byte, 0, 0, false);
343+
MEMCreateRasterBandEx(poMEMDS, 1, pabyPolyMask, GDT_UInt8, 0, 0, false);
344344
poMEMDS->AddMEMBand(hMEMBand);
345345

346346
GDALDatasetH hMemDS = GDALDataset::ToHandle(poMEMDS);

alg/gdaldither.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,13 @@ int GDALDitherRGB2PCTInternal(
352352
/* --------------------------------------------------------------------
353353
*/
354354
CPLErr err1 = GDALRasterIO(hRed, GF_Read, 0, iScanline, nXSize, 1,
355-
pabyRed, nXSize, 1, GDT_Byte, 0, 0);
355+
pabyRed, nXSize, 1, GDT_UInt8, 0, 0);
356356
if (err1 == CE_None)
357357
err1 = GDALRasterIO(hGreen, GF_Read, 0, iScanline, nXSize, 1,
358-
pabyGreen, nXSize, 1, GDT_Byte, 0, 0);
358+
pabyGreen, nXSize, 1, GDT_UInt8, 0, 0);
359359
if (err1 == CE_None)
360360
err1 = GDALRasterIO(hBlue, GF_Read, 0, iScanline, nXSize, 1,
361-
pabyBlue, nXSize, 1, GDT_Byte, 0, 0);
361+
pabyBlue, nXSize, 1, GDT_UInt8, 0, 0);
362362
if (err1 != CE_None)
363363
{
364364
CPLFree(pabyRed);
@@ -559,7 +559,7 @@ int GDALDitherRGB2PCTInternal(
559559
/* --------------------------------------------------------------------
560560
*/
561561
err = GDALRasterIO(hTarget, GF_Write, 0, iScanline, nXSize, 1,
562-
pabyIndex, nXSize, 1, GDT_Byte, 0, 0);
562+
pabyIndex, nXSize, 1, GDT_UInt8, 0, 0);
563563
if (err != CE_None)
564564
break;
565565
}

alg/gdalmediancut.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,13 +445,13 @@ int GDALComputeMedianCutPCTInternal(
445445
}
446446

447447
err = GDALRasterIO(hRed, GF_Read, 0, iLine, nXSize, 1, pabyRedLine,
448-
nXSize, 1, GDT_Byte, 0, 0);
448+
nXSize, 1, GDT_UInt8, 0, 0);
449449
if (err == CE_None)
450450
err = GDALRasterIO(hGreen, GF_Read, 0, iLine, nXSize, 1,
451-
pabyGreenLine, nXSize, 1, GDT_Byte, 0, 0);
451+
pabyGreenLine, nXSize, 1, GDT_UInt8, 0, 0);
452452
if (err == CE_None)
453453
err = GDALRasterIO(hBlue, GF_Read, 0, iLine, nXSize, 1,
454-
pabyBlueLine, nXSize, 1, GDT_Byte, 0, 0);
454+
pabyBlueLine, nXSize, 1, GDT_UInt8, 0, 0);
455455
if (err != CE_None)
456456
goto end_and_cleanup;
457457

alg/gdalpansharpen.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ GDALPansharpenOperation::Initialize(const GDALPansharpenOptions *psOptionsIn)
359359
if (psOptionsIn->nBitDepth)
360360
{
361361
if (psOptionsIn->nBitDepth < 0 || psOptionsIn->nBitDepth > 31 ||
362-
(eWorkDataType == GDT_Byte && psOptionsIn->nBitDepth > 8) ||
362+
(eWorkDataType == GDT_UInt8 && psOptionsIn->nBitDepth > 8) ||
363363
(eWorkDataType == GDT_UInt16 && psOptionsIn->nBitDepth > 16))
364364
{
365365
CPLError(CE_Failure, CPLE_AppDefined,
@@ -374,7 +374,7 @@ GDALPansharpenOperation::Initialize(const GDALPansharpenOptions *psOptionsIn)
374374
if (psOptions->nBitDepth == GDALGetDataTypeSizeBits(eWorkDataType))
375375
psOptions->nBitDepth = 0;
376376
if (psOptions->nBitDepth &&
377-
!(eWorkDataType == GDT_Byte || eWorkDataType == GDT_UInt16 ||
377+
!(eWorkDataType == GDT_UInt8 || eWorkDataType == GDT_UInt16 ||
378378
eWorkDataType == GDT_UInt32 || eWorkDataType == GDT_UInt64))
379379
{
380380
CPLError(CE_Warning, CPLE_AppDefined,
@@ -953,7 +953,7 @@ CPLErr GDALPansharpenOperation::WeightedBrovey(
953953
{
954954
switch (eBufDataType)
955955
{
956-
case GDT_Byte:
956+
case GDT_UInt8:
957957
WeightedBrovey(pPanBuffer, pUpsampledSpectralBuffer,
958958
static_cast<GByte *>(pDataBuf), nValues, nBandValues,
959959
nMaxValue);
@@ -1039,7 +1039,7 @@ CPLErr GDALPansharpenOperation::WeightedBrovey(
10391039
{
10401040
switch (eBufDataType)
10411041
{
1042-
case GDT_Byte:
1042+
case GDT_UInt8:
10431043
WeightedBrovey3<WorkDataType, GByte, FALSE>(
10441044
pPanBuffer, pUpsampledSpectralBuffer,
10451045
static_cast<GByte *>(pDataBuf), nValues, nBandValues, 0);
@@ -1171,7 +1171,7 @@ CPLErr GDALPansharpenOperation::ProcessRegion(int nXOff, int nYOff, int nXSize,
11711171
GDALRasterBand::FromHandle(psOptions->hPanchroBand);
11721172
GDALDataType eWorkDataType = poPanchroBand->GetRasterDataType();
11731173
#ifdef LIMIT_TYPES
1174-
if (eWorkDataType != GDT_Byte && eWorkDataType != GDT_UInt16)
1174+
if (eWorkDataType != GDT_UInt8 && eWorkDataType != GDT_UInt16)
11751175
eWorkDataType = GDT_Float64;
11761176
#endif
11771177
const int nDataTypeSize = GDALGetDataTypeSizeBytes(eWorkDataType);
@@ -1495,7 +1495,7 @@ CPLErr GDALPansharpenOperation::ProcessRegion(int nXOff, int nYOff, int nXSize,
14951495
nBandBitDepth = atoi(pszNBITS);
14961496
if (nBandBitDepth < nBitDepth)
14971497
{
1498-
if (eWorkDataType == GDT_Byte && nBitDepth >= 0 &&
1498+
if (eWorkDataType == GDT_UInt8 && nBitDepth >= 0 &&
14991499
nBitDepth <= 8)
15001500
{
15011501
ClampValues(
@@ -1535,7 +1535,7 @@ CPLErr GDALPansharpenOperation::ProcessRegion(int nXOff, int nYOff, int nXSize,
15351535
void *pDataBufOri = pDataBuf;
15361536
// CFloat64 is the query type used by gdallocationinfo...
15371537
#ifdef LIMIT_TYPES
1538-
if (eBufDataType != GDT_Byte && eBufDataType != GDT_UInt16)
1538+
if (eBufDataType != GDT_UInt8 && eBufDataType != GDT_UInt16)
15391539
#else
15401540
if (eBufDataType == GDT_CFloat64)
15411541
#endif
@@ -1735,7 +1735,7 @@ CPLErr GDALPansharpenOperation::PansharpenChunk(
17351735

17361736
switch (eWorkDataType)
17371737
{
1738-
case GDT_Byte:
1738+
case GDT_UInt8:
17391739
eErr = WeightedBrovey(
17401740
static_cast<const GByte *>(pPanBuffer),
17411741
static_cast<const GByte *>(pUpsampledSpectralBuffer), pDataBuf,

alg/gdalproximity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ CPLErr CPL_STDCALL GDALComputeProximity(GDALRasterBandH hSrcBand,
252252
GInt32 *panSrcScanline = nullptr;
253253
bool bTempFileAlreadyDeleted = false;
254254

255-
if (eProxType == GDT_Byte || eProxType == GDT_UInt16 ||
255+
if (eProxType == GDT_UInt8 || eProxType == GDT_UInt16 ||
256256
eProxType == GDT_UInt32)
257257
{
258258
GDALDriverH hDriver = GDALGetDriverByName("GTiff");

alg/gdalrasterize.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ static void gvBurnScanline(GDALRasterizeInfo *psInfo, int nY, int nXStart,
216216

217217
switch (psInfo->eType)
218218
{
219-
case GDT_Byte:
219+
case GDT_UInt8:
220220
gvBurnScanlineBasic<GByte>(psInfo, nY, nXStart, nXEnd, dfVariant);
221221
break;
222222
case GDT_Int8:
@@ -350,7 +350,7 @@ static void gvBurnPoint(GDALRasterizeInfo *psInfo, int nY, int nX,
350350

351351
switch (psInfo->eType)
352352
{
353-
case GDT_Byte:
353+
case GDT_UInt8:
354354
gvBurnPointBasic<GByte>(psInfo, nY, nX, dfVariant);
355355
break;
356356
case GDT_Int8:
@@ -937,7 +937,7 @@ static CPLErr GDALRasterizeGeometriesInternal(
937937
* int nBufXSize = 1024;
938938
* int nBufYSize = 1024;
939939
* int nBandCount = 1;
940-
* GDALDataType eType = GDT_Byte;
940+
* GDALDataType eType = GDT_UInt8;
941941
* int nDataTypeSize = GDALGetDataTypeSizeBytes(eType);
942942
*
943943
* void* pData = CPLCalloc( nBufXSize*nBufYSize*nBandCount, nDataTypeSize );
@@ -1263,7 +1263,7 @@ static CPLErr GDALRasterizeGeometriesInternal(
12631263
const int nYBlocks = DIV_ROUND_UP(poBand->GetYSize(), nYBlockSize);
12641264

12651265
const GDALDataType eType =
1266-
poBand->GetRasterDataType() == GDT_Byte ? GDT_Byte : GDT_Float64;
1266+
poBand->GetRasterDataType() == GDT_UInt8 ? GDT_UInt8 : GDT_Float64;
12671267

12681268
const int nPixelSize = nBandCount * GDALGetDataTypeSizeBytes(eType);
12691269

alg/gdalsievefilter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static CPLErr GPMaskImageData(GDALRasterBandH hMaskBand, GByte *pabyMaskLine,
6161

6262
{
6363
const CPLErr eErr = GDALRasterIO(hMaskBand, GF_Read, 0, iY, nXSize, 1,
64-
pabyMaskLine, nXSize, 1, GDT_Byte, 0, 0);
64+
pabyMaskLine, nXSize, 1, GDT_UInt8, 0, 0);
6565
if (eErr == CE_None)
6666
{
6767
for (int i = 0; i < nXSize; i++)

alg/gdalsimplewarp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ int CPL_STDCALL GDALSimpleImageWarp(GDALDatasetH hSrcDS, GDALDatasetH hDstDS,
281281
if (GDALRasterIO(GDALGetRasterBand(hSrcDS, panBandList[iBand]), GF_Read,
282282
0, 0, nSrcXSize, nSrcYSize,
283283
apabySrcDataUniquePtr[iBand].get(), nSrcXSize,
284-
nSrcYSize, GDT_Byte, 0, 0) != CE_None)
284+
nSrcYSize, GDT_UInt8, 0, 0) != CE_None)
285285
{
286286
CPLError(CE_Failure, CPLE_FileIO,
287287
"GDALSimpleImageWarp GDALRasterIO failure %s",
@@ -369,7 +369,7 @@ int CPL_STDCALL GDALSimpleImageWarp(GDALDatasetH hSrcDS, GDALDatasetH hDstDS,
369369
if (GDALRasterIO(GDALGetRasterBand(hDstDS, iBand + 1), GF_Read,
370370
0, iDstY, nDstXSize, 1,
371371
apabyDstLine[iBand].get(), nDstXSize, 1,
372-
GDT_Byte, 0, 0) != CE_None)
372+
GDT_UInt8, 0, 0) != CE_None)
373373
{
374374
return FALSE;
375375
}
@@ -423,7 +423,7 @@ int CPL_STDCALL GDALSimpleImageWarp(GDALDatasetH hSrcDS, GDALDatasetH hDstDS,
423423
{
424424
if (GDALRasterIO(GDALGetRasterBand(hDstDS, iBand + 1), GF_Write, 0,
425425
iDstY, nDstXSize, 1, apabyDstLine[iBand].get(),
426-
nDstXSize, 1, GDT_Byte, 0, 0) != CE_None)
426+
nDstXSize, 1, GDT_UInt8, 0, 0) != CE_None)
427427
{
428428
return FALSE;
429429
}

alg/gdalwarper.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ CPLErr GDALWarpNoDataMasker(void *pMaskFuncArg, int nBandCount,
366366

367367
switch (eType)
368368
{
369-
case GDT_Byte:
369+
case GDT_UInt8:
370370
return GDALWarpNoDataMaskerT(padfNoData, nPixels,
371371
*ppImageData, // Already a GByte *.
372372
panValidityMask, pbOutAllValid);
@@ -540,7 +540,7 @@ CPLErr GDALWarpSrcAlphaMasker(void *pMaskFuncArg, int /* nBandCount */,
540540
GDALDataType eDT = GDALGetRasterDataType(hAlphaBand);
541541
// Make sure that pafMask is at least 8-byte aligned, which should
542542
// normally be always the case if being a ptr returned by malloc().
543-
if ((eDT == GDT_Byte || eDT == GDT_UInt16) && CPL_IS_ALIGNED(pafMask, 8))
543+
if ((eDT == GDT_UInt8 || eDT == GDT_UInt16) && CPL_IS_ALIGNED(pafMask, 8))
544544
{
545545
// Read data.
546546
eErr = GDALRasterIOEx(
@@ -554,7 +554,7 @@ CPLErr GDALWarpSrcAlphaMasker(void *pMaskFuncArg, int /* nBandCount */,
554554
// Make sure we have the correct alignment before doing SSE
555555
// On Linux x86_64, the alignment should be always correct due
556556
// the alignment of malloc() being 16 byte.
557-
const GUInt32 mask = (eDT == GDT_Byte) ? 0xff : 0xffff;
557+
const GUInt32 mask = (eDT == GDT_UInt8) ? 0xff : 0xffff;
558558
if (!CPL_IS_ALIGNED(pafMask, 16))
559559
{
560560
pafMask[iPixel] =
@@ -752,7 +752,7 @@ CPLErr GDALWarpSrcMaskMasker(void *pMaskFuncArg, int /* nBandCount */,
752752
/* Read the mask band. */
753753
/* -------------------------------------------------------------------- */
754754
CPLErr eErr = GDALRasterIO(hMaskBand, GF_Read, nXOff, nYOff, nXSize, nYSize,
755-
pabySrcMask, nXSize, nYSize, GDT_Byte, 0, 0);
755+
pabySrcMask, nXSize, nYSize, GDT_UInt8, 0, 0);
756756

757757
if (eErr != CE_None)
758758
{
@@ -840,7 +840,7 @@ CPLErr GDALWarpDstAlphaMasker(void *pMaskFuncArg, int nBandCount,
840840
const GDALDataType eDT = GDALGetRasterDataType(hAlphaBand);
841841
// Make sure that pafMask is at least 8-byte aligned, which should
842842
// normally be always the case if being a ptr returned by malloc().
843-
if ((eDT == GDT_Byte || eDT == GDT_UInt16) &&
843+
if ((eDT == GDT_UInt8 || eDT == GDT_UInt16) &&
844844
CPL_IS_ALIGNED(pafMask, 8))
845845
{
846846
// Read data.
@@ -855,7 +855,7 @@ CPLErr GDALWarpDstAlphaMasker(void *pMaskFuncArg, int nBandCount,
855855
// Make sure we have the correct alignment before doing SSE
856856
// On Linux x86_64, the alignment should be always correct due
857857
// the alignment of malloc() being 16 byte.
858-
const GUInt32 mask = (eDT == GDT_Byte) ? 0xff : 0xffff;
858+
const GUInt32 mask = (eDT == GDT_UInt8) ? 0xff : 0xffff;
859859
if (!CPL_IS_ALIGNED(pafMask, 16))
860860
{
861861
pafMask[iPixel] =
@@ -958,7 +958,7 @@ CPLErr GDALWarpDstAlphaMasker(void *pMaskFuncArg, int nBandCount,
958958
const float cst_alpha_max =
959959
static_cast<float>(CPLAtof(CSLFetchNameValueDef(
960960
psWO->papszWarpOptions, "DST_ALPHA_MAX", "255"))) +
961-
((eDT == GDT_Byte || eDT == GDT_Int16 || eDT == GDT_UInt16 ||
961+
((eDT == GDT_UInt8 || eDT == GDT_Int16 || eDT == GDT_UInt16 ||
962962
eDT == GDT_Int32 || eDT == GDT_UInt32)
963963
? 0.1f
964964
: 0.0f);
@@ -968,7 +968,7 @@ CPLErr GDALWarpDstAlphaMasker(void *pMaskFuncArg, int nBandCount,
968968
#if (defined(__x86_64) || defined(_M_X64))
969969
// Make sure that pafMask is at least 8-byte aligned, which should
970970
// normally be always the case if being a ptr returned by malloc()
971-
if ((eDT == GDT_Byte || eDT == GDT_Int16 || eDT == GDT_UInt16) &&
971+
if ((eDT == GDT_UInt8 || eDT == GDT_Int16 || eDT == GDT_UInt16) &&
972972
CPL_IS_ALIGNED(pafMask, 8))
973973
{
974974
// Make sure we have the correct alignment before doing SSE
@@ -1756,7 +1756,7 @@ void CPL_STDCALL GDALWarpResolveWorkingDataType(GDALWarpOptions *psOptions)
17561756
return;
17571757
}
17581758

1759-
psOptions->eWorkingDataType = GDT_Byte;
1759+
psOptions->eWorkingDataType = GDT_UInt8;
17601760

17611761
// If none of the provided input nodata values can be represented in the
17621762
// data type of the corresponding source band, ignore them.

0 commit comments

Comments
 (0)