Skip to content

Commit

Permalink
LAN: remove wrong byte-swapping for big-endian hosts (byte swapping i…
Browse files Browse the repository at this point in the history
…s already done after reading the header)

git-svn-id: https://svn.osgeo.org/gdal/trunk@35114 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information
rouault committed Aug 15, 2016
1 parent f4d7b6a commit bc6a7fa
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions gdal/frmts/raw/landataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,26 +427,21 @@ GDALDataset *LANDataset::Open( GDALOpenInfo * poOpenInfo )
{
float fTmp = 0.0;
memcpy(&fTmp, poDS->pachHeader + 16, 4);
CPL_LSBPTR32(&fTmp);
poDS->nRasterXSize = (int) fTmp;
memcpy(&fTmp, poDS->pachHeader + 20, 4);
CPL_LSBPTR32(&fTmp);
poDS->nRasterYSize = (int) fTmp;
}
else
{
GInt32 nTmp = 0;
memcpy(&nTmp, poDS->pachHeader + 16, 4);
CPL_LSBPTR32(&nTmp);
poDS->nRasterXSize = nTmp;
memcpy(&nTmp, poDS->pachHeader + 20, 4);
CPL_LSBPTR32(&nTmp);
poDS->nRasterYSize = nTmp;
}

GInt16 nTmp16 = 0;
memcpy(&nTmp16, poDS->pachHeader + 6, 2);
CPL_LSBPTR16(&nTmp16);

int nPixelOffset = 0;
GDALDataType eDataType = GDT_Unknown;
Expand Down Expand Up @@ -476,7 +471,6 @@ GDALDataset *LANDataset::Open( GDALOpenInfo * poOpenInfo )
}

memcpy(&nTmp16, poDS->pachHeader + 8, 2);
CPL_LSBPTR16(&nTmp16);
const int nBandCount = nTmp16;

if( !GDALCheckDatasetDimensions(poDS->nRasterXSize, poDS->nRasterYSize) ||
Expand Down Expand Up @@ -538,18 +532,14 @@ GDALDataset *LANDataset::Open( GDALOpenInfo * poOpenInfo )
float fTmp = 0.0;

memcpy(&fTmp, poDS->pachHeader + 112, 4);
CPL_LSBPTR32(&fTmp);
poDS->adfGeoTransform[0] = fTmp;
memcpy(&fTmp, poDS->pachHeader + 120, 4);
CPL_LSBPTR32(&fTmp);
poDS->adfGeoTransform[1] = fTmp;
poDS->adfGeoTransform[2] = 0.0;
memcpy(&fTmp, poDS->pachHeader + 116, 4);
CPL_LSBPTR32(&fTmp);
poDS->adfGeoTransform[3] = fTmp;
poDS->adfGeoTransform[4] = 0.0;
memcpy(&fTmp, poDS->pachHeader + 124, 4);
CPL_LSBPTR32(&fTmp);
poDS->adfGeoTransform[5] = - fTmp;

// adjust for center of pixel vs. top left corner of pixel.
Expand All @@ -572,7 +562,6 @@ GDALDataset *LANDataset::Open( GDALOpenInfo * poOpenInfo )
/* Try to come up with something for the coordinate system. */
/* -------------------------------------------------------------------- */
memcpy(&nTmp16, poDS->pachHeader + 88, 2);
CPL_LSBPTR16(&nTmp16);
int nCoordSys = nTmp16;

if( nCoordSys == 0 )
Expand Down

0 comments on commit bc6a7fa

Please sign in to comment.