Skip to content

Commit

Permalink
use GDAL's NITFGetField instead of our own
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Jan 7, 2013
1 parent b32061e commit 69b97e6
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions src/drivers/nitf/NitfFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,6 @@ namespace drivers
namespace nitf
{




// this is a copy of the GDAL function, because the GDAL function isn't exported
static char* myNITFGetField(char *pszTarget, const char *pszSource,
int nStart, int nLength)
{
memcpy(pszTarget, pszSource + nStart, nLength);
pszTarget[nLength] = '\0';

return pszTarget;
}


// --------------------------------------------------------------------------


NitfFile::NitfFile(const std::string& filename)
: m_filename(filename)
, m_file(NULL)
Expand Down Expand Up @@ -293,7 +276,7 @@ void NitfFile::processTREs(int nTREBytes, const char *pszTREData, pdal::Metadata

while (nTREBytes > 10)
{
int nThisTRESize = atoi(myNITFGetField(szTemp, pszTREData, 6, 5));
int nThisTRESize = atoi(NITFGetField(szTemp, pszTREData, 6, 5));
if (nThisTRESize < 0 || nThisTRESize > nTREBytes - 11)
{
break;
Expand All @@ -306,14 +289,7 @@ void NitfFile::processTREs(int nTREBytes, const char *pszTREData, pdal::Metadata
const std::string value(pszTREData, nThisTRESize+1);
Metadata m(parentkey+"."+key, value);

// const std::string value(pszTREData + 11);

//std::vector<boost::uint8_t> data(nThisTRESize);
//boost::uint8_t* p = (boost::uint8_t*)(pszTREData + 11);
//for (int i=0; i<nThisTRESize; i++) data[i] = p[i];
//ByteArray value(data);

if (!boost::iequals(key, "DESDATA"))
if (!boost::iequals(key, "DESDATA")) // LAS data stored in here
{
ms.addMetadata<std::string>(parentkey+"."+key, value);
}
Expand Down

0 comments on commit 69b97e6

Please sign in to comment.