Fix build with jsoncpp 1.8.4.

Backported from https://github.com/PDAL/PDAL/pull/1759
breakage reported by naddy@
This commit is contained in:
landry 2018-02-12 20:47:35 +00:00
parent 65ebc9c7f1
commit 38f7826fb6
2 changed files with 53 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.4 2017/11/04 21:26:00 landry Exp $
# $OpenBSD: Makefile,v 1.5 2018/02/12 20:47:35 landry Exp $
COMMENT = translator library for point cloud formats
@ -6,6 +6,7 @@ GH_TAGNAME = 1.6
GH_ACCOUNT = PDAL
GH_PROJECT = PDAL
DISTNAME = ${GH_PROJECT:L}-${GH_TAGNAME}
REVISION = 0
SHARED_LIBS = pdal_base 1.0 # 6.1
SHARED_LIBS += pdal_util 0.1 # 6.1

View File

@ -0,0 +1,51 @@
$OpenBSD: patch-dimbuilder_DimBuilder_cpp,v 1.1 2018/02/12 20:47:35 landry Exp $
fix build with jsoncpp 1.8.4
https://github.com/PDAL/PDAL/commit/f717a4ceabf2c23fcb03838945865cd54a4698c7
Index: dimbuilder/DimBuilder.cpp
--- dimbuilder/DimBuilder.cpp.orig
+++ dimbuilder/DimBuilder.cpp
@@ -174,9 +174,11 @@ bool DimBuilder::execute()
void DimBuilder::extractDim(Json::Value& dim)
{
DimSpec d;
+ Json::Value empty;
// Get dimension name.
- Json::Value name = dim.removeMember("name");
+ Json::Value name = dim.get("name", empty);
+ dim.removeMember("name");
if (name.isNull())
throw dimbuilder_error("Dimension missing name.");
if (!name.isString())
@@ -185,7 +187,8 @@ void DimBuilder::extractDim(Json::Value& dim)
validateDimension(d.m_name);
// Get dimension description.
- Json::Value description = dim.removeMember("description");
+ Json::Value description = dim.get("description", empty);
+ dim.removeMember("description");
if (description.isNull())
{
std::ostringstream oss;
@@ -204,7 +207,8 @@ void DimBuilder::extractDim(Json::Value& dim)
d.m_description = description.asString();
// Get dimension type
- Json::Value type = dim.removeMember("type");
+ Json::Value type = dim.get("type", empty);
+ dim.removeMember("type");
if (type.isNull())
{
std::ostringstream oss;
@@ -222,7 +226,8 @@ void DimBuilder::extractDim(Json::Value& dim)
throw dimbuilder_error(oss.str());
}
- Json::Value altNames = dim.removeMember("alt_names");
+ Json::Value altNames = dim.get("alt_names", empty);
+ dim.removeMember("alt_names");
if (!altNames.isNull())
{
if (!altNames.isString())