refactor: rename DTree to DValue
This commit is contained in:
+6
-6
@@ -29,16 +29,16 @@ RENDER(Request& context)
|
||||
mkdir(base);
|
||||
mkdir(extract_dir);
|
||||
|
||||
DTree entries;
|
||||
DValue entries;
|
||||
entries["hello.txt"] = "Hello ZIP";
|
||||
entries["nested/readme.txt"] = "Nested file";
|
||||
DTree explicit_entry;
|
||||
DValue explicit_entry;
|
||||
explicit_entry["name"] = "data/value.txt";
|
||||
explicit_entry["content"] = "42";
|
||||
entries["ignored-map-key"] = explicit_entry;
|
||||
|
||||
bool created = zip_create(archive, entries);
|
||||
DTree listed = zip_list(archive);
|
||||
DValue listed = zip_list(archive);
|
||||
String hello = zip_read(archive, "hello.txt");
|
||||
bool extracted = zip_extract(archive, extract_dir);
|
||||
String nested = file_get_contents(path_join(extract_dir, "nested/readme.txt"));
|
||||
@@ -52,7 +52,7 @@ RENDER(Request& context)
|
||||
bool unsafe_rejected = false;
|
||||
try
|
||||
{
|
||||
DTree unsafe_entries;
|
||||
DValue unsafe_entries;
|
||||
unsafe_entries["/absolute.txt"] = "bad";
|
||||
zip_create(path_join(base, "unsafe.zip"), unsafe_entries);
|
||||
}
|
||||
@@ -65,7 +65,7 @@ RENDER(Request& context)
|
||||
bool nul_name_rejected = false;
|
||||
try
|
||||
{
|
||||
DTree unsafe_entries;
|
||||
DValue unsafe_entries;
|
||||
String nul_name = "prefix";
|
||||
nul_name.push_back((char)0x00);
|
||||
nul_name += "suffix.txt";
|
||||
@@ -83,7 +83,7 @@ RENDER(Request& context)
|
||||
binary_source += "binary";
|
||||
binary_source.push_back((char)0xff);
|
||||
binary_source += "payload";
|
||||
DTree binary_entries;
|
||||
DValue binary_entries;
|
||||
binary_entries["binary.dat"] = binary_source;
|
||||
String binary_archive = path_join(base, "binary.zip");
|
||||
bool binary_created = zip_create(binary_archive, binary_entries);
|
||||
|
||||
Reference in New Issue
Block a user