Skip to content

Commit

Permalink
GDALDatasetPamInfo: use std::array<> for adfGeoTransform member (OSGe…
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub authored Sep 13, 2024
1 parent acca3c2 commit daab6da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion gcore/gdal_pam.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "cpl_minixml.h"
#include "gdal_priv.h"
#include <array>
#include <limits>
#include <map>
#include <vector>
Expand Down Expand Up @@ -95,7 +96,7 @@ class GDALDatasetPamInfo
OGRSpatialReference *poSRS = nullptr;

int bHaveGeoTransform = false;
double adfGeoTransform[6]{0, 0, 0, 0, 0, 0};
std::array<double, 6> adfGeoTransform{};

std::vector<gdal::GCP> asGCPs{};
OGRSpatialReference *poGCP_SRS = nullptr;
Expand Down
8 changes: 5 additions & 3 deletions gcore/gdalpamdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,8 @@ CPLErr GDALPamDataset::GetGeoTransform(double *padfTransform)
{
if (psPam && psPam->bHaveGeoTransform)
{
memcpy(padfTransform, psPam->adfGeoTransform, sizeof(double) * 6);
memcpy(padfTransform, psPam->adfGeoTransform.data(),
sizeof(psPam->adfGeoTransform));
return CE_None;
}

Expand All @@ -1423,7 +1424,8 @@ CPLErr GDALPamDataset::SetGeoTransform(double *padfTransform)
{
MarkPamDirty();
psPam->bHaveGeoTransform = TRUE;
memcpy(psPam->adfGeoTransform, padfTransform, sizeof(double) * 6);
memcpy(psPam->adfGeoTransform.data(), padfTransform,
sizeof(psPam->adfGeoTransform));
return (CE_None);
}

Expand Down Expand Up @@ -1689,7 +1691,7 @@ CPLErr GDALPamDataset::TryLoadAux(CSLConstList papszSiblingFiles)
/* -------------------------------------------------------------------- */
/* Geotransform. */
/* -------------------------------------------------------------------- */
if (poAuxDS->GetGeoTransform(psPam->adfGeoTransform) == CE_None)
if (poAuxDS->GetGeoTransform(psPam->adfGeoTransform.data()) == CE_None)
psPam->bHaveGeoTransform = TRUE;

/* -------------------------------------------------------------------- */
Expand Down

0 comments on commit daab6da

Please sign in to comment.