Stop using deprecated Data::{get,set}FinalBlockId()

This commit also fixes several build failures with gcc-8 and guards
against a potential crash in WriteHandle::onSegmentDataValidated()

Change-Id: I054f0f8e55f225c293e74fa219b6ee3103dd8e46
Refs: #4526
diff --git a/tools/ndngetfile.cpp b/tools/ndngetfile.cpp
index dbc5b5d..4d26763 100644
--- a/tools/ndngetfile.cpp
+++ b/tools/ndngetfile.cpp
@@ -167,7 +167,7 @@
   uint64_t segment = name[-1].toSegment();
   BOOST_VERIFY(segment == (m_nextSegment - 1));
 
-  const ndn::name::Component& finalBlockId = data.getMetaInfo().getFinalBlockId();
+  auto finalBlockId = data.getFinalBlock();
   if (finalBlockId == name[-1]) {
     m_isFinished = true;
   }
diff --git a/tools/ndnputfile.cpp b/tools/ndnputfile.cpp
index 6b34376..583d478 100644
--- a/tools/ndnputfile.cpp
+++ b/tools/ndnputfile.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -201,7 +201,7 @@
                                     .appendSegment(m_currentSegmentNo));
 
     if (insertStream->peek() == std::istream::traits_type::eof()) {
-      data->setFinalBlockId(ndn::name::Component::fromSegment(m_currentSegmentNo));
+      data->setFinalBlock(ndn::name::Component::fromSegment(m_currentSegmentNo));
       m_isFinished = true;
     }
 
@@ -318,8 +318,7 @@
 
   if (m_isFinished) {
     uint64_t final = m_currentSegmentNo - 1;
-    item->second->setFinalBlockId(ndn::name::Component::fromSegment(final));
-
+    item->second->setFinalBlock(ndn::name::Component::fromSegment(final));
   }
   m_face.put(*item->second);
 }