Upgrade jsoncpp to 1.9.4

Bug: 170642246
Change-Id: Id1fae5a1b6421117f923c616718ee4b3571231e0
diff --git a/devtools/tarball.py b/devtools/tarball.py
index ccbda39..3c0ba65 100644
--- a/devtools/tarball.py
+++ b/devtools/tarball.py
@@ -1,5 +1,10 @@
-import os.path
-import gzip
+# Copyright 2010 Baptiste Lepilleur and The JsonCpp Authors
+# Distributed under MIT license, or public domain if desired and
+# recognized in your jurisdiction.
+# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+from contextlib import closing
+import os
 import tarfile
 
 TARGZ_DEFAULT_COMPRESSION_LEVEL = 9
@@ -13,41 +18,35 @@
     prefix_dir: all files stored in the tarball be sub-directory of prefix_dir. Set to ''
         to make them child of root.
     """
-    base_dir = os.path.normpath( os.path.abspath( base_dir ) )
-    def archive_name( path ):
+    base_dir = os.path.normpath(os.path.abspath(base_dir))
+    def archive_name(path):
         """Makes path relative to base_dir."""
-        path = os.path.normpath( os.path.abspath( path ) )
-        common_path = os.path.commonprefix( (base_dir, path) )
+        path = os.path.normpath(os.path.abspath(path))
+        common_path = os.path.commonprefix((base_dir, path))
         archive_name = path[len(common_path):]
-        if os.path.isabs( archive_name ):
+        if os.path.isabs(archive_name):
             archive_name = archive_name[1:]
-        return os.path.join( prefix_dir, archive_name )
+        return os.path.join(prefix_dir, archive_name)
     def visit(tar, dirname, names):
         for name in names:
             path = os.path.join(dirname, name)
             if os.path.isfile(path):
                 path_in_tar = archive_name(path)
-                tar.add(path, path_in_tar )
+                tar.add(path, path_in_tar)
     compression = TARGZ_DEFAULT_COMPRESSION_LEVEL
-    tar = tarfile.TarFile.gzopen( tarball_path, 'w', compresslevel=compression )
-    try:
+    with closing(tarfile.TarFile.open(tarball_path, 'w:gz',
+            compresslevel=compression)) as tar:
         for source in sources:
             source_path = source
-            if os.path.isdir( source ):
-                os.path.walk(source_path, visit, tar)
+            if os.path.isdir(source):
+                for dirpath, dirnames, filenames in os.walk(source_path):
+                    visit(tar, dirpath, filenames)
             else:
                 path_in_tar = archive_name(source_path)
-                tar.add(source_path, path_in_tar )      # filename, arcname
-    finally:
-        tar.close()
+                tar.add(source_path, path_in_tar)      # filename, arcname
 
-def decompress( tarball_path, base_dir ):
+def decompress(tarball_path, base_dir):
     """Decompress the gzipped tarball into directory base_dir.
     """
-    # !!! This class method is not documented in the online doc
-    # nor is bz2open!
-    tar = tarfile.TarFile.gzopen(tarball_path, mode='r')
-    try:
-        tar.extractall( base_dir )
-    finally:
-        tar.close()
+    with closing(tarfile.TarFile.open(tarball_path)) as tar:
+        tar.extractall(base_dir)