Skip to content

Commit

Permalink
Merge pull request OSGeo#6992 from rouault/centos_7_9_fix
Browse files Browse the repository at this point in the history
fix compilation with gcc 4.8.5 of Centos 7.9
  • Loading branch information
rouault authored Dec 30, 2022
2 parents 8442686 + eadb94c commit b713968
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
19 changes: 10 additions & 9 deletions ogr/ogrsf_frmts/flatgeobuf/packedrtree.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,16 @@ template <class ITEM_TYPE> void hilbertSort(std::deque<ITEM_TYPE> &items)
const double minY = extent.minY;
const double width = extent.width();
const double height = extent.height();
std::sort(items.begin(), items.end(),
[minX, minY, width, height](ITEM_TYPE &a, ITEM_TYPE &b)
{
uint32_t ha = hilbert(a.nodeItem, HILBERT_MAX, minX, minY,
width, height);
uint32_t hb = hilbert(b.nodeItem, HILBERT_MAX, minX, minY,
width, height);
return ha > hb;
});
std::sort(
items.begin(), items.end(),
[minX, minY, width, height](const ITEM_TYPE &a, const ITEM_TYPE &b)
{
uint32_t ha =
hilbert(a.nodeItem, HILBERT_MAX, minX, minY, width, height);
uint32_t hb =
hilbert(b.nodeItem, HILBERT_MAX, minX, minY, width, height);
return ha > hb;
});
}

void hilbertSort(std::vector<NodeItem> &items);
Expand Down
34 changes: 17 additions & 17 deletions ogr/ogrsf_frmts/openfilegdb/filegdbindex_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1293,8 +1293,8 @@ bool FileGDBTable::CreateSpatialIndex()
int nDepth = atoi(CPLGetConfigOption("OPENFILEGDB_FORCE_SPX_DEPTH", "0"));

const auto writeValueFunc =
[](std::vector<GByte> &abyPage,
const typename ValueOIDPair::first_type &nval, int /* maxStrSize */)
+[](std::vector<GByte> &abyPage,
const typename ValueOIDPair::first_type &nval, int /* maxStrSize */)
{ WriteUInt64(abyPage, static_cast<uint64_t>(nval)); };

bool bRet = WriteIndex(fp, asValues, writeValueFunc, nDepth);
Expand Down Expand Up @@ -1357,9 +1357,9 @@ bool FileGDBTable::CreateAttributeIndex(const FileGDBIndex *poIndex)
}

const auto writeValueFunc =
[](std::vector<GByte> &abyPage,
const typename ValueOIDPair::first_type &val,
int /* maxStrSize */)
+[](std::vector<GByte> &abyPage,
const typename ValueOIDPair::first_type &val,
int /* maxStrSize */)
{ WriteUInt16(abyPage, static_cast<uint16_t>(val)); };

bRet = WriteIndex(fp, asValues, writeValueFunc, nDepth);
Expand All @@ -1382,9 +1382,9 @@ bool FileGDBTable::CreateAttributeIndex(const FileGDBIndex *poIndex)
}

const auto writeValueFunc =
[](std::vector<GByte> &abyPage,
const typename ValueOIDPair::first_type &val,
int /* maxStrSize */)
+[](std::vector<GByte> &abyPage,
const typename ValueOIDPair::first_type &val,
int /* maxStrSize */)
{ WriteUInt32(abyPage, static_cast<uint32_t>(val)); };

bRet = WriteIndex(fp, asValues, writeValueFunc, nDepth);
Expand All @@ -1407,9 +1407,9 @@ bool FileGDBTable::CreateAttributeIndex(const FileGDBIndex *poIndex)
}

const auto writeValueFunc =
[](std::vector<GByte> &abyPage,
const typename ValueOIDPair::first_type &val,
int /* maxStrSize */) { WriteFloat32(abyPage, val); };
+[](std::vector<GByte> &abyPage,
const typename ValueOIDPair::first_type &val,
int /* maxStrSize */) { WriteFloat32(abyPage, val); };

bRet = WriteIndex(fp, asValues, writeValueFunc, nDepth);
}
Expand All @@ -1434,9 +1434,9 @@ bool FileGDBTable::CreateAttributeIndex(const FileGDBIndex *poIndex)
m_apoFields[iField]->m_eType = eFieldType;

const auto writeValueFunc =
[](std::vector<GByte> &abyPage,
const typename ValueOIDPair::first_type &val,
int /* maxStrSize */) { WriteFloat64(abyPage, val); };
+[](std::vector<GByte> &abyPage,
const typename ValueOIDPair::first_type &val,
int /* maxStrSize */) { WriteFloat64(abyPage, val); };

bRet = WriteIndex(fp, asValues, writeValueFunc, nDepth);
}
Expand Down Expand Up @@ -1491,9 +1491,9 @@ bool FileGDBTable::CreateAttributeIndex(const FileGDBIndex *poIndex)
maxStrSize++;

const auto writeValueFunc =
[](std::vector<GByte> &abyPage,
const typename ValueOIDPair::first_type &val,
int l_maxStrSize)
+[](std::vector<GByte> &abyPage,
const typename ValueOIDPair::first_type &val,
int l_maxStrSize)
{
for (size_t i = 0; i < val.size(); ++i)
WriteUInt16(abyPage, val[i]);
Expand Down

0 comments on commit b713968

Please sign in to comment.