diff --git a/src/dwarfs/compression/flac.cpp b/src/dwarfs/compression/flac.cpp index d9b5c6d8..a8a6b75e 100644 --- a/src/dwarfs/compression/flac.cpp +++ b/src/dwarfs/compression/flac.cpp @@ -212,14 +212,14 @@ class flac_block_compressor final : public block_compressor::impl { "internal error: flac compression requires metadata"); } - auto meta = folly::parseJson(*metadata); + auto meta = nlohmann::json::parse(*metadata); - auto endianness = meta["endianness"].asString(); - auto signedness = meta["signedness"].asString(); - auto padding = meta["padding"].asString(); - auto num_channels = meta["number_of_channels"].asInt(); - auto bits_per_sample = meta["bits_per_sample"].asInt(); - auto bytes_per_sample = meta["bytes_per_sample"].asInt(); + auto endianness = meta["endianness"].get(); + auto signedness = meta["signedness"].get(); + auto padding = meta["padding"].get(); + auto num_channels = meta["number_of_channels"].get(); + auto bits_per_sample = meta["bits_per_sample"].get(); + auto bytes_per_sample = meta["bytes_per_sample"].get(); assert(1 <= bytes_per_sample && bytes_per_sample <= 4); assert(8 <= bits_per_sample && bits_per_sample <= 32); @@ -368,10 +368,10 @@ class flac_block_compressor final : public block_compressor::impl { compression_constraints get_compression_constraints(std::string const& metadata) const override { - auto meta = folly::parseJson(metadata); + auto meta = nlohmann::json::parse(metadata); - auto num_channels = meta["number_of_channels"].asInt(); - auto bytes_per_sample = meta["bytes_per_sample"].asInt(); + auto num_channels = meta["number_of_channels"].get(); + auto bytes_per_sample = meta["bytes_per_sample"].get(); compression_constraints cc; diff --git a/src/dwarfs/file_scanner.cpp b/src/dwarfs/file_scanner.cpp index 2231097e..1fefe8aa 100644 --- a/src/dwarfs/file_scanner.cpp +++ b/src/dwarfs/file_scanner.cpp @@ -27,10 +27,11 @@ #include #include -#include #include +#include + #include "dwarfs/checksum.h" #include "dwarfs/entry.h" #include "dwarfs/file_scanner.h" @@ -569,7 +570,8 @@ void file_scanner_::dump_value(std::ostream& os, os << "{\n" << " \"ptr\": \"" << fmt::format("{}", reinterpret_cast(p)) << "\",\n" - << " \"path\": " << folly::toJson(p->path_as_string()) << ",\n" + << " \"path\": " << nlohmann::json{p->path_as_string()}.dump() + << ",\n" << " \"size\": " << fmt::format("{}", p->size()) << ",\n" << " \"refcnt\": " << fmt::format("{}", p->refcount()) << ",\n" << " \"hash\": \"" << folly::hexlify(p->hash()) << "\",\n" diff --git a/test/fits_categorizer_test.cpp b/test/fits_categorizer_test.cpp index 2c1a556d..ab493397 100644 --- a/test/fits_categorizer_test.cpp +++ b/test/fits_categorizer_test.cpp @@ -31,9 +31,10 @@ #include #include -#include #include +#include + #include "dwarfs/categorizer.h" #include "dwarfs/mmap.h" @@ -171,7 +172,7 @@ TEST_F(fits_categorizer, unused_lsb_count_test) { EXPECT_EQ(1, unused_lsb_counts.size()); unsigned unused_lsb_count = *unused_lsb_counts.begin(); auto json = catmgr->category_metadata(cat); - auto metadata = folly::parseJson(json); - EXPECT_EQ(unused_lsb_count, metadata["unused_lsb_count"].asInt()); + auto metadata = nlohmann::json::parse(json); + EXPECT_EQ(unused_lsb_count, metadata["unused_lsb_count"].get()); } }